bool VPathNode::fromString( const String &pString ) { // Split Data. // {Position} {Rotation} {Weight} const char *baseData = StringUnit::getUnit( pString.c_str(), 0, "\t" ); Point3F pos; AngAxisF aa; F32 weight; // Scan Base. dSscanf( baseData, "%g %g %g %g %g %g %g %g", &pos.x, &pos.y, &pos.z, &aa.axis.x, &aa.axis.y, &aa.axis.z, &aa.angle, &weight ); // Apply Changes. setLocalPosition( pos ); setLocalRotation( QuatF( aa ) ); setWeight( weight ); // Fetch Orientation Data. String orientationData = StringUnit::getUnit( pString.c_str(), 1, "\t" ); // Fetch Orientation Type. String orientationTypeString = orientationData; if ( orientationData.find( " " ) ) { // Use First Word. orientationTypeString = orientationData.substr( 0, orientationData.find( " " ) ); } // Set Orientation Type. const eOrientationType &orientationType = getOrientationTypeEnum( orientationTypeString.c_str() ); switch( orientationType ) { case k_OrientationFree : { // Apply Mode. setOrientationMode( orientationType ); } break; case k_OrientationToPoint: { // Fetch Point. Point3F lookAtPoint; // Buffer String. dSscanf( orientationData.c_str(), "%*s %f %f %f", &lookAtPoint.x, &lookAtPoint.y, &lookAtPoint.z ); // Apply Mode. setOrientationMode( orientationType, lookAtPoint ); } break; } return true; }
ViewWrapper2D::ViewWrapper2D(ViewPtr view, VisServicesPtr backend) : ViewWrapper(backend), mOrientationActionGroup(new QActionGroup(view.get())) { mView = view; this->connectContextMenu(mView); // disable vtk interactor: this wrapper IS an interactor mView->getRenderWindow()->GetInteractor()->Disable(); mView->getRenderer()->GetActiveCamera()->SetParallelProjection(true); double clipDepth = 1.0; // 1mm depth, i.e. all 3D props rendered outside this range is not shown. double length = clipDepth*10; mView->getRenderer()->GetActiveCamera()->SetPosition(0,0,length); mView->getRenderer()->GetActiveCamera()->SetClippingRange(length-clipDepth, length+0.1); connect(settings(), SIGNAL(valueChangedFor(QString)), this, SLOT(settingsChangedSlot(QString))); // slice proxy mSliceProxy = SliceProxy::create(mServices->getPatientService()); mDataRepContainer.reset(new DataRepContainer()); mDataRepContainer->setSliceProxy(mSliceProxy); mDataRepContainer->setView(mView); mViewFollower = ViewFollower::create(mServices->getPatientService()); mViewFollower->setSliceProxy(mSliceProxy); addReps(); mZoom2D.reset(new Zoom2DHandler()); connect(mZoom2D.get(), SIGNAL(zoomChanged()), this, SLOT(viewportChanged())); setOrientationMode(SyncedValue::create(0)); // must set after addreps() connect(mServices->getToolManager().get(), SIGNAL(activeToolChanged(const QString&)), this, SLOT(activeToolChangedSlot())); connect(mView.get(), SIGNAL(resized(QSize)), this, SLOT(viewportChanged())); connect(mView.get(), SIGNAL(shown()), this, SLOT(showSlot())); connect(mView.get(), SIGNAL(mousePress(int, int, Qt::MouseButtons)), this, SLOT(mousePressSlot(int, int, Qt::MouseButtons))); connect(mView.get(), SIGNAL(mouseMove(int, int, Qt::MouseButtons)), this, SLOT(mouseMoveSlot(int, int, Qt::MouseButtons))); connect(mView.get(), SIGNAL(mouseWheel(int, int, int, int, Qt::MouseButtons)), this, SLOT(mouseWheelSlot(int, int, int, int, Qt::MouseButtons))); this->activeToolChangedSlot(); this->updateView(); }