示例#1
0
/**
 * Adds rep assigned actors to the active renderer
 */
void FiberBundleRep::addRepActorsToViewRenderer(ViewPtr view)
{
	view->getRenderer()->AddActor(mActor);

	if (mViewportListener)
		mViewportListener->startListen(view->getRenderer());
}
示例#2
0
void WbpSceneExporter::write()
{
  MqoDisplayContext *pmqodc = MB_NEW MqoDisplayContext();

  m_mqoRelPath = makeRelSubPath("mqo");

  LString str_wbppath = getPath();
  LString str_mqopath = getPath("mqo");

  // Mqo substream
  qlib::OutStream *pOutMqo = createOutStream("mqo");

  ScenePtr pScene = getClient();

  CameraPtr pCam = getCamera();
  qlib::ensureNotNull(pCam.get());

  pmqodc->init(pOutMqo);
  
  pmqodc->setGradSteps(m_nGradSteps);
  pmqodc->setClipZ(m_bUseClipZ);
  pmqodc->setPerspective(m_bPerspective);
  pmqodc->setBgColor(pScene->getBgColor());

  double zoom = pCam->getZoom();
  pmqodc->setZoom(zoom);
  pmqodc->setSlabDepth(pCam->getSlabDepth());
  pmqodc->setViewDist(pCam->getCamDist());

  pmqodc->loadIdent();
  pmqodc->rotate(pCam->m_rotQuat);
  pmqodc->translate(-(pCam->m_center));
  
  // calc line width factor
  if (pScene->getViewCount()>0) {
    ViewPtr pView = pScene->beginView()->second;
    double wpix = pView->getWidth();
    pmqodc->setLineScale(zoom/wpix);
  }

  pScene->display(pmqodc);

  // cleanup the created streams
  pOutMqo->close();
  delete pOutMqo;

  // Write wbp main stream
  // Enter the context
  {
    m_pdc = pmqodc;
    AutoStyleCtxt style_ctxt(pScene->getUID());
    writeWbp();
    m_pdc = NULL;
  }

  delete pmqodc;
}
示例#3
0
void VideoFixedPlaneRep::removeRepActorsFromViewRenderer(ViewPtr view)
{
	mRenderer = vtkRendererPtr();
	view->getRenderer()->RemoveActor(mRTGraphics->getActor());
	view->getRenderer()->RemoveActor(mInfoText->getActor());
	view->getRenderer()->RemoveActor(mStatusText->getActor());
	view->getRenderer()->RemoveActor(mOrientationVText->getActor());
	mProbeOrigin->setRenderer(NULL);
	mProbeSector->setRenderer(NULL);
	mProbeClipRect->setRenderer(NULL);

	mViewportListener->stopListen();
}
示例#4
0
/**
 * Removes rep assigned actors from the rendering pipeline
 */
void FiberBundleRep::removeRepActorsFromViewRenderer(ViewPtr view)
{
	view->getRenderer()->RemoveActor(mActor);

	if (mViewportListener)
		mViewportListener->stopListen();
}
示例#5
0
void MetricNamesRep::addRepActorsToViewRenderer(ViewPtr view)
{
    for(unsigned i =0; i<mDisplayText.size(); ++i)
    {
        mDisplayText[i]->setRenderer(view->getRenderer());
    }
}
示例#6
0
void PickerRep::removeRepActorsFromViewRenderer(ViewPtr view)
{
	if (view == NULL)
		return;

	this->disconnectInteractor();
	mViewportListener->stopListen();
	mGraphicalPoint.reset();

	if (mGlyphRep)
		view->removeRep(mGlyphRep);
}
QPoint LayoutWidgetUsingViewWidgets::getPosition(ViewPtr view)
{
    ViewWidget* widget = this->WidgetFromView(view);
    if (!widget)
    {
        CX_LOG_ERROR() << "Did not find view in layout " << view->getUid();
        return QPoint(0,0);
    }

    QPoint p = widget->mapToGlobal(QPoint(0,0));
    p = this->mapFromGlobal(p);
    return p;
}
示例#8
0
void VideoFixedPlaneRep::addRepActorsToViewRenderer(ViewPtr view)
{
	mRenderer = view->getRenderer();
	mViewportListener->startListen(mRenderer);

	view->getRenderer()->AddActor(mRTGraphics->getActor());
	view->getRenderer()->AddActor(mInfoText->getActor());
	view->getRenderer()->AddActor(mStatusText->getActor());
	view->getRenderer()->AddActor(mOrientationVText->getActor());

	mProbeClipRect->setRenderer(view->getRenderer());
	mProbeOrigin->setRenderer(view->getRenderer());
	mProbeSector->setRenderer(view->getRenderer());
}
示例#9
0
ViewWrapper2D::ViewWrapper2D(ViewPtr view, VisServicesPtr backend) :
	ViewWrapper(backend),
	mOrientationActionGroup(new QActionGroup(view.get()))
{
	qRegisterMetaType<Vector3D>("Vector3D");
	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->patient());

	mDataRepContainer.reset(new DataRepContainer());
	mDataRepContainer->setSliceProxy(mSliceProxy);
	mDataRepContainer->setView(mView);

	mViewFollower = ViewFollower::create(mServices->patient());
	mViewFollower->setSliceProxy(mSliceProxy);

	addReps();

	mZoom2D.reset(new Zoom2DHandler());
	connect(mZoom2D.get(), SIGNAL(zoomChanged()), this, SLOT(viewportChanged()));

	connect(mServices->tracking().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)));

	connect(mServices->patient().get(), &PatientModelService::videoAddedToTrackedStream, this, &ViewWrapper2D::videoSourcesChangedSlot);

	this->activeToolChangedSlot();
	this->updateView();
}
示例#10
0
int main(int argc, char ** argv) {

    // Create a MarbleBar Kernel
    KernelPtr kernel = createKernel( defaultConfig() );

    // Create our first view, titled 'Primary'
    ViewPtr view = kernel->createView( "Primary" );

    // Create a couple of properties
    PStringPtr p1 = view->addProperty( make_shared<PString>("Iterations", "value") );
    PStringPtr p2 = view->addProperty( make_shared<PString>("Second Value", "value") );
    PBoolPtr p3 = view->addProperty( make_shared<PBool>("Toggler", false) );
    PIntPtr p4 = view->addProperty( make_shared<PInt>("Range", 0) );
    PImagePtr p5 = view->addProperty( make_shared<PImage>("Preview", 128, -1, "about:blank") );

    // Most of the properies offer overloads that behave like
    // a regular underlaying variable (ex. int, bool, string).
    //
    // Changes to these properties are instantly reflected in the UI
    // and likewise, changes in the UI instantly affect the value of
    // the properties.
    //
    *p1 = "test";
    *p1 += "ing";

    // Ask kernel to open the GUI (open system's web browser)
    kernel->openGUI();

    // Start kerne's invinite loop
    while (true) {

        // .. Do your single-threaded work here ..

        // Just remember to let kernel process it's I/O
        kernel->poll();
    }

    // Optionally you might wish to start the kernel thread
    // in a different thread, and to run it's start() method
    kernel->start();

    return 0;
};
示例#11
0
void VolumetricRep::removeRepActorsFromViewRenderer(ViewPtr view)
{
	view->getRenderer()->RemoveVolume(mVolume);
}
示例#12
0
void GeometricRep2D::addRepActorsToViewRenderer(ViewPtr view)
{
	view->getRenderer()->AddActor(mActor);
}
void OrientationAnnotationSmartRep::removeRepActorsFromViewRenderer(ViewPtr view)
{
	view->getRenderer()->RemoveActor(mOrientation);
}
示例#14
0
void CameraControl::refreshView(ViewPtr view)
{
	this->setView(view);
	if(view)
		view->getRenderer()->ResetCameraClippingRange();
}
示例#15
0
void PlaneMetricRep::addRepActorsToViewRenderer(ViewPtr view)
{
    mViewportListener->startListen(view->getRenderer());
    DataMetricRep::addRepActorsToViewRenderer(view);
}
示例#16
0
void PointMetricRep2D::addRepActorsToViewRenderer(ViewPtr view)
{
    if (mViewportListener)
        mViewportListener->startListen(view->getRenderer());
    DataMetricRep::addRepActorsToViewRenderer(view);
}
示例#17
0
void PovSceneExporter::write()
{
  PovDisplayContext *ppovdc = MB_NEW PovDisplayContext();

  LString str_povpath = getPath();
  LString str_incpath = getPath("inc");

  // Check and mangle the path names
  if (m_bMakeRelIncPath) {
    if (!str_povpath.isEmpty() && !str_incpath.isEmpty()) {
      // Check and modify the main pov file path
      fs::path povpath(str_povpath);
      if (!povpath.is_complete()) {
#if (BOOST_FILESYSTEM_VERSION==2)
        povpath = fs::complete(povpath);
        setPath(povpath.file_string());
#else
        povpath = fs::absolute(povpath);
        setPath(povpath.string());
#endif
      }
      fs::path base_path = povpath.parent_path();
      // Check and modify the inc file path
      fs::path incpath(str_incpath);
      if (!incpath.is_complete()) {
        ppovdc->setIncFileName(str_incpath);
#if (BOOST_FILESYSTEM_VERSION==2)
        incpath = fs::complete(incpath, base_path);
        setPath("inc", incpath.file_string());
#else
        incpath = fs::absolute(incpath, base_path);
        setPath("inc", incpath.string());
#endif
      }
      else {
        // make the inc-file path relative
#if (BOOST_FILESYSTEM_VERSION==2)
        LString relpath = qlib::makeRelativePath(str_incpath, base_path.directory_string());
#else
        LString relpath = qlib::makeRelativePath(str_incpath, base_path.string());
#endif
        ppovdc->setIncFileName(relpath);
      }
    }
  }
  else {
    ppovdc->setIncFileName(str_incpath);
  }
  
  // Main stream
  qlib::OutStream *pOutPov = createOutStream();
  // Sub stream (inc file)
  qlib::OutStream *pOutInc = createOutStream("inc");

  ScenePtr pScene = getClient();

  CameraPtr pCam = getCamera();
  qlib::ensureNotNull(pCam.get());

  // ppovdc->setTargetView(pView);
  ppovdc->init(pOutPov, pOutInc);
  //ppovdc->startPovRender();
  
  ppovdc->setClipZ(m_bUseClipZ);
  ppovdc->setPostBlend(m_bPostBlend);
  ppovdc->setPerspective(m_bPerspective);
  ppovdc->setBgColor(pScene->getBgColor());

  ppovdc->enableEdgeLines(m_bEnableEdgeLines);
  ppovdc->setCreaseLimit(m_dCreaseLimit);
  ppovdc->setEdgeRise(m_dEdgeRise);

  const double zoom = pCam->getZoom();
  ppovdc->setZoom(zoom);
  ppovdc->setSlabDepth(pCam->getSlabDepth());
  ppovdc->setViewDist(pCam->getCamDist());

  ppovdc->loadIdent();
  ppovdc->rotate(pCam->m_rotQuat);
  ppovdc->translate(-(pCam->m_center));
  
  // calc line width factor
  int height = getHeight();
  if (height<=0 && pScene->getViewCount()>0) {
    ViewPtr pView = pScene->beginView()->second;
    double hpix = pView->getHeight();
    ppovdc->setLineScale(zoom/hpix);
  }
  else {
    MB_DPRINTLN("POV> hint image height=%d", height);
    const double fac = zoom/( double(height)*1.5 );
    MB_DPRINTLN("POV> line scale factor=%f", fac);
    ppovdc->setLineScale(fac);
  }

  pScene->display(ppovdc);

  m_strBlendTab = ppovdc->getPostBlendTableJSON();

  //ppovdc->endPovRender();
  delete ppovdc;

  // cleanup the created streams
  pOutPov->close();
  pOutInc->close();
  delete pOutPov;
  delete pOutInc;
}
示例#18
0
bool operator==(const UniquePtr<T>& lhs, const ViewPtr<U>& rhs) noexcept
{
    return lhs.get() == rhs.get();
}
示例#19
0
bool operator==(const ViewPtr<T>& lhs, std::nullptr_t) noexcept
{
    return lhs.get() == nullptr;
}
示例#20
0
void VolumetricRep::addRepActorsToViewRenderer(ViewPtr view)
{
	view->getRenderer()->AddVolume(mVolume);
}
void OrientationAnnotationSmartRep::addRepActorsToViewRenderer(ViewPtr view)
{
	this->transformChangedSlot();
	view->getRenderer()->AddActor(mOrientation);
}
示例#22
0
void Slices3DRep::removeRepActorsFromViewRenderer(ViewPtr view)
{
	for (unsigned i=0; i<mProxy.size(); ++i)
		view->getRenderer()->RemoveActor(mProxy[i]->getActor());
}
示例#23
0
ViewPtr CreateView(const ViewType::Enum& type, const KinectControllerPtr& kinectController, int width, int height) {
	ViewPtr ptr;
	switch (type) {
		case ViewType::Normal:
			ptr.reset(new View(kinectController, width, height)); 
			break;
		case ViewType::BwView:
			ptr.reset(new BwView(kinectController, width, height));
			break;
		case ViewType::BwShaderView:
			ptr.reset(new BwShaderView(kinectController, width, height));
			break;
		case ViewType::ColorInvertShaderView:
			ptr.reset(new ColorInvertShaderView(kinectController, width, height));
			break;
		case ViewType::ColorDepthShaderView:
			ptr.reset(new ColorDepthShaderView(kinectController, width, height));
			break;
		case ViewType::MeshView:
			ptr.reset(new MeshView(kinectController, width, height));
			break;
		case ViewType::NormalMapView:
			ptr.reset(new NormalMapView(kinectController, width, height));
			break;
		case ViewType::FatSuitView:
			ptr.reset(new FatSuitView(kinectController, width, height));
			break;
		case ViewType::PointCloudView:
			ptr.reset(new MeshView(kinectController, width, height, true));
			break;
		case ViewType::OutlineView:
			ptr.reset(new OutlineView(kinectController, width, height));
			break;
		case ViewType::Idle:
			ptr.reset(new IdleView(kinectController, width, height));
			break;
		case ViewType::TestView:
			ptr.reset(new TestView(kinectController, width, height));
			break;
		case ViewType::FatSuitWireView:
			ptr.reset(new FatSuitWireView(kinectController, width, height));
			break;
		default:
			ptr.reset(new View(kinectController, width, height));
			break;
	}

	return ptr;
}
示例#24
0
bool operator==(std::nullptr_t, const ViewPtr<T>& rhs) noexcept
{
    return nullptr == rhs.get();
}
示例#25
0
 ViewPtr(const ViewPtr<U>& ptr) noexcept
     : m_ptr(dynamic_cast<T*>(ptr.get()))
 {
     // Nothing to do
 }
示例#26
0
 /**
  * @brief Constructor.
  *
  * @param ptr Object pointer.
  */
 ViewPtr(const ViewPtr<typename std::remove_const<T>::type>& ptr) noexcept
     : m_ptr(ptr.get())
 {
     // Nothing to do
 }
示例#27
0
void Slices3DRep::addRepActorsToViewRenderer(ViewPtr view)
{
	for (unsigned i=0; i<mProxy.size(); ++i)
		view->getRenderer()->AddActor(mProxy[i]->getActor());
}
示例#28
0
void GeometricRep2D::removeRepActorsFromViewRenderer(ViewPtr view)
{
	view->getRenderer()->RemoveActor(mActor);
}