Skip to content

Commit

Permalink
Draw lines over meshfills when meshfill.mesh is set.
Browse files Browse the repository at this point in the history
Ref #549.
  • Loading branch information
David C. Lonie committed Nov 17, 2014
1 parent 9ae47b8 commit aa05421
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Packages/vcs/Lib/VTKPlots.py
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,25 @@ def plot2D(self,data1,data2,tmpl,gm):

x1,x2,y1,y2 = vcs2vtk.getRange(gm,xm,xM,ym,yM)

# Add a second mapper for wireframe meshfill:
if isinstance(gm, meshfill.Gfm) and gm.mesh:
lineMappers = []
for polyMapper in mappers:
if isinstance(polyMapper, list):
polyMapper = polyMapper[0]
lineMapper = vtk.vtkPolyDataMapper()
lineMapper.SetInputConnection(polyMapper.GetInputConnection(0, 0))
lineMapper._useWireFrame = True

# Setup depth resolution so lines stay above points:
polyMapper.SetResolveCoincidentTopologyPolygonOffsetParameters(0, 1)

This comment has been minimized.

Copy link
@doutriaux1

doutriaux1 Nov 17, 2014

Contributor

That little bit (SetResolveConicidentTopologyOffsetParameters) is really useful to know!

polyMapper.SetResolveCoincidentTopologyToPolygonOffset()
lineMapper.SetResolveCoincidentTopologyPolygonOffsetParameters(1, 1)
lineMapper.SetResolveCoincidentTopologyToPolygonOffset()

lineMappers.append(lineMapper)
mappers.extend(lineMappers)

if tmpl.data.priority != 0:
# And now we need actors to actually render this thing
for mapper in mappers:
Expand All @@ -1007,6 +1026,8 @@ def plot2D(self,data1,data2,tmpl,gm):
else:
mapper.Update()
act.SetMapper(mapper)
if hasattr(mapper, "_useWireFrame"):
act.GetProperty().SetRepresentationToWireframe()
if geo is None:
act = vcs2vtk.doWrap(act,[x1,x2,y1,y2],wrap)
if isinstance(mapper,list):
Expand Down

0 comments on commit aa05421

Please sign in to comment.