From 1026c29d397ee893a9336aaed8b1641cff63c01f Mon Sep 17 00:00:00 2001 From: mbs Date: Fri, 24 Mar 2023 16:47:42 +0000 Subject: [PATCH] code cleanup --- src/GEOMGUI/GEOM_Displayer.cxx | 116 +++++---------------------------- 1 file changed, 17 insertions(+), 99 deletions(-) diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index 34ae3b443..6c900a99f 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -86,8 +86,6 @@ #include #include -//MBS: -//#include #include #include #include @@ -1766,7 +1764,7 @@ void GEOM_Displayer::Update( SALOME_PV3DPrs* prs ) // // specific processing for local coordinate system presentation // - // NYI + // NYI - Update(PV3DPrs) for the local coordinate system } else { @@ -1789,120 +1787,40 @@ void GEOM_Displayer::Update( SALOME_PV3DPrs* prs ) // if presentation is empty we try to create new one if ( pv3dPrs->IsNull() ) { -#if 0 // VTK - - vtkNew colors; - - std::array, 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, 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 cube; - vtkNew points; - vtkNew polys; - vtkNew 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 cubeMapper; - cubeMapper->SetInputData(cube); - cubeMapper->SetScalarRange(cube->GetScalarRange()); - vtkNew cubeActor; - cubeActor->SetMapper(cubeMapper); - - // The usual rendering stuff. - vtkNew camera; - camera->SetPosition(1, 1, 1); - camera->SetFocalPoint(0, 0, 0); - - vtkNew renderer; - vtkNew renWin; - renWin->AddRenderer(renderer); - renWin->SetWindowName("Cube"); - - vtkNew 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 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 -- 2.39.2