#include <GEOM_AISTrihedron.hxx>
#include <GEOM_VTKTrihedron.hxx>
#include <GEOM_VTKPropertyMaterial.hxx>
+#include <GEOM_PainterPolyDataMapper.h>
#include <GEOMGUI_DimensionProperty.h>
#include <GEOMGUI_AnnotationAttrs.h>
#include <SVTK_Prs.h>
#include <SVTK_ViewModel.h>
+//MBS:
+#include <SPV3D_Prs.h>
+#include <SPV3D_ViewModel.h>
+
#include <OCCViewer_ViewWindow.h>
#include <OCCViewer_ViewPort3d.h>
#include <OCCViewer_Utilities.h>
+//MBS:
+//#include <PV3DViewer_ViewModel.h>
+#include <BRepBndLib.hxx>
+#include <pqActiveObjects.h>
+#include <pqApplicationCore.h>
+#include <pqObjectBuilder.h>
+#include <vtkSMPropertyHelper.h>
+#include <vtkSMProxy.h>
+#include <vtkSMParaViewPipelineControllerWithRendering.h>
+#include <vtkNamedColors.h>
+#include <vtkPoints.h>
+#include <vtkCamera.h>
+#include <vtkCellArray.h>
+#include <vtkFloatArray.h>
+#include <vtkPointData.h>
+#include <vtkPolyData.h>
+#include <vtkRenderer.h>
+#include <vtkRenderWindow.h>
+#include <vtkRenderWindowInteractor.h>
+
// OCCT Includes
#include <AIS_Dimension.hxx>
#include <AIS_LengthDimension.hxx>
}
}
+//MBS:
+//=================================================================
+/*!
+ * GEOM_Displayer::Update
+ * Update PV3D presentation
+ * [ Reimplemented from SALOME_Displayer ]
+ */
+//=================================================================
+void GEOM_Displayer::Update( SALOME_PV3DPrs* prs )
+{
+ DBG_FUN();
+ SPV3D_Prs* pv3dPrs = dynamic_cast<SPV3D_Prs*>( prs );
+
+ SalomeApp_Study* study = getStudy();
+
+ if ( !pv3dPrs || myShape.IsNull() || !study )
+ return;
+
+ if ( myType == GEOM_MARKER && myShape.ShapeType() == TopAbs_FACE )
+ {
+ //
+ // specific processing for local coordinate system presentation
+ //
+ // NYI
+ }
+ else
+ {
+ //
+ // processing for usual geometry presentation
+ //
+ SHOW(myShape);
+ MSGEL("...-> update SALOME_PV3DPrs");
+
+ // For now, display the bbox instead of the shape itself
+ Standard_Real XMin = -1, YMin = -1, ZMin = -1, XMax = 1, YMax = 1, ZMax = 1;
+ if (!myShape.IsNull())
+ {
+ Bnd_Box aBndBox;
+ BRepBndLib::Add(myShape, aBndBox);
+ aBndBox.Get(XMin, YMin, ZMin, XMax, YMax, ZMax);
+ MSGEL("BBox= X:[" << XMin << "," << XMax << "] Y:[" << YMin << "," << YMax << "] Z: [" << ZMin << "," << ZMax << "]");
+ }
+
+ // if presentation is empty we try to create new one
+ if ( pv3dPrs->IsNull() )
+ {
+#if 0 // VTK
+
+ vtkNew<vtkNamedColors> colors;
+
+ std::array<std::array<double, 3>, 8> pts = {{{{XMin, YMin, ZMin}},
+ {{XMax, YMin, ZMin}},
+ {{XMax, YMax, ZMin}},
+ {{XMin, YMax, ZMin}},
+ {{XMin, YMin, ZMax}},
+ {{XMax, YMin, ZMax}},
+ {{XMax, YMax, ZMax}},
+ {{XMin, YMax, ZMax}}}};
+ // The ordering of the corner points on each face.
+ std::array<std::array<vtkIdType, 4>, 6> ordering = {{{{0, 3, 2, 1}},
+ {{4, 5, 6, 7}},
+ {{0, 1, 5, 4}},
+ {{1, 2, 6, 5}},
+ {{2, 3, 7, 6}},
+ {{3, 0, 4, 7}}}};
+
+ // We'll create the building blocks of polydata including data attributes.
+ vtkNew<vtkPolyData> cube;
+ vtkNew<vtkPoints> points;
+ vtkNew<vtkCellArray> polys;
+ vtkNew<vtkFloatArray> scalars;
+
+ // Load the point, cell, and data attributes.
+ for (auto i = 0ul; i < pts.size(); ++i)
+ {
+ points->InsertPoint(i, pts[i].data());
+ scalars->InsertTuple1(i, i);
+ }
+ for (auto&& i : ordering)
+ {
+ polys->InsertNextCell(vtkIdType(i.size()), i.data());
+ }
+
+ // We now assign the pieces to the vtkPolyData.
+ cube->SetPoints(points);
+ cube->SetPolys(polys);
+ cube->GetPointData()->SetScalars(scalars);
+
+ // Now we'll look at it.
+ vtkNew<vtkPolyDataMapper> cubeMapper;
+ cubeMapper->SetInputData(cube);
+ cubeMapper->SetScalarRange(cube->GetScalarRange());
+ vtkNew<vtkActor> cubeActor;
+ cubeActor->SetMapper(cubeMapper);
+
+ // The usual rendering stuff.
+ vtkNew<vtkCamera> camera;
+ camera->SetPosition(1, 1, 1);
+ camera->SetFocalPoint(0, 0, 0);
+
+ vtkNew<vtkRenderer> renderer;
+ vtkNew<vtkRenderWindow> renWin;
+ renWin->AddRenderer(renderer);
+ renWin->SetWindowName("Cube");
+
+ vtkNew<vtkRenderWindowInteractor> iren;
+ iren->SetRenderWindow(renWin);
+
+ renderer->AddActor(cubeActor);
+ renderer->SetActiveCamera(camera);
+ renderer->ResetCamera();
+ renderer->SetBackground(colors->GetColor3d("Cornsilk").GetData());
+
+ renWin->SetSize(600, 600);
+
+ // interact with data
+ renWin->Render();
+ iren->Start();
+
+#else // PV
+
+ // Create a pipeline source with vtkPolyData output from a TopoDS_Shape
+ pqObjectBuilder* builder = pqApplicationCore::instance()->getObjectBuilder();
+ pqServer* activeServer = pqActiveObjects::instance().activeServer();
+
+ pqPipelineSource* source = builder->createSource("sources", "CubeSource", activeServer);
+ if (!source) {
+ MSGEL("ERR: VTK source not found");
+ return;
+ }
+ else {
+
+ // On SourceCreated signal handler
+ vtkNew<vtkSMParaViewPipelineControllerWithRendering> controller;
+ pqView* activeView = pqActiveObjects::instance().activeView();
+ if (activeView)
+ {
+ if (source)
+ {
+ #if PARAVIEW_VERSION_MINOR <= 10
+ source->updatePipeline();
+ source->setModifiedState(pqProxy::UNMODIFIED);
+ #endif
+
+ controller->Show(source->getSourceProxy(), 0, activeView->getViewProxy());//, "CADRepresentation");
+ }
+ activeView->render();
+ activeView->resetDisplay();
+ }
+
+ // Set dimensions of bbox
+ vtkSMProxy* proxy = source->getProxy();
+ vtkSMPropertyHelper(proxy, "XLength").Set(XMax-XMin);
+ vtkSMPropertyHelper(proxy, "YLength").Set(YMax-YMin);
+ vtkSMPropertyHelper(proxy, "ZLength").Set(ZMax-ZMin);
+ proxy->UpdateVTKObjects();
+ }
+
+#endif
+
+ }
+ else {
+ // presentation is being updated
+ // NYI
+ }
+ }
+}
+
+
//=================================================================
/*!
* GEOM_Displayer::BuildPrs
GEOM::GEOM_Gen_var aCompObj = GEOM::GEOM_Gen::_narrow(anOrbObj); // enable displaying of whole GEOM component
bool isGeomObj = (!CORBA::is_nil( aGeomObj ) || !CORBA::is_nil( aFieldStepObj ) || !CORBA::is_nil( aCompObj ));
bool ret = ( isGeomObj ) &&
- (viewer_type == SOCC_Viewer::Type() || viewer_type == SVTK_Viewer::Type());
+ (viewer_type == SOCC_Viewer::Type() || viewer_type == SVTK_Viewer::Type() || viewer_type == SPV3D_ViewModel::Type());//MBS:
MSGEL("..... --> isCorbaObj=" << YesNo(isCorbaObj) << ", isGeomObj=" << YesNo(isGeomObj) << ", canBeDisp=" << YesNo(ret));
return ret;
}
#include <OCCViewer_ViewModel.h>
#include <OCCViewer_ViewManager.h>
+//MBS:
+#include <PV3DViewer_ViewWindow.h>
+#include <PV3DViewer_ViewModel.h>
+#include <PV3DViewer_ViewManager.h>
+
#include <SOCC_ViewModel.h>
#include <SOCC_ViewWindow.h>
SUIT_ViewWindow* window = application()->desktop()->activeWindow();
bool ViewOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
bool ViewVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
+ bool ViewPV3D = ( window && window->getViewManager()->getType() == PV3DViewer_ViewModel::Type() ); //MBS:
if ( ViewOCC ) {
OCCViewer_ViewWindow* vw = dynamic_cast<OCCViewer_ViewWindow*>( window );
vw->onFitAll();
}
}
+ //MBS:
+ else if ( ViewPV3D ) {
+ PV3DViewer_ViewWindow* vw = dynamic_cast<PV3DViewer_ViewWindow*>( window );
+ if ( vw ) {
+ MSGEL("...(NYI) => orient view to active plane");
+ // vtkCamera* camera = vw->getRenderer()->GetActiveCamera();
+ //
+ // camera->SetPosition(DZ.X(), DZ.Y(), DZ.Z());
+ // camera->SetViewUp(DY.X(), DY.Y(), DY.Z());
+ // camera->SetFocalPoint(0,0,0);
+ //
+ //vw->onFitAll();
+ }
+ }
}
//=======================================================================
void GeometryGUI::viewManagers( QStringList& lst ) const
{
lst.append( OCCViewer_Viewer::Type() );
+ //lst.append( PV3DViewer_ViewModel::Type() );
}
void GeometryGUI::onViewManagerAdded( SUIT_ViewManager* vm )