#include <OCCViewer_ViewPort3d.h>
#include <OCCViewer_Utilities.h>
-//MBS:
-//#include <PV3DViewer_ViewModel.h>
#include <BRepBndLib.hxx>
#include <pqActiveObjects.h>
#include <pqApplicationCore.h>
//
// specific processing for local coordinate system presentation
//
- // NYI
+ // NYI - Update(PV3DPrs) for the local coordinate system
}
else
{
// 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();
+#define USE_CUBE_SOURCE
+#ifdef USE_CUBE_SOURCE
pqPipelineSource* source = builder->createSource("sources", "CubeSource", activeServer);
+#else
+ pqPipelineSource* source = builder->createSource("sources", "GeometryGenerator", activeServer);
+#endif
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();
+#ifdef USE_CUBE_SOURCE
vtkSMPropertyHelper(proxy, "XLength").Set(XMax-XMin);
vtkSMPropertyHelper(proxy, "YLength").Set(YMax-YMin);
vtkSMPropertyHelper(proxy, "ZLength").Set(ZMax-ZMin);
+#else
+ // Standard_SStream ss;
+ // BRepTools::Write(myShape, ss);
+ // std::string str = ss.str();
+ // vtkSMPropertyHelper(proxy, "BRepStream").Set(str.c_str());
+
+ vtkSMPropertyHelper(proxy, "EdgeSubdivision").Set(2);
+ vtkSMPropertyHelper(proxy, "NumberOfSolids").Set(1);
+#endif
+
proxy->UpdateVTKObjects();
}
-#endif
-
}
else {
// presentation is being updated