New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 1271 colormap on object #1523
Changes from all commits
d720297
45973a5
8a71576
c6c2425
9313c1f
f9474eb
77b04d6
469973a
77c1c61
616cf4d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -462,7 +462,7 @@ def plot(self, data1, data2, template, gtype, gname, bg, *args, **kargs): | |
|
||
pipeline = vcsvtk.createPipeline(gm, self) | ||
if pipeline is not None: | ||
returned.update(pipeline.plot(data1, data2, tpl, gm, | ||
returned.update(pipeline.plot(data1, data2, tpl, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice.. |
||
vtk_backend_grid, vtk_backend_geo)) | ||
elif gtype in ["3d_scalar", "3d_dual_scalar", "3d_vector"]: | ||
cdms_file = kargs.get('cdmsfile', None) | ||
|
@@ -486,11 +486,13 @@ def plot(self, data1, data2, template, gtype, gname, bg, *args, **kargs): | |
returned["vtk_backend_text_actors"] = vcs2vtk.genTextActor( | ||
ren, | ||
to=to, | ||
tt=tt) | ||
tt=tt, | ||
cmap=self.canvas.colormap) | ||
self.setLayer(ren, tt.priority) | ||
elif gtype == "line": | ||
if gm.priority != 0: | ||
actors = vcs2vtk.prepLine(self.renWin, gm) | ||
actors = vcs2vtk.prepLine(self.renWin, gm, | ||
cmap=self.canvas.colormap) | ||
returned["vtk_backend_line_actors"] = actors | ||
for act, geo in actors: | ||
ren = self.fitToViewport( | ||
|
@@ -502,7 +504,8 @@ def plot(self, data1, data2, template, gtype, gname, bg, *args, **kargs): | |
create_renderer=True) | ||
elif gtype == "marker": | ||
if gm.priority != 0: | ||
actors = vcs2vtk.prepMarker(self.renWin, gm) | ||
actors = vcs2vtk.prepMarker(self.renWin, gm, | ||
cmap=self.canvas.colormap) | ||
returned["vtk_backend_marker_actors"] = actors | ||
for g, gs, pd, act, geo in actors: | ||
ren = self.fitToViewport( | ||
|
@@ -517,7 +520,8 @@ def plot(self, data1, data2, template, gtype, gname, bg, *args, **kargs): | |
|
||
elif gtype == "fillarea": | ||
if gm.priority != 0: | ||
actors = vcs2vtk.prepFillarea(self.renWin, gm) | ||
actors = vcs2vtk.prepFillarea(self.renWin, gm, | ||
cmap=self.canvas.colormap) | ||
returned["vtk_backend_fillarea_actors"] = actors | ||
for act, geo in actors: | ||
ren = self.fitToViewport( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -898,11 +898,10 @@ def prepTextProperty(p, winSize, to="default", tt="default", cmap=None, | |
if isinstance(tt, str): | ||
tt = vcs.elements["texttable"][tt] | ||
|
||
if cmap is None: | ||
if tt.colormap is not None: | ||
cmap = tt.colormap | ||
else: | ||
cmap = 'default' | ||
if tt.colormap is not None: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not just do this: if tt.colormap is not None: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because user can send a cmap to the function |
||
cmap = tt.colormap | ||
elif cmap is None: | ||
cmap = vcs._colorMap | ||
if isinstance(cmap, str): | ||
cmap = vcs.elements["colormap"][cmap] | ||
colorIndex = overrideColorIndex if overrideColorIndex else tt.color | ||
|
@@ -1046,11 +1045,10 @@ def prepFillarea(renWin, farea, cmap=None): | |
actors = [] | ||
|
||
# Find color map: | ||
if cmap is None: | ||
if farea.colormap is not None: | ||
cmap = farea.colormap | ||
else: | ||
cmap = 'default' | ||
if farea.colormap is not None: | ||
cmap = farea.colormap | ||
elif cmap is None: | ||
cmap = vcs._colorMap | ||
if isinstance(cmap, str): | ||
cmap = vcs.elements["colormap"][cmap] | ||
|
||
|
@@ -1324,11 +1322,10 @@ def prepGlyph(g, marker, index=0): | |
|
||
def setMarkerColor(p, marker, c, cmap=None): | ||
# Color | ||
if cmap is None: | ||
if marker.colormap is not None: | ||
cmap = marker.colormap | ||
else: | ||
cmap = 'default' | ||
if marker.colormap is not None: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here. if elif should be used if there is else as well. Unless cmap has some default value. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same, user can send a cmap to function There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if cmap is not None then should you do this instead: Check if cmap is Noneif cmap is None and maker.colormap is not None: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i reviewed the code, it's good as is, if primitive has colorset then it wins. Then falls back on canvas cmap (which is passed I believed) and if nothing fallasback on vcs. Good to be merged when you're happy |
||
cmap = marker.colormap | ||
elif cmap is None: | ||
cmap = vcs._colorMap | ||
if isinstance(cmap, str): | ||
cmap = vcs.elements["colormap"][cmap] | ||
color = cmap.index[c] | ||
|
@@ -1460,11 +1457,11 @@ def prepLine(renWin, line, cmap=None): | |
p = a.GetProperty() | ||
p.SetLineWidth(w) | ||
|
||
if cmap is None: | ||
if line.colormap is not None: | ||
cmap = line.colormap | ||
else: | ||
cmap = 'default' | ||
if line.colormap is not None: | ||
cmap = line.colormap | ||
elif cmap is None: | ||
cmap = vcs._colorMap | ||
|
||
if isinstance(cmap, str): | ||
cmap = vcs.elements["colormap"][cmap] | ||
color = cmap.index[c] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not leave it to "default"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because there are three spots where cmap can be set, so I need to know if user did set it or not.