diff options
author | Jack Ha <j.ha@ultimaker.com> | 2017-01-25 14:46:07 +0300 |
---|---|---|
committer | Jack Ha <j.ha@ultimaker.com> | 2017-01-25 14:46:07 +0300 |
commit | 3a2438937d30bdcebc6d6f47af2d3f07a03e5ea5 (patch) | |
tree | dca23ff4247ffce828fc522a3975b800ef2eabcb /cura/LayerPolygon.py | |
parent | a52cb2fa636c2af1f70fedfd3a3af2cbdfb74180 (diff) | |
parent | 26ad2c8f6eb5e14bedcfe4800fceb6c6bdfaa83b (diff) |
Removed crappy legend
Diffstat (limited to 'cura/LayerPolygon.py')
-rw-r--r-- | cura/LayerPolygon.py | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/cura/LayerPolygon.py b/cura/LayerPolygon.py index 34bb38249a..90bc123548 100644 --- a/cura/LayerPolygon.py +++ b/cura/LayerPolygon.py @@ -1,4 +1,5 @@ from UM.Math.Color import Color +from UM.Application import Application import numpy @@ -40,6 +41,7 @@ class LayerPolygon: # Buffering the colors shouldn't be necessary as it is not # re-used and can save alot of memory usage. + self._color_map = LayerPolygon.getColorMap() self._colors = self._color_map[self._types] # When type is used as index returns true if type == LayerPolygon.InfillType or type == LayerPolygon.SkinType or type == LayerPolygon.SupportInfillType @@ -182,17 +184,25 @@ class LayerPolygon: return normals - # Should be generated in better way, not hardcoded. - _color_map = numpy.array([ - [1.0, 1.0, 1.0, 1.0], # NoneType - [1.0, 0.0, 0.0, 1.0], # Inset0Type - [0.0, 1.0, 0.0, 1.0], # InsetXType - [1.0, 1.0, 0.0, 1.0], # SkinType - [0.0, 1.0, 1.0, 1.0], # SupportType - [0.0, 1.0, 1.0, 1.0], # SkirtType - [1.0, 0.75, 0.0, 1.0], # InfillType - [0.0, 1.0, 1.0, 1.0], # SupportInfillType - [0.0, 0.0, 1.0, 1.0], # MoveCombingType - [0.5, 0.5, 1.0, 1.0], # MoveRetractionType - [0.25, 0.75, 1.0, 1.0] # SupportInterfaceType - ])
\ No newline at end of file + __color_map = None + + ## Gets the instance of the VersionUpgradeManager, or creates one. + @classmethod + def getColorMap(cls): + if cls.__color_map is None: + theme = Application.getInstance().getTheme() + cls.__color_map = numpy.array([ + theme.getColor("layerview_none").getRgbF(), # NoneType + theme.getColor("layerview_inset_0").getRgbF(), # Inset0Type + theme.getColor("layerview_inset_x").getRgbF(), # InsetXType + theme.getColor("layerview_skin").getRgbF(), # SkinType + theme.getColor("layerview_support").getRgbF(), # SupportType + theme.getColor("layerview_skirt").getRgbF(), # SkirtType + theme.getColor("layerview_infill").getRgbF(), # InfillType + theme.getColor("layerview_support_infill").getRgbF(), # SupportInfillType + theme.getColor("layerview_move_combing").getRgbF(), # MoveCombingType + theme.getColor("layerview_move_retraction").getRgbF(), # MoveRetractionType + theme.getColor("layerview_support_interface").getRgbF() # SupportInterfaceType + ]) + + return cls.__color_map |