German Larrain avatar German Larrain committed 78e079f

graphics.vtk_adapter: homogenized constructors of Entity subclasses; replaced
calls to `self.adapter._update_pose` with `self.set_pose`.

Comments (0)

Files changed (1)

ars/graphics/vtk_adapter.py

 		# 2 different methods may be used here. See
 		# http://stackoverflow.com/questions/7810632/
 
-		axesActor = vtk.vtkAxesActor()
-		axesActor.AxisLabelsOn()
-		axesActor.SetShaftTypeToCylinder()
-		axesActor.SetCylinderRadius(cylinder_radius)
-		self.adapter._update_pose(axesActor, pos, rot)
-
-		self._actor = axesActor
+		self._actor = vtk.vtkAxesActor()
+		self._actor.AxisLabelsOn()
+		self._actor.SetShaftTypeToCylinder()
+		self._actor.SetCylinderRadius(cylinder_radius)
+		self.set_pose(pos, rot)
 
 
 class Box(VtkBody, base.Box):
 
 		boxMapper = vtk.vtkPolyDataMapper()
 		boxMapper.SetInputConnection(box.GetOutputPort())
-		boxActor = vtk.vtkActor()
+		self._actor = vtk.vtkActor()
 
-		self.adapter._update_pose(boxActor, pos, rot)
-		boxActor.SetMapper(boxMapper)
-
-		self._actor = boxActor
+		self.set_pose(pos, rot)
+		self._actor.SetMapper(boxMapper)  # TODO: does the order matter?
 
 
 class Cone(VtkBody, base.Cone):
 
 		coneMapper = vtk.vtkPolyDataMapper()
 		coneMapper.SetInputConnection(cone.GetOutputPort())
-		coneActor = vtk.vtkActor()
+		self._actor = vtk.vtkActor()
 
-		self.adapter._update_pose(coneActor, center, rot)
-		coneActor.SetMapper(coneMapper)
-
-		self._actor = coneActor
+		self.set_pose(center, rot)
+		self._actor.SetMapper(coneMapper)  # TODO: does the order matter?
 
 
 class Sphere(VtkBody, base.Sphere):
 
 		sphereMapper = vtk.vtkPolyDataMapper()
 		sphereMapper.SetInputConnection(sphere.GetOutputPort())
-		sphereActor = vtk.vtkActor()
+		self._actor = vtk.vtkActor()
 
-		self.adapter._update_pose(sphereActor, center, rot)
-		sphereActor.SetMapper(sphereMapper)
-
-		self._actor = sphereActor
+		self.set_pose(center, rot)
+		self._actor.SetMapper(sphereMapper)  # TODO: does the order matter?
 
 
 class Cylinder(VtkBody, base.Cylinder):
 
 		cylMapper = vtk.vtkPolyDataMapper()
 		cylMapper.SetInputConnection(transFilter.GetOutputPort())
-		cylActor = vtk.vtkActor()
+		self._actor = vtk.vtkActor()
 
-		self.adapter._update_pose(cylActor, center, rot)
-		cylActor.SetMapper(cylMapper)
-
-		self._actor = cylActor
+		self.set_pose(center, rot)
+		self._actor.SetMapper(cylMapper)  # TODO: does the order matter?
 
 
 class Capsule(VtkBody, base.Capsule):
 		assembly.AddPart(cylinderActor)
 		assembly.AddPart(sphereActor1)
 		assembly.AddPart(sphereActor2)
+		self._actor = assembly
 
-		self.adapter._update_pose(assembly, center, rot)
-		self._actor = assembly
+		self.set_pose(center, rot)
 
 
 class Trimesh(VtkBody, base.Trimesh):
 		mapper.SetInput(trianglePolyData)
 
 		# actor: represents an object (geometry & properties) in a rendered scene
-		triangles_actor = vtk.vtkActor()
-		self.adapter._update_pose(triangles_actor, pos, rot)
-		triangles_actor.SetMapper(mapper)
-
-		self._actor = triangles_actor
+		self._actor = vtk.vtkActor()
+		self.set_pose(pos, rot)
+		self._actor.SetMapper(mapper)  # TODO: does the order matter?
 
 
 class ScreenshotRecorder(base.ScreenshotRecorder):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.