void ThreeSliceView::makeSlice(IView::Direction i, pqRenderView *view, pqPipelineSource *cut, pqPipelineRepresentation *repr) { pqObjectBuilder *builder = pqApplicationCore::instance()->getObjectBuilder(); cut = builder->createFilter("filters", "Cut", this->origSource); pqDataRepresentation *trepr = builder->createDataRepresentation( cut->getOutputPort(0), view); repr = qobject_cast<pqPipelineRepresentation *>(trepr); vtkSMProxy *plane = vtkSMPropertyHelper(cut->getProxy(), "CutFunction").GetAsProxy(); repr->colorByArray("signal", vtkDataObject::FIELD_ASSOCIATION_CELLS); double orient[3], up[3]; switch(i) { case IView::X: orient[0] = 1.0; orient[1] = 0.0; orient[2] = 0.0; up[0] = 0.0; up[1] = 0.0; up[2] = 1.0; break; case IView::Y: orient[0] = 0.0; orient[1] = 1.0; orient[2] = 0.0; up[0] = 0.0; up[1] = 0.0; up[2] = 1.0; break; case IView::Z: orient[0] = 0.0; orient[1] = 0.0; orient[2] = 1.0; up[0] = 1.0; up[1] = 0.0; up[2] = 0.0; break; } vtkSMPropertyHelper(plane, "Normal").Set(orient, 3); trepr->getProxy()->UpdateVTKObjects(); view->resetViewDirection(orient[0], orient[1], orient[2], up[0], up[1], up[2]); }
void ThreeSliceView::makeThreeSlice() { pqPipelineSource *src = NULL; src = pqActiveObjects::instance().activeSource(); pqObjectBuilder *builder = pqApplicationCore::instance()->getObjectBuilder(); // Do not allow overplotting PeaksWorkspaces if (this->isPeaksWorkspace(src)) { QMessageBox::warning(this, QApplication::tr("Overplotting Warning"), QApplication::tr("Threeslice mode does not allow " "overlay of PeaksWorkspaces")); // Need to destroy source since we tried to load it and set the active // back to something. In this case we'll choose the original source builder->destroy(src); pqActiveObjects::instance().setActiveSource(this->origSrc); return; } this->origSrc = src; pqDataRepresentation *drep = builder->createDataRepresentation( this->origSrc->getOutputPort(0), this->m_mainView); vtkSMPropertyHelper(drep->getProxy(), "Representation").Set("Slices"); drep->getProxy()->UpdateVTKObjects(); this->origRep = qobject_cast<pqPipelineRepresentation *>(drep); }
/** * Get workspace name and type * @param source The pipeline source. * @param workspaceName Reference to workspace name. * @param workspaceType Reference to workspace type. */ void RebinnedSourcesManager::getWorkspaceInfo(pqPipelineSource *source, std::string &workspaceName, std::string &workspaceType) { // Make sure that the input source exists. Note that this can happen when // there is no active view if (!source) { return; } // Update the source/filter vtkSMProxy *proxy = source->getProxy(); proxy->UpdateVTKObjects(); proxy->UpdatePropertyInformation(); source->updatePipeline(); // Crawl up to the source level pqPipelineFilter *filter = qobject_cast<pqPipelineFilter *>(source); while (filter) { source = filter->getInput(0); filter = qobject_cast<pqPipelineFilter *>(source); } // Ensure that the source is either an MDEvent source or an MDHisto source std::string sourceName(source->getProxy()->GetXMLName()); if (sourceName.find("MDEW Source") == std::string::npos && sourceName.find("MDHW Source") == std::string::npos) { return; } // Check if the source has an underlying event workspace or histo workspace workspaceName = vtkSMPropertyHelper(source->getProxy(), "WorkspaceName", true) .GetAsString(); workspaceType = vtkSMPropertyHelper(source->getProxy(), "WorkspaceTypeName", true).GetAsString(); }
void ThreeSliceView::makeThreeSlice() { this->origSource = pqActiveObjects::instance().activeSource(); pqObjectBuilder *builder = pqApplicationCore::instance()->getObjectBuilder(); pqDataRepresentation *drep = builder->createDataRepresentation( this->origSource->getOutputPort(0), this->mainView); vtkSMPropertyHelper(drep->getProxy(), "Representation").Set(VTK_SURFACE); drep->getProxy()->UpdateVTKObjects(); this->originSourceRepr = qobject_cast<pqPipelineRepresentation*>(drep); this->originSourceRepr->colorByArray("signal", vtkDataObject::FIELD_ASSOCIATION_CELLS); this->makeSlice(IView::X, this->xView, this->xCut, this->xCutRepr); this->makeSlice(IView::Y, this->yView, this->yCut, this->yCutRepr); this->makeSlice(IView::Z, this->zView, this->zCut, this->zCutRepr); }
void SplatterPlotView::render() { this->origSrc = pqActiveObjects::instance().activeSource(); pqObjectBuilder* builder = pqApplicationCore::instance()->getObjectBuilder(); this->splatSource = builder->createFilter("filters", "MantidParaViewSplatterPlot", this->origSrc); // Show the data pqDataRepresentation *drep = builder->createDataRepresentation(\ this->splatSource->getOutputPort(0), this->view); vtkSMPropertyHelper(drep->getProxy(), "Representation").Set(VTK_SURFACE); drep->getProxy()->UpdateVTKObjects(); this->splatRepr = qobject_cast<pqPipelineRepresentation*>(drep); this->splatRepr->colorByArray("signal", vtkDataObject::FIELD_ASSOCIATION_CELLS); this->resetDisplay(); this->renderAll(); QPair<double, double> range = this->splatRepr->getColorFieldRange(); emit this->dataRange(range.first, range.second); emit this->triggerAccept(); }
/** * react to the addition of the representation and change it's type to be * Surface * @param representation : representation to modify */ void StandardView::onScaleRepresentationAdded( pqPipelineSource *, pqDataRepresentation *representation, int) { vtkSMPropertyHelper(representation->getProxy(), "Representation") .Set(StandardView::SurfaceRepresentation.c_str()); }