16 #include <vtkCamera.h>
17 #include <vtkRenderer.h>
18 #include "boost/bind.hpp"
29 PlaneMetricRep::PlaneMetricRep()
32 mViewportListener->setCallback(boost::bind(&PlaneMetricRep::rescale,
this));
37 mGraphicalPoint.reset();
43 mViewportListener->startListen(view->getRenderer());
49 mViewportListener->stopListen();
55 return boost::dynamic_pointer_cast<PlaneMetric>(
mMetric);
69 mRect->setLine(
true, 1);
75 mGraphicalPoint->setColor(
mMetric->getColor());
76 mNormal->setColor(
mMetric->getColor());
77 mRect->setColor(
mMetric->getColor());
88 void PlaneMetricRep::rescale()
95 Vector3D p0_r = planeMetric->getRefCoord();
96 Vector3D n_r = planeMetric->getRefNormal();
98 double size = mViewportListener->getVpnZoom(p0_r);
101 mGraphicalPoint->setValue(p0_r);
102 mGraphicalPoint->setRadius(sphereSize);
104 mNormal->setValue(p0_r, n_r, sphereSize * 8);
106 this->drawRectangleForPlane(p0_r, n_r, size);
111 void PlaneMetricRep::drawRectangleForPlane(
Vector3D p0_r,
Vector3D n_r,
double size)
127 double bb_size = 0.10/size;
128 DoubleBoundingBox3D bb(-bb_size,bb_size,-bb_size,bb_size,0,0);
130 mRect->updatePosition(bb, rMb);