]> Creatis software - creaMaracasVisu.git/commitdiff
#3584 manual Contour opacity vtk9itk5wx3-macos
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Fri, 12 Dec 2025 13:46:11 +0000 (14:46 +0100)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Fri, 12 Dec 2025 13:46:11 +0000 (14:46 +0100)
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.cpp

index e86eb25bef54a708ddde6c7bc036a4cca93f55a1..0346c2ffdff93ea0a3478b9c047409d43b97e011 100644 (file)
@@ -57,7 +57,8 @@ manualViewBaseContour::manualViewBaseContour()
        _coulorSelection_r      = 0;
        _coulorSelection_g      = 1;
        _coulorSelection_b      = 0;
-       _widthline                      = 1;
+       _widthline                      = 1.0;
+    _opacity            = 1.0;
 }
 // ----------------------------------------------------------------------------
 manualViewBaseContour::~manualViewBaseContour()
@@ -249,7 +250,6 @@ void manualViewBaseContour::SetWidthLine(double width)
        {
                this->_lstViewPoints[id]->SetWidthLine(_widthline);
        }
-
 }
 
 // ----------------------------------------------------------------------------
@@ -259,10 +259,20 @@ double manualViewBaseContour::GetWidthLine()
 }
 
 // ----------------------------------------------------------------------------
-void manualViewBaseContour::ConstructVTKObjects()
+void manualViewBaseContour::SetOpacity(double opacity)
 {
+    _opacity = opacity;
+}
 
+// ----------------------------------------------------------------------------
+double manualViewBaseContour::GetOpacity()
+{
+    return _opacity;
+}
 
+// ----------------------------------------------------------------------------
+void manualViewBaseContour::ConstructVTKObjects()
+{
 //JSTG 29-02-08 -----------------------------------------------
        //int i , nps = _sizePointsContour;
        int i;
@@ -308,7 +318,7 @@ void manualViewBaseContour::ConstructVTKObjects()
        _contourVtkActor        =       vtkActor::New();
     
 //EED 2023-07-27
-    _contourVtkActor->GetProperty()->SetOpacity(1.0);
+    _contourVtkActor->GetProperty()->SetOpacity( _opacity );
 //    _contourVtkActor->GetProperty()->SetOpacity(0.9999);
 
     _bboxMapper                        =       vtkPolyDataMapper::New();
@@ -843,6 +853,8 @@ void manualViewBaseContour::UpdateColorActor()
 {
        if (_contourVtkActor!=NULL)
        {
+        _contourVtkActor->GetProperty()->SetOpacity( _opacity );
+
                _contourVtkActor->GetProperty()->SetLineWidth( _widthline );
                _contourVtkActor->GetProperty()->SetDiffuseColor( _coulorNormal_r , _coulorNormal_g , _coulorNormal_b );
         /*
@@ -1029,7 +1041,8 @@ void manualViewBaseContour::GetMinMax( double &minX,double &minY, double &minZ,
 // ----------------------------------------------------------------------------
 void manualViewBaseContour::ClearContour()
 {
-       if (_contourVtkActor!=NULL){
+       if (_contourVtkActor!=NULL)
+    {
                _wxvtkbaseview->GetRenderer()->RemoveActor( _contourVtkActor );
        }
        DeleteVtkObjects();
@@ -1061,10 +1074,11 @@ void manualViewBaseContour::SetVisible(bool ok)
        }
        vtkActor *actor;
        int i,size=_lstViewPoints.size();
-       for (i=0;i<size;i++){
+       for ( i=0 ; i<size ; i++ )
+    {
                actor = _lstViewPoints[i]->GetVtkActor();
                actor->GetProperty()->SetOpacity( opacity );
-       }
+       } // for i
        _contourVtkActor->GetProperty()->SetOpacity( opacity );
        _textActor->GetProperty()->SetOpacity( opacity );
        _textActor->SetInput("00");
index 7491674ceeb0e4aed70b3379f99394c0b9e3dd82..22cc1b7b6c0c2fac393cb65a36a4f0468532d1ea 100644 (file)
@@ -174,6 +174,8 @@ public:
        virtual void                                    RefreshContour();
                        void                                    SetWidthLine(double width);
                        double                                  GetWidthLine();
+            void                    SetOpacity(double opacity);
+            double                  GetOpacity();
 
        virtual void                                    ConstructVTKObjects();
 
@@ -219,6 +221,7 @@ protected:
        double                                                          _coulorSelection_g;
        double                                                          _coulorSelection_b;
        double                                                          _widthline;
+    double                              _opacity;
 
        //
        // Reference to VTKBaseView
index faae93bbd5ade48fcc51d48ea96b62f773e90550..ae71982bf3cc3626c3fd38a4886b7c71ebe94884 100644 (file)
@@ -38,6 +38,7 @@ manualViewContour::manualViewContour()
        _maxY                                   = -99999;
        
 }
+
 // ----------------------------------------------------------------------------
 manualViewContour::~manualViewContour()
 {
@@ -175,10 +176,6 @@ void manualViewContour::RefreshContour() // virtual
        {
                _pts->Modified();
        }
-    
-    
-    
-    
 }
 
 // ----------------------------------------------------------------------------
@@ -231,7 +228,6 @@ void manualViewContour::RefreshText()  // virtual
                                strcat(resultText,text);
                                strcat(resultText,"p^2 ");
 
-
                                strcpy(resultText2,"P= ");
                                gcvt ( this->_manContModel->GetPathSize( _spc ), 5, text );
                                strcat(resultText2,text);
@@ -307,7 +303,6 @@ bool manualViewContour::ifTouchContour(int x,int y,int z)
     pp[1]   = yy;
     pp[2]   = zz;    
     double DeltaDistancePointToLine =  GetWidthLine() +0.25;
-
        if ( (xx>=_minX) &&  (yy>=_minY) && (xx<=_maxX) && (yy<=_maxY))  // inside the boundaring box
        {
                if ( ShowLineVersion()==true )
@@ -435,9 +430,7 @@ void manualViewContour::MoveContour(int x, int y, int z)
        double XX = x;
        double YY = y;
        double ZZ = z;
-
        TransfromCoordViewWorld(XX,YY,ZZ);
-
        int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
        for ( i=0; i<manualPointsSZ; i++ )
        {