From b85345d3601076610e034be79f8b33c202c476c6 Mon Sep 17 00:00:00 2001 From: ouv Date: Tue, 5 Aug 2008 10:40:07 +0000 Subject: [PATCH] VISU 2008 - Introduction of the Feature Edges presentation mode --- src/OBJECT/VISU_Actor.cxx | 2 +- src/OBJECT/VISU_ScalarMapAct.cxx | 59 +++++++++++++++++++ src/OBJECT/VISU_ScalarMapAct.h | 23 ++++++++ src/PIPELINE/VISU_DeformedShapePL.cxx | 2 +- .../VISU_ScalarMapOnDeformedShapePL.cxx | 2 + src/PIPELINE/VISU_ScalarMapPL.cxx | 2 +- src/VISUGUI/VisuGUI.cxx | 4 +- src/VISUGUI/VisuGUI_FeatureEdgesPanel.cxx | 8 +-- src/VISU_I/VISU_Mesh_i.cc | 1 - src/VISU_I/VISU_ScalarMap_i.cc | 8 +++ 10 files changed, 101 insertions(+), 10 deletions(-) diff --git a/src/OBJECT/VISU_Actor.cxx b/src/OBJECT/VISU_Actor.cxx index dfab3808..2f6fb847 100644 --- a/src/OBJECT/VISU_Actor.cxx +++ b/src/OBJECT/VISU_Actor.cxx @@ -297,8 +297,8 @@ VISU_Actor if(myRepresentation == VTK_POINTS) { UnShrink(); - SetFeatureEdgesEnabled( false ); } + SetFeatureEdgesEnabled( theMode == SVTK::Representation::FeatureEdges ); } diff --git a/src/OBJECT/VISU_ScalarMapAct.cxx b/src/OBJECT/VISU_ScalarMapAct.cxx index 670a6f14..790bc9fc 100644 --- a/src/OBJECT/VISU_ScalarMapAct.cxx +++ b/src/OBJECT/VISU_ScalarMapAct.cxx @@ -346,6 +346,65 @@ VISU_ScalarMapAct mySurfaceActor->UnShrink(); } +//---------------------------------------------------------------------------- +void +VISU_ScalarMapAct +::SetFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed) +{ + Superclass::SetFeatureEdgesAllowed(theIsFeatureEdgesAllowed); + + mySurfaceActor->SetFeatureEdgesAllowed(theIsFeatureEdgesAllowed); +} + +void +VISU_ScalarMapAct +::SetFeatureEdgesAngle(vtkFloatingPointType theValue) +{ + Superclass::SetFeatureEdgesAngle(theValue); + + mySurfaceActor->SetFeatureEdgesAngle(theValue); +} + +void +VISU_ScalarMapAct +::SetFeatureEdgesFlags(bool theIsFeatureEdges, + bool theIsBoundaryEdges, + bool theIsManifoldEdges, + bool theIsNonManifoldEdges) +{ + Superclass::SetFeatureEdgesFlags(theIsFeatureEdges, + theIsBoundaryEdges, + theIsManifoldEdges, + theIsNonManifoldEdges); + + mySurfaceActor->SetFeatureEdgesFlags(theIsFeatureEdges, + theIsBoundaryEdges, + theIsManifoldEdges, + theIsNonManifoldEdges); +} + +void +VISU_ScalarMapAct +::SetFeatureEdgesColoring(bool theIsColoring) +{ + Superclass::SetFeatureEdgesColoring(theIsColoring); + + mySurfaceActor->SetFeatureEdgesColoring(theIsColoring); +} + +//---------------------------------------------------------------------------- +void +VISU_ScalarMapAct +::SetFeatureEdgesEnabled(bool theIsFeatureEdgesEnabled) +{ + if(theIsFeatureEdgesEnabled && myRepresentation == VTK_POINTS) + return; + + Superclass::SetFeatureEdgesEnabled(theIsFeatureEdgesEnabled); + + mySurfaceActor->SetFeatureEdgesEnabled(theIsFeatureEdgesEnabled); +} + //---------------------------------------------------------------------------- void VISU_ScalarMapAct diff --git a/src/OBJECT/VISU_ScalarMapAct.h b/src/OBJECT/VISU_ScalarMapAct.h index 8589d05d..d67cfa5f 100644 --- a/src/OBJECT/VISU_ScalarMapAct.h +++ b/src/OBJECT/VISU_ScalarMapAct.h @@ -77,6 +77,29 @@ class VTKOCC_EXPORT VISU_ScalarMapAct : public VISU_DataSetActor void UnShrink(); + virtual + void + SetFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed); + + virtual + void + SetFeatureEdgesEnabled(bool theIsFeatureEdgesEnabled); + + virtual + void + SetFeatureEdgesAngle(vtkFloatingPointType theAngle = 30.0); + + virtual + void + SetFeatureEdgesFlags(bool theIsFeatureEdges, + bool theIsBoundaryEdges, + bool theIsManifoldEdges, + bool theIsNonManifoldEdges); + + virtual + void + SetFeatureEdgesColoring(bool theIsColoring); + virtual void SetOpacity(vtkFloatingPointType theValue); diff --git a/src/PIPELINE/VISU_DeformedShapePL.cxx b/src/PIPELINE/VISU_DeformedShapePL.cxx index 713dabcb..5ca2222b 100644 --- a/src/PIPELINE/VISU_DeformedShapePL.cxx +++ b/src/PIPELINE/VISU_DeformedShapePL.cxx @@ -42,7 +42,7 @@ VISU_DeformedShapePL myScaleFactor(0.0) { SetIsShrinkable(true); - SetIsFeatureEdgesAllowed(false); + SetIsFeatureEdgesAllowed(true); myWarpVector = vtkWarpVector::New(); myCellDataToPointData = vtkCellDataToPointData::New(); diff --git a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx index a2b9b4d3..007820b8 100644 --- a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx +++ b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx @@ -57,6 +57,8 @@ VISU_ScalarMapOnDeformedShapePL ::VISU_ScalarMapOnDeformedShapePL(): myScaleFactor(0.0) { + SetIsFeatureEdgesAllowed(true); + myWarpVector = vtkWarpVector::New(); myScalarsMergeFilter = VISU_MergeFilter::New(); diff --git a/src/PIPELINE/VISU_ScalarMapPL.cxx b/src/PIPELINE/VISU_ScalarMapPL.cxx index c14ce395..3a635a55 100644 --- a/src/PIPELINE/VISU_ScalarMapPL.cxx +++ b/src/PIPELINE/VISU_ScalarMapPL.cxx @@ -54,7 +54,7 @@ VISU_ScalarMapPL myMergeFilter(VISU_MergeFilter::New()) { SetIsShrinkable(true); - SetIsFeatureEdgesAllowed(false); + SetIsFeatureEdgesAllowed(true); myAppendFilter->SetMergingInputs(true); myAppendFilter->Delete(); diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 713ae9c2..958c33bb 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -2661,7 +2661,7 @@ VisuGUI QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}"; QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' " "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' }"; - QString aFeatureEdgesType = " and $type in {'VISU::TMESH'}"; + QString aFeatureEdgesType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}"; aRule = "selcount=1"; mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType ); @@ -3501,7 +3501,7 @@ void VisuGUI::createPreferences() addPreference( tr( "VISU_SHOW_BOUNDARY_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_boundary_edges" ); addPreference( tr( "VISU_SHOW_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_manifold_edges" ); addPreference( tr( "VISU_SHOW_NON_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_non_manifold_edges" ); - addPreference( tr( "VISU_FEATURE_EDGES_COLORING" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "feature_edges_coloring" ); + //addPreference( tr( "VISU_FEATURE_EDGES_COLORING" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "feature_edges_coloring" ); } void VisuGUI::preferencesChanged( const QString& a, const QString& b) diff --git a/src/VISUGUI/VisuGUI_FeatureEdgesPanel.cxx b/src/VISUGUI/VisuGUI_FeatureEdgesPanel.cxx index ac23e2f4..17f75578 100644 --- a/src/VISUGUI/VisuGUI_FeatureEdgesPanel.cxx +++ b/src/VISUGUI/VisuGUI_FeatureEdgesPanel.cxx @@ -65,7 +65,7 @@ VisuGUI_FeatureEdgesPanel::VisuGUI_FeatureEdgesPanel( const VisuGUI* theModule, myManifoldEdgesCB = new QCheckBox( tr( "SHOW_MANIFOLD_EDGES" ), myGrp ); myNonManifoldEdgesCB = new QCheckBox( tr( "SHOW_NON_MANIFOLD_EDGES" ), myGrp ); - myColoringCB = new QCheckBox( tr( "FEATURE_EDGES_COLORING" ), myGrp ); + //myColoringCB = new QCheckBox( tr( "FEATURE_EDGES_COLORING" ), myGrp ); aLayout->addWidget( anAngleLbl, 0, 0 ); aLayout->addWidget( myAngleSpinBox, 0, 1 ); @@ -73,7 +73,7 @@ VisuGUI_FeatureEdgesPanel::VisuGUI_FeatureEdgesPanel( const VisuGUI* theModule, aLayout->addWidget( myBoundaryEdgesCB, 2, 0, 1, 2 ); aLayout->addWidget( myManifoldEdgesCB, 3, 0, 1, 2 ); aLayout->addWidget( myNonManifoldEdgesCB, 4, 0, 1, 2 ); - aLayout->addWidget( myColoringCB, 5, 0, 1, 2 ); + //aLayout->addWidget( myColoringCB, 5, 0, 1, 2 ); aTopLayout->addWidget( myGrp ); @@ -155,7 +155,7 @@ void VisuGUI_FeatureEdgesPanel::onSelectionEvent() myBoundaryEdgesCB->setChecked( anIsBoundaryEdges ); myManifoldEdgesCB->setChecked( anIsManifoldEdges ); myNonManifoldEdgesCB->setChecked( anIsNonManifoldEdges ); - myColoringCB->setChecked( aColoring ); + //myColoringCB->setChecked( aColoring ); } void VisuGUI_FeatureEdgesPanel::onApply() @@ -167,7 +167,7 @@ void VisuGUI_FeatureEdgesPanel::onApply() myBoundaryEdgesCB->isChecked(), myManifoldEdgesCB->isChecked(), myNonManifoldEdgesCB->isChecked() ); - myActor->SetFeatureEdgesColoring( myColoringCB->isChecked() ); + //myActor->SetFeatureEdgesColoring( myColoringCB->isChecked() ); myActor->Update(); } diff --git a/src/VISU_I/VISU_Mesh_i.cc b/src/VISU_I/VISU_Mesh_i.cc index c0032f67..6cf12c71 100644 --- a/src/VISU_I/VISU_Mesh_i.cc +++ b/src/VISU_I/VISU_Mesh_i.cc @@ -539,7 +539,6 @@ VISU::Mesh_i anActor->GetSurfaceProperty()->SetColor(myCellColor.R, myCellColor.G, myCellColor.B); anActor->GetEdgeProperty()->SetColor(myLinkColor.R, myLinkColor.G, myLinkColor.B); anActor->GetNodeProperty()->SetColor(myNodeColor.R, myNodeColor.G, myNodeColor.B); - anActor->SetFeatureEdgesEnabled(myPresentType == VISU::FEATURE_EDGES); } } diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index 14897bde..ec37d5fa 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -402,6 +402,14 @@ VISU::ScalarMap_i anActor->SetRepresentation(aDispMode); if (toShrink && !toSupressShrinking) anActor->SetShrink(); anActor->SetShading(toUseShading); + + anActor->SetFeatureEdgesAngle( aResourceMgr->doubleValue("VISU", "feature_edges_angle", 0.0) ); + anActor->SetFeatureEdgesFlags( aResourceMgr->booleanValue("VISU", "show_feature_edges", false), + aResourceMgr->booleanValue("VISU", "show_boundary_edges", false), + aResourceMgr->booleanValue("VISU", "show_manifold_edges", false), + aResourceMgr->booleanValue("VISU", "show_non_manifold_edges", false) ); + anActor->SetFeatureEdgesColoring( aResourceMgr->booleanValue("VISU", "feature_edges_coloring", false) ); + UpdateActor(anActor); }catch(...){ anActor->Delete(); -- 2.39.2