Salome HOME
Implementation of the "21046: EDF 1610 GUI: To be able to change the width of the...
authorrnv <rnv@opencascade.com>
Tue, 14 Feb 2012 12:03:57 +0000 (12:03 +0000)
committerrnv <rnv@opencascade.com>
Tue, 14 Feb 2012 12:03:57 +0000 (12:03 +0000)
26 files changed:
doc/salome/gui/GEOM/images/line_width.png [new file with mode: 0755]
doc/salome/gui/GEOM/images/line_width_1.png [new file with mode: 0755]
doc/salome/gui/GEOM/images/line_width_2.png [new file with mode: 0755]
doc/salome/gui/GEOM/input/line_width.doc [new file with mode: 0644]
doc/salome/gui/GEOM/input/viewing_geom_obj.doc
resources/SalomeApp.xml.in
src/GEOMBase/GEOMBase_Helper.cxx
src/GEOMGUI/GEOM_Displayer.cxx
src/GEOMGUI/GEOM_Displayer.h
src/GEOMGUI/GEOM_msg_en.ts
src/GEOMGUI/GeometryGUI.cxx
src/GEOMGUI/GeometryGUI_Operations.h
src/GEOMToolsGUI/GEOMToolsGUI.cxx
src/GEOMToolsGUI/GEOMToolsGUI.h
src/GEOMToolsGUI/GEOMToolsGUI_1.cxx
src/GEOMToolsGUI/GEOMToolsGUI_LineWidthDlg.cxx [new file with mode: 0644]
src/GEOMToolsGUI/GEOMToolsGUI_LineWidthDlg.h [new file with mode: 0644]
src/GEOMToolsGUI/Makefile.am
src/MeasureGUI/MeasureGUI.h
src/MeasureGUI/MeasureGUI_AngleDlg.cxx
src/MeasureGUI/MeasureGUI_CheckCompoundOfBlocksDlg.cxx
src/MeasureGUI/MeasureGUI_DistanceDlg.cxx
src/MeasureGUI/MeasureGUI_NormaleDlg.cxx
src/OBJECT/GEOM_Actor.cxx
src/OBJECT/GEOM_Actor.h
src/OBJECT/GEOM_Constants.h

diff --git a/doc/salome/gui/GEOM/images/line_width.png b/doc/salome/gui/GEOM/images/line_width.png
new file mode 100755 (executable)
index 0000000..bf5c713
Binary files /dev/null and b/doc/salome/gui/GEOM/images/line_width.png differ
diff --git a/doc/salome/gui/GEOM/images/line_width_1.png b/doc/salome/gui/GEOM/images/line_width_1.png
new file mode 100755 (executable)
index 0000000..e7fc005
Binary files /dev/null and b/doc/salome/gui/GEOM/images/line_width_1.png differ
diff --git a/doc/salome/gui/GEOM/images/line_width_2.png b/doc/salome/gui/GEOM/images/line_width_2.png
new file mode 100755 (executable)
index 0000000..4d49df5
Binary files /dev/null and b/doc/salome/gui/GEOM/images/line_width_2.png differ
diff --git a/doc/salome/gui/GEOM/input/line_width.doc b/doc/salome/gui/GEOM/input/line_width.doc
new file mode 100644 (file)
index 0000000..3850a8d
--- /dev/null
@@ -0,0 +1,18 @@
+/*!
+
+\page line_width_page Line Width
+
+\n In this menu you can change the width of the edges and isolines displayed within
+a shape.
+
+\n <b>Arguments: </b>1 value (width of the edge or isoline).
+
+\image html line_width.png
+
+\n <b>Example:</b>
+
+\image html line_width_1.png
+
+\image html line_width_2.png
+
+*/
index 9ff6812596be19d1370706298300e1eef2f7a77f..b269619a94c0d938fb499d97c0cce4835bc5cad3 100644 (file)
@@ -33,6 +33,8 @@ deflection coefficient of a shape.</li>
 material properties of a shape.</li>
 <li>\subpage point_marker_page "Point Marker" - allows to change the
 representation of geometrical vertices.</li>
+<li>\subpage line_width_page "Line Width" - allows to change the
+width of the edges and isolines.</li>
 <li><b>Auto color</b> / <b>Disable auto color</b> - activates the auto color
 mode. When the auto color mode is enabled, the groups created on the
 sub-shapes of the selected geometrical object are automatically
index 8ea7476e7c306d8510de4434e5b894856a696711..f910e65699456ddd4313ed89bacf37b8807c0279 100644 (file)
     <parameter name="geom_preview"        value="false"  />
     <parameter name="front_material"      value="Gold" />
     <parameter name="back_material"       value="Gold" />
+    <parameter name="edge_width"          value="1" />
+    <parameter name="isolines_width"      value="1" />
+    <parameter name="preview_edge_width"  value="1" />
+    <parameter name="measures_line_width" value="1" />
+
     <!-- Input field precisions -->
     <parameter name="def_precision"       value="3"  />
     <parameter name="length_precision"    value="6"  />
index 50c5c46e6658573be4331cb59f512afa275facbd..04a0be7b4ea4c17dc735b165a0af49658608025c 100755 (executable)
@@ -37,6 +37,7 @@
 #include <SUIT_ViewModel.h>
 #include <SUIT_MessageBox.h>
 #include <SUIT_OverrideCursor.h>
+#include <SUIT_ResourceMgr.h>
 
 #include <SalomeApp_Module.h>
 #include <SalomeApp_Application.h>
@@ -317,7 +318,12 @@ void GEOMBase_Helper::displayPreview( GEOM::GEOM_Object_ptr object,
   getDisplayer()->SetColor( color == -1 ? Quantity_NOC_VIOLET : color );
 
   // set width of displayed shape
-  getDisplayer()->SetWidth( lineWidth );
+  int lw = lineWidth;
+  if(lw == -1) {
+    SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();    
+    lw = resMgr->integerValue("Geometry", "preview_edge_width", -1);
+  }
+  getDisplayer()->SetWidth( lw );
 
   // set display mode of displayed shape
   int aPrevDispMode = getDisplayer()->SetDisplayMode( displayMode );
index 31d7d4b0cf0614c31d759ad5ebca1f50b13ec9cd..8d7bb760361c25c80ab02f5b41a011dcb7b61cab 100644 (file)
@@ -313,7 +313,11 @@ GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* st )
   myShadingColor = SalomeApp_Tools::color( col );
 
   myDisplayMode = resMgr->integerValue("Geometry", "display_mode", 0);
+
   int aType = resMgr->integerValue("Geometry", "type_of_marker", (int)Aspect_TOM_PLUS);
+  myWidth = resMgr->integerValue("Geometry", "edge_width", -1);
+  myIsosWidth = resMgr->integerValue("Geometry", "isolines_width", -1);
+
   myTypeOfMarker = (Aspect_TypeOfMarker)(std::min((int)Aspect_TOM_RING3, std::max((int)Aspect_TOM_POINT, aType)));
   myScaleOfMarker = (resMgr->integerValue("Geometry", "marker_scale", 1)-(int)GEOM::MS_10)*0.5 + 1.0;
   myScaleOfMarker = std::min(7.0, std::max(1., myScaleOfMarker));
@@ -696,10 +700,15 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
         Handle(Prs3d_IsoAspect) anAspect = AISShape->Attributes()->UIsoAspect();
         anAspect->SetNumber( anUIsoNumber );
         anAspect->SetColor( aColor );
+       if(HasIsosWidth())
+         anAspect->SetWidth( GetIsosWidth() );
         AISShape->Attributes()->SetUIsoAspect( anAspect );
 
+
         anAspect = AISShape->Attributes()->VIsoAspect();
         anAspect->SetNumber( aVIsoNumber );
+       if(HasIsosWidth())
+         anAspect->SetWidth( GetIsosWidth() );
         anAspect->SetColor( aColor );
         AISShape->Attributes()->SetVIsoAspect( anAspect );
 
@@ -828,6 +837,8 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
             double aDC = 0;
             if(useStudy) {
               aDC = aPropMap.value(DEFLECTION_COEFF_PROP).toDouble();
+             SetWidth(aPropMap.value(EDGE_WIDTH_PROP).toInt());
+             SetIsosWidth(aPropMap.value(ISOS_WIDTH_PROP).toInt());
             }
             else {
               aDC = aResMgr->doubleValue("Geometry", "deflection_coeff", 0.001);
@@ -1003,6 +1014,13 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
           if ( aModelB )
             delete aModelB;
 
+         if(HasWidth())
+           aStudy->setObjectProperty( aMgrId, anIO->getEntry(), EDGE_WIDTH_PROP, GetWidth() );
+
+         if(HasIsosWidth())
+           aStudy->setObjectProperty( aMgrId, anIO->getEntry(), ISOS_WIDTH_PROP, GetIsosWidth() );
+
+
         }
 
         // AISShape->SetName(???); ??? necessary to set name ???
@@ -1133,11 +1151,6 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
     aProp->SetColor( aColor.Red(), aColor.Green(), aColor.Blue() );
   }
 
-  if ( HasWidth() )
-  {
-    aProp->SetLineWidth( GetWidth() );
-  }
-
   while ( anActor != NULL )
   {
     SALOME_Actor* GActor = SALOME_Actor::SafeDownCast( anActor );
@@ -1172,6 +1185,8 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
           aIsos[0] = uv[0].toInt(); aIsos[1] = uv[1].toInt();
           aGeomGActor->SetNbIsos(aIsos);
           aGeomGActor->SetOpacity(1.0 - aPropMap.value(TRANSPARENCY_PROP).toDouble());
+         SetWidth(aPropMap.value(EDGE_WIDTH_PROP).toInt());
+         SetIsosWidth(aPropMap.value(ISOS_WIDTH_PROP).toInt());
           aGeomGActor->SetVectorMode(aPropMap.value(VECTOR_MODE_PROP).toInt());
          int aDispModeId = aPropMap.value(DISPLAY_MODE_PROP).toInt();
          // Specially processing of 'Shading with edges' mode from preferences,
@@ -1217,6 +1232,13 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
 
            // Release memory
            delete aModelB;
+
+           if(HasWidth())
+             aStudy->setObjectProperty( aMgrId, anEntry, EDGE_WIDTH_PROP, GetWidth() );
+
+           if(HasIsosWidth())
+             aStudy->setObjectProperty( aMgrId, anEntry, ISOS_WIDTH_PROP, GetIsosWidth() );
+         
          }
          else {
            // Set the same front and back materials for the selected shape
@@ -1292,6 +1314,17 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
        }
       }
 
+    if ( HasWidth() )
+      {
+       aGeomGActor->SetWidth( GetWidth() );
+      }
+    
+    
+    if ( HasIsosWidth() )
+      {
+       aGeomGActor->SetIsosWidth( GetIsosWidth() );
+      }
+    
     if ( myToActivate )
       GActor->PickableOn();
     else
@@ -1760,6 +1793,23 @@ void GEOM_Displayer::UnsetWidth()
   myWidth = -1;
 }
 
+
+int GEOM_Displayer::GetIsosWidth() const
+{
+  return myIsosWidth;
+}
+
+void GEOM_Displayer::SetIsosWidth(const int width) 
+{
+  myIsosWidth = width;
+}
+
+bool GEOM_Displayer::HasIsosWidth() const
+{
+  return myIsosWidth != -1;
+}
+
+
 //=================================================================
 /*!
  *  GEOM_Displayer::SetToActivate
@@ -1962,12 +2012,20 @@ PropMap GEOM_Displayer::getDefaultPropertyMap(const QString& viewer_type) {
   QString aMaterialF = aModelF.getMaterialProperty();
   aDefaultMap.insert( FRONT_MATERIAL_PROP , aMaterialF );  
 
-  //  Back material
+  //9.  Back material
   Material_Model aModelB;
   aModelB.fromResources( aResMgr, "Geometry", false );
   QString aMaterialB = aModelB.getMaterialProperty();
   aDefaultMap.insert( BACK_MATERIAL_PROP , aMaterialB );
 
+  //10. Width of the edges
+  aDefaultMap.insert( EDGE_WIDTH_PROP , aResMgr->integerValue("Geometry", "edge_width", 1));
+
+
+  //11. Width of iso-lines
+  aDefaultMap.insert( ISOS_WIDTH_PROP , aResMgr->integerValue("Geometry", "isolines_width", 1));
+
+
   return aDefaultMap;
 }
 
@@ -2005,6 +2063,17 @@ bool GEOM_Displayer::MergePropertyMaps(PropMap& theOrigin, PropMap& theDefault)
     theOrigin.insert(BACK_MATERIAL_PROP, theDefault.value(BACK_MATERIAL_PROP));
     nbInserted++;
   }
+
+  if(!theOrigin.contains(EDGE_WIDTH_PROP)) {
+    theOrigin.insert(EDGE_WIDTH_PROP, theDefault.value(EDGE_WIDTH_PROP));
+    nbInserted++;
+  }
+
+  if(!theOrigin.contains(ISOS_WIDTH_PROP)) {
+    theOrigin.insert(ISOS_WIDTH_PROP, theDefault.value(ISOS_WIDTH_PROP));
+    nbInserted++;
+  }
+
   return (nbInserted > 0);
 }
 
index 30337eaac4264c6b685fa714572b8a2f1f91bac2..c7ced1329490a8f47fd4164ab8318cb5118e6bf7 100644 (file)
@@ -134,6 +134,11 @@ public:
   void          UnsetWidth();
   double        GetWidth  () const;
   bool          HasWidth  () const;
+
+  /* Set width for iso-lines displaying. If it is equal -1 then default width is used. */
+  void          SetIsosWidth  ( const int );
+  int           GetIsosWidth  () const;
+  bool          HasIsosWidth  () const;
   
   /* Set display mode shape displaying. If it is equal -1 then display mode is used. */
   int           SetDisplayMode( const int );
@@ -215,6 +220,7 @@ protected:
   Quantity_Color                   myShadingColor;
   int                              myColor;
   double                           myWidth;
+  int                              myIsosWidth;
   bool                             myToActivate;
   int                              myDisplayMode;
   Aspect_TypeOfMarker              myTypeOfMarker;
index 14a87c7aa87189de7a661051c4e031814db3b73f..a993e8be3f785c972e237f03e4074e884a111790 100644 (file)
         <source>CHANGE_ORIENTATION_NEW_OBJ_NAME</source>
         <translation>Invert</translation>
     </message>
+    <message>
+        <source>EDGE_WIDTH_TLT</source>
+        <translation>Select Edge Width</translation>
+    </message>
+    <message>
+        <source>ISOS_WIDTH_TLT</source>
+        <translation>Select Isos Width</translation>
+    </message>
     <message>
         <source>CLOSE_CONTOUR_NEW_OBJ_NAME</source>
         <translation>CloseContour</translation>
@@ -2574,6 +2582,34 @@ Please, select face, shell or solid and try again</translation>
         <source>MEN_POP_TEXTURE</source>
         <translation>Texture</translation>
     </message>
+    <message>
+        <source>MEN_EDGE_WIDTH</source>
+        <translation>Edge Width</translation>
+    </message>
+    <message>
+        <source>TOP_EDGE_WIDTH</source>
+        <translation>Edge Width</translation>
+    </message>
+    <message>
+        <source>STB_EDGE_WIDTH</source>
+        <translation>Edge Width</translation>
+    </message>   
+    <message>
+        <source>MEN_ISOS_WIDTH</source>
+        <translation>Isos Width</translation>
+    </message>
+    <message>
+        <source>TOP_ISOS_WIDTH</source>
+        <translation>Isos Width</translation>
+    </message>
+    <message>
+        <source>STB_ISOS_WIDTH</source>
+        <translation>Isos Width</translation>
+    </message>
+    <message>
+        <source>MEN_LINE_WIDTH</source>
+        <translation>Line Width</translation>
+    </message>  
     <message>
         <source>MEN_POP_SETTEXTURE</source>
         <translation>Texture</translation>
@@ -2906,6 +2942,22 @@ Please, select face, shell or solid and try again</translation>
         <source>PREF_BACK_MATERIAL</source>
         <translation>Default back material</translation>
     </message>
+    <message>
+        <source>PREF_EDGE_WIDTH</source>
+        <translation>Edges width</translation>
+    </message>
+    <message>
+        <source>PREF_ISOLINES_WIDTH</source>
+        <translation>Iso lines width</translation>
+    </message>
+    <message>
+        <source>PREF_PREVIEW_EDGE_WIDTH</source>
+        <translation>Preview edges width</translation>
+    </message>
+    <message>
+        <source>PREF_MEASURES_LINE_WIDTH</source>
+        <translation>Measures lines width</translation>
+    </message>
     <message>
         <source>PROCESS_SHAPE_NEW_OBJ_NAME</source>
         <translation>ProcessShape</translation>
@@ -4779,7 +4831,7 @@ Number of sketch points too small</translation>
     <message>
         <source>EMPTY_NAME</source>
         <translation>Please, specify a non-empty group name</translation>
-    </message>
+    </message>    
     <message>
         <source>GROUP_NAME</source>
         <translation>Group Name</translation>
@@ -5003,6 +5055,13 @@ Would you like to continue?</translation>
         <translation>Deflection :</translation>
     </message>
 </context>
+<context>
+    <name>GEOMToolsGUI_LineWidthDlg</name>
+    <message>
+        <source>GEOM_LINE_WIDTH</source>
+        <translation>Line width:</translation>
+    </message>
+</context>
 <context>
     <name>GEOMToolsGUI_MarkerDlg</name>
     <message>
index cfa64c465b159ca7c398e3d49ce740cbf07a393d..a230d3725c90b1f19922e445aefd849dfd83135d 100644 (file)
@@ -424,6 +424,8 @@ void GeometryGUI::OnGUIEvent( int id )
   case GEOMOp::OpPublishObject:      // ROOT GEOM OBJECT - POPUP MENU - PUBLISH
   case GEOMOp::OpPointMarker:        // POPUP MENU - POINT MARKER
   case GEOMOp::OpMaterialProperties: // POPUP MENU - MATERIAL PROPERTIES
+  case GEOMOp::OpEdgeWidth:          // POPUP MENU - LINE WIDTH - EDGE WIDTH
+  case GEOMOp::OpIsosWidth:          // POPUP MENU - LINE WIDTH - ISOS WIDTH
     libName = "GEOMToolsGUI";
     break;
   case GEOMOp::OpDisplayMode:        // MENU VIEW - WIREFRAME/SHADING
@@ -844,6 +846,8 @@ void GeometryGUI::initialize( CAM_Application* app )
   createGeomAction( GEOMOp::OpShading,          "POP_SHADING", "", 0, true );
   createGeomAction( GEOMOp::OpShadingWithEdges, "POP_SHADING_WITH_EDGES", "", 0, true );
   createGeomAction( GEOMOp::OpTexture,          "POP_TEXTURE", "", 0, true );
+  createGeomAction( GEOMOp::OpEdgeWidth,        "EDGE_WIDTH");
+  createGeomAction( GEOMOp::OpIsosWidth,        "ISOS_WIDTH");
   createGeomAction( GEOMOp::OpVectors,          "POP_VECTORS", "", 0, true );
   createGeomAction( GEOMOp::OpDeflection,       "POP_DEFLECTION" );
   createGeomAction( GEOMOp::OpColor,            "POP_COLOR" );
@@ -1234,6 +1238,14 @@ void GeometryGUI::initialize( CAM_Application* app )
   mgr->setRule( action( GEOMOp::OpMaterialProperties ), clientOCCorVTK_AndSomeVisible + " and ($component={'GEOM'}) and selcount>0 and isVisible", QtxPopupMgr::VisibleRule );
   mgr->insert( action(  GEOMOp::OpSetTexture ), -1, -1 ); // texture
   mgr->setRule( action( GEOMOp::OpSetTexture ), clientOCCorOB_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
+
+  int lineW = mgr->insert(  tr( "MEN_LINE_WIDTH" ), -1, -1 ); // line width menu
+  mgr->insert( action(  GEOMOp::OpEdgeWidth ), lineW, -1 ); // edge width
+  mgr->setRule( action( GEOMOp::OpEdgeWidth ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
+
+  mgr->insert( action(  GEOMOp::OpIsosWidth ), lineW, -1 ); // isos width
+  mgr->setRule( action( GEOMOp::OpIsosWidth ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
+  
   mgr->insert( separator(), -1, -1 );     // -----------
   mgr->insert( action(  GEOMOp::OpAutoColor ), -1, -1 ); // auto color
   mgr->setRule( action( GEOMOp::OpAutoColor ), autoColorPrefix + " and isAutoColor=false", QtxPopupMgr::VisibleRule );
@@ -1679,11 +1691,33 @@ void GeometryGUI::createPreferences()
   int front_material = addPreference( tr( "PREF_FRONT_MATERIAL" ), genGroup,
                                      LightApp_Preferences::Selector,
                                      "Geometry", "front_material" );
-
+  
   int back_material = addPreference( tr( "PREF_BACK_MATERIAL" ), genGroup,
                                     LightApp_Preferences::Selector,
                                     "Geometry", "back_material" );
 
+  int nb = 4;
+  int wd[nb];
+  int iter=0;
+
+  wd[iter++] = addPreference( tr( "PREF_EDGE_WIDTH" ), genGroup,
+                             LightApp_Preferences::IntSpin, "Geometry", "edge_width" );
+
+  wd[iter++] = addPreference( tr( "PREF_ISOLINES_WIDTH" ), genGroup,
+                             LightApp_Preferences::IntSpin, "Geometry", "isolines_width" );
+
+  wd[iter++] = addPreference( tr( "PREF_PREVIEW_EDGE_WIDTH" ), genGroup,
+                                    LightApp_Preferences::IntSpin, "Geometry", "preview_edge_width" );
+  
+  wd[iter++] = addPreference( tr( "PREF_MEASURES_LINE_WIDTH" ), genGroup,
+                             LightApp_Preferences::IntSpin, "Geometry", "measures_line_width" );
+
+  for(int i = 0; i < nb; i++) {
+    setPreferenceProperty( wd[i], "min", 1 );    
+    setPreferenceProperty( wd[i], "max", 5 );
+  }
+
+
   // Quantities with individual precision settings
   int precGroup = addPreference( tr( "GEOM_PREF_GROUP_PRECISION" ), tabId );
   setPreferenceProperty( precGroup, "columns", 2 );
@@ -1950,6 +1984,17 @@ void GeometryGUI::storeVisualParameters (int savePoint)
        if(aProps.contains(BACK_MATERIAL_PROP)) {
           param = occParam + BACK_MATERIAL_PROP;
           ip->setParameter(entry, param, aProps.value(BACK_MATERIAL_PROP).toString().toLatin1().data());
+         
+       }
+
+       if(aProps.contains( EDGE_WIDTH_PROP )) {
+             param = occParam + EDGE_WIDTH_PROP;
+           ip->setParameter(entry, param, aProps.value(EDGE_WIDTH_PROP).toString().toLatin1().data());                              
+        }
+       
+       if(aProps.contains( ISOS_WIDTH_PROP )) {
+         param = occParam + ISOS_WIDTH_PROP;
+         ip->setParameter(entry, param, aProps.value(ISOS_WIDTH_PROP).toString().toLatin1().data());
         }
       } // object iterator
     } // for (views)
@@ -2062,8 +2107,14 @@ void GeometryGUI::restoreVisualParameters (int savePoint)
         aListOfMap[viewIndex].insert( FRONT_MATERIAL_PROP, val);
       } else if(paramNameStr == BACK_MATERIAL_PROP) {
         aListOfMap[viewIndex].insert( BACK_MATERIAL_PROP, val);
+      }  else if(paramNameStr == EDGE_WIDTH_PROP) {
+       aListOfMap[viewIndex].insert( EDGE_WIDTH_PROP , val);
+      }  else if(paramNameStr == ISOS_WIDTH_PROP) {
+       aListOfMap[viewIndex].insert( ISOS_WIDTH_PROP , val);
       }
 
+                   
+
     } // for names/parameters iterator
 
     QList<SUIT_ViewManager*> lst = getApp()->viewManagers();
index 5ff8d5921547cf7f6f80bd5ee72e57c65fed0f41..227c23283b72480cee4b006fa017bd257728d283 100644 (file)
@@ -54,6 +54,8 @@ namespace GEOMOp {
     OpHideChildren        = 1251,   // POPUP MENU - HIDE CHILDREN
     OpUnpublishObject     = 1253,   // POPUP MENU - UNPUBLISH
     OpPublishObject       = 1254,   // GEOM ROOT OBJECT - POPUP MENU - PUBLISH
+    OpEdgeWidth           = 1260,   // POPUP MENU - LINE WIDTH - EDGE WIDTH
+    OpIsosWidth           = 1261,   // POPUP MENU - LINE WIDTH - ISOS WIDTH
 
     // DisplayGUI ----------------//--------------------------------
     OpDisplayMode         = 2000,   // MENU VIEW  - DISPLAY MODE - WIREFRAME/SHADING/SHADING WITH EDGES
index f1abd61d09d33cc6fa8c1b82747a07e4fa23b9ff..3c5c6f1d172df1ef7e705ac748e8e13491122255 100644 (file)
@@ -371,6 +371,12 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
   case GEOMOp::OpPublishObject:// GEOM ROOT OBJECT - POPUP - PUBLISH
     OnPublishObject();
     break;
+  case GEOMOp::OpEdgeWidth:
+    OnEdgeWidth();
+    break;
+  case GEOMOp::OpIsosWidth:
+    OnIsosWidth(); 
+    break;
   default:
     SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
     break;
index 5706765f0d2b878d69b31c75f0b2a6fa6b7adb91..2141f0c97cf9cd7c7587fa23606fc4dd2e2baf5e 100644 (file)
@@ -76,6 +76,8 @@ private:
   void         OnPublishObject() ;
   void         OnPointMarker();
   void         OnMaterialProperties();
+  void         OnEdgeWidth();
+  void         OnIsosWidth();
 
   // Shortcut commands
   void         OnChangeTransparency( bool );
index 8420eb5cd1901f5d049ac3840a7f63cccf3fc6fd..31b734b330d6975bc936e9860b8ac784281a12d8 100644 (file)
@@ -32,6 +32,7 @@
 #include "GEOMToolsGUI_MarkerDlg.h"
 #include "GEOMToolsGUI_PublishDlg.h"
 #include "GEOMToolsGUI_MaterialPropertiesDlg.h"
+#include "GEOMToolsGUI_LineWidthDlg.h"
 
 #include <GeometryGUI.h>
 #include <GeometryGUI_Operations.h>
@@ -79,6 +80,7 @@
 #include <Prs3d_IsoAspect.hxx>
 #include <Prs3d_PointAspect.hxx>
 #include <Graphic3d_AspectMarker3d.hxx>
+#include <Graphic3d_AspectLine3d.hxx>
 
 #if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
 #include <TColStd_HArray1OfByte.hxx>
@@ -392,7 +394,6 @@ void GEOMToolsGUI::OnTexture()
       if ( !selected.IsEmpty() ) {
         SUIT_ViewWindow* window = app->desktop()->activeWindow();
         bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
-        int mgrId = window->getViewManager()->getGlobalId();
         if ( isOCC ) {
           QString aTexture = QFileDialog::getOpenFileName(window,tr( "GEOM_SELECT_IMAGE"),QString(), tr("OCC_IMAGE_FILES"));
           if( !aTexture.isEmpty() )
@@ -563,12 +564,17 @@ void GEOMToolsGUI::OnNbIsos( ActionType actionType )
       }
 
       for(; ic->MoreCurrent(); ic->NextCurrent()) {
+        int aMgrId = window->getViewManager()->getGlobalId();
         CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
 
         Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
 
-        CurDrawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , newNbUIso) );
-        CurDrawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , newNbVIso) );
+       QVariant v = aStudy->getObjectProperty( aMgrId, CurObject->getIO()->getEntry(), EDGE_WIDTH_PROP , QVariant() );
+       
+       int width = v.isValid() ? v.toInt() : 1;
+
+        CurDrawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, width , newNbUIso) );
+        CurDrawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, width , newNbVIso) );
 
        CurObject->storeIsoNumbers();
         
@@ -576,8 +582,7 @@ void GEOMToolsGUI::OnNbIsos( ActionType actionType )
         ic->Redisplay(CurObject);
 
         QString anIsos("%1%2%3");anIsos = anIsos.arg(newNbUIso);anIsos = anIsos.arg(DIGIT_SEPARATOR);anIsos = anIsos.arg(newNbVIso);
-        int aMgrId = window->getViewManager()->getGlobalId();
-        aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), ISOS_PROP, anIsos);
+        aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), ISOS_WIDTH_PROP, anIsos);
       }
     }
     GeometryGUI::Modified();
@@ -940,3 +945,245 @@ void GEOMToolsGUI::OnPublishObject() {
     new GEOMToolsGUI_PublishDlg( SUIT_Session::session()->activeApplication()->desktop() );
   publishDlg->exec();
 }
+
+
+void GEOMToolsGUI::OnEdgeWidth()
+{
+  SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
+  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
+
+
+  bool isOCC = (window && window->getViewManager()->getType() == OCCViewer_Viewer::Type());
+  bool isVTK = (window && window->getViewManager()->getType() == SVTK_Viewer::Type());
+  int mgrId = window->getViewManager()->getGlobalId();
+
+  if (isOCC) { // if is OCCViewer
+    OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>(window->getViewManager()->getViewModel());
+    Handle (AIS_InteractiveContext) ic = vm->getAISContext();
+    ic->InitCurrent();
+    if (ic->MoreCurrent()) {
+      Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
+
+      int aWidth = (int)CurObject->Width();
+
+      GEOMToolsGUI_LineWidthDlg * Dlg = new GEOMToolsGUI_LineWidthDlg
+        (SUIT_Session::session()->activeApplication()->desktop(),"EDGE_WIDTH_TLT");
+      Dlg->setTheLW(aWidth);
+      int aNewWidth = 0;
+      if (Dlg->exec()) {
+       aNewWidth = Dlg->getTheLW();
+       bool ok = (aNewWidth != aWidth && aNewWidth != 0 );
+       if (ok) {
+         for(; ic->MoreCurrent(); ic->NextCurrent()) {
+           CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
+           CurObject->SetWidth(aNewWidth);
+           ic->Redisplay(CurObject);
+           appStudy->setObjectProperty(mgrId,CurObject->getIO()->getEntry(), EDGE_WIDTH_PROP, aNewWidth);
+         }
+       }
+      }
+    }
+    else {
+      return;
+    }
+    GeometryGUI::Modified();
+  }
+  else if (isVTK) { // if is VTKViewer
+    SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>
+      (SUIT_Session::session()->activeApplication());
+    if (!app)
+      return;
+
+    LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+    if (!aSelMgr)
+      return;
+
+    SALOME_ListIO selected;
+    aSelMgr->selectedObjects(selected);
+    if (selected.IsEmpty())
+      return;
+
+    SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>(window);
+    if (!vtkVW)
+      return;
+
+    SALOME_View* view = GEOM_Displayer::GetActiveView();
+
+    vtkActorCollection* aCollection = vtkActorCollection::New();
+
+    for (SALOME_ListIteratorOfListIO It (selected); It.More(); It.Next()) {
+      Handle(SALOME_InteractiveObject) anIObject = It.Value();
+      SALOME_Prs* aPrs = view->CreatePrs(anIObject->getEntry());
+      SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>(aPrs);
+      if (vtkPrs) {
+        vtkActorCollection* anActors = vtkPrs->GetObjects();
+        anActors->InitTraversal();
+        vtkActor* anAct = anActors->GetNextActor();
+        aCollection->AddItem(anAct);
+      }
+    }
+
+    if (aCollection)
+      aCollection->InitTraversal();
+    else
+      return;
+
+    int aWidth = 1;
+
+    vtkActor* anAct = aCollection->GetNextActor();
+    if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct))
+      aWidth = anActor->GetWidth();
+    else
+      return;
+
+    GEOMToolsGUI_LineWidthDlg * Dlg = new GEOMToolsGUI_LineWidthDlg
+      (SUIT_Session::session()->activeApplication()->desktop(),"EDGE_WIDTH_TLT");
+    
+    Dlg->setTheLW(aWidth);
+    if (Dlg->exec()) {
+      SUIT_OverrideCursor();
+      aWidth = Dlg->getTheLW();
+      while (anAct != NULL) {
+        if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) {
+          // There are no casting to needed actor.
+          anActor->SetWidth(aWidth);
+          appStudy->setObjectProperty(mgrId, anActor->getIO()->getEntry(), EDGE_WIDTH_PROP, aWidth);
+        }
+        anAct = aCollection->GetNextActor();
+      }
+    }
+    GeometryGUI::Modified();
+  } // end vtkviewer
+}
+
+
+void GEOMToolsGUI::OnIsosWidth() {
+  SalomeApp_Application* app =
+    dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+  SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+  SUIT_ViewWindow* window = app->desktop()->activeWindow();
+
+  bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
+  bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
+
+  if(isOCC){ // if is OCCViewer
+
+    OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
+    Handle (AIS_InteractiveContext) ic = vm->getAISContext();
+
+    ic->InitCurrent();
+    if ( ic->MoreCurrent() ) {
+      Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
+      CurObject->restoreIsoNumbers();
+      Handle(AIS_Drawer)    CurDrawer = CurObject->Attributes();
+
+      Handle(Graphic3d_AspectLine3d) asp = CurDrawer->UIsoAspect()->Aspect();
+      
+      Quantity_Color C;
+      Aspect_TypeOfLine T;
+      Standard_Real W;
+      asp->Values(C,T,W);
+
+      int aWidth = (int)W;
+
+      GEOMToolsGUI_LineWidthDlg * Dlg =
+       new GEOMToolsGUI_LineWidthDlg( SUIT_Session::session()->activeApplication()->desktop(),"ISOS_WIDTH_TLT" );
+
+      Dlg->setTheLW( aWidth );
+
+      if ( Dlg->exec() ) {
+       SUIT_OverrideCursor();          
+       aWidth = Dlg->getTheLW();
+      } else //Cancel case
+       return;
+      
+      for(; ic->MoreCurrent(); ic->NextCurrent()) {
+       int aMgrId = window->getViewManager()->getGlobalId();
+       CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
+       
+       Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
+       
+       CurObject->Attributes()->UIsoAspect()->SetWidth(aWidth);
+       CurObject->Attributes()->VIsoAspect()->SetWidth(aWidth);
+       
+       ic->Redisplay(CurObject);
+       
+       aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), ISOS_WIDTH_PROP, aWidth);
+      }
+      GeometryGUI::Modified();
+    }
+  }
+  else if(isVTK){ // if is VTKViewer
+    //
+    // Warning. It's works incorrect. must be recheked.
+    //
+    SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >
+      ( SUIT_Session::session()->activeApplication() );
+    if ( !app )
+      return;
+    LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+    if ( !aSelMgr )
+      return;
+    SALOME_ListIO selected;
+    aSelMgr->selectedObjects( selected );
+    if ( selected.IsEmpty() )
+      return;
+
+    SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
+    if ( !vtkVW )
+      return;
+
+    SALOME_View* view = GEOM_Displayer::GetActiveView();
+
+    vtkActorCollection* aCollection = vtkActorCollection::New();
+
+    for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
+      Handle(SALOME_InteractiveObject) anIObject = It.Value();
+      SALOME_Prs* aPrs = view->CreatePrs( anIObject->getEntry() );
+      SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( aPrs );
+      if ( vtkPrs ) {
+        vtkActorCollection* anActors = vtkPrs->GetObjects();
+        anActors->InitTraversal();
+        vtkActor* anAct = anActors->GetNextActor();
+        aCollection->AddItem(anAct);
+      }
+    }
+
+    if(aCollection)
+      aCollection->InitTraversal();
+    else
+      return;
+
+    int aWidth = 1;
+
+    vtkActor* anAct = aCollection->GetNextActor();
+    if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) {
+      aWidth = anActor->GetIsosWidth();
+    }
+    else
+      return;
+    
+    GEOMToolsGUI_LineWidthDlg* Dlg =
+      new GEOMToolsGUI_LineWidthDlg( SUIT_Session::session()->activeApplication()->desktop(), "ISOS_WIDTH_TLT" );
+    
+    Dlg->setTheLW( aWidth );
+    if (Dlg->exec() ) {
+      SUIT_OverrideCursor();
+      aWidth = Dlg->getTheLW();
+    } else 
+      return; //Cancel case 
+    
+    while( anAct!= NULL ) {
+      if(GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) {
+        // There are no casting to needed actor.
+       anActor->SetIsosWidth(aWidth);
+       int aMgrId = window->getViewManager()->getGlobalId();
+        aStudy->setObjectProperty(aMgrId ,anActor->getIO()->getEntry(), ISOS_WIDTH_PROP, aWidth);
+      }
+      anAct = aCollection->GetNextActor();
+    }
+    
+    view->Repaint();
+    GeometryGUI::Modified();
+  } // end vtkviewer  
+}
diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_LineWidthDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_LineWidthDlg.cxx
new file mode 100644 (file)
index 0000000..49c845d
--- /dev/null
@@ -0,0 +1,192 @@
+// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  GEOM GEOMGUI : GUI for Geometry component
+//  File   : GEOMToolsGUI_LineWidthDlg.cxx
+//  Author : OCC Team
+//
+#include "GEOMToolsGUI_LineWidthDlg.h"
+#include <GeometryGUI.h>
+#include <GEOM_Constants.h>
+#include <LightApp_Application.h>
+#include <SalomeApp_IntSpinBox.h>
+
+#include <SUIT_MessageBox.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+#include <SUIT_Tools.h>
+
+#include <QLabel>
+#include <QChar>
+#include <QPushButton>
+#include <QGroupBox>
+#include <QGridLayout>
+#include <QKeyEvent>
+
+//=================================================================================
+// class    : GEOMToolsGUI_LineWidthDlg()
+// purpose  : Constructs a GEOMToolsGUI_LineWidthDlg which is a child of 'parent', with the
+//            name 'name' and widget flags set to 'f'.
+//            The dialog will by default be modeless, unless you set 'modal' to
+//            TRUE to construct a modal dialog.
+//=================================================================================
+
+GEOMToolsGUI_LineWidthDlg::GEOMToolsGUI_LineWidthDlg (QWidget* parent, const QString& title)
+  : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint)
+{
+  setObjectName("GEOMToolsGUI_LineWidthDlg");
+  setModal(true);
+
+  setWindowTitle(tr(title.toLatin1().constData()));
+  setSizeGripEnabled(TRUE);
+  QGridLayout* MyDialogLayout = new QGridLayout(this);
+  MyDialogLayout->setSpacing(6);
+  MyDialogLayout->setMargin(11);
+
+
+  /***************************************************************/
+  QGroupBox* GroupC1 = new QGroupBox (this);
+  GroupC1->setObjectName("GroupC1");
+  QGridLayout* GroupC1Layout = new QGridLayout (GroupC1);
+  GroupC1Layout->setAlignment(Qt::AlignTop);
+  GroupC1Layout->setSpacing(6);
+  GroupC1Layout->setMargin(11);
+
+  QLabel* TextLabel1 = new QLabel (GroupC1);
+  TextLabel1->setObjectName("TextLabel1");
+  TextLabel1->setText(tr("GEOM_LINE_WIDTH"));
+  GroupC1Layout->addWidget(TextLabel1, 0, 0);
+
+
+  mySpinBox = new SalomeApp_IntSpinBox (GroupC1);
+  mySpinBox->setRange( 1, 5 );
+  mySpinBox->setSingleStep( 1 );
+  mySpinBox->setObjectName("SpinBoxU");
+  mySpinBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
+  mySpinBox->setValue(1);
+  GroupC1Layout->addWidget(mySpinBox, 0, 1);
+
+
+  /***************************************************************/
+  QGroupBox* GroupButtons = new QGroupBox (this);
+  GroupButtons->setObjectName("GroupButtons");
+  QGridLayout* GroupButtonsLayout = new QGridLayout (GroupButtons);
+  GroupButtonsLayout->setAlignment(Qt::AlignTop);
+  GroupButtonsLayout->setSpacing(6);
+  GroupButtonsLayout->setMargin(11);
+
+  QPushButton* buttonOk = new QPushButton (GroupButtons);
+  buttonOk->setObjectName("buttonOk");
+  buttonOk->setText(tr("GEOM_BUT_OK"));
+  buttonOk->setAutoDefault(TRUE);
+  buttonOk->setDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonOk, 0, 0);
+
+  GroupButtonsLayout->addItem(new QSpacerItem (20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1);
+
+  QPushButton* buttonCancel = new QPushButton (GroupButtons);
+  buttonCancel->setObjectName("buttonCancel");
+  buttonCancel->setText(tr("GEOM_BUT_CANCEL"));
+  buttonCancel->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonCancel, 0, 1);
+
+  QPushButton* buttonHelp = new QPushButton (GroupButtons);
+  buttonHelp->setObjectName("buttonHelp");
+  buttonHelp->setText(tr("GEOM_BUT_HELP"));
+  buttonHelp->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonHelp, 0, 2);
+  /***************************************************************/
+
+  MyDialogLayout->addWidget(GroupC1, 0, 0);
+  MyDialogLayout->addWidget(GroupButtons, 1, 0);
+
+  myHelpFileName = "line_width_page.html";
+
+  // signals and slots connections
+  connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
+  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
+  connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp()));
+
+  // Move widget on the botton right corner of main widget
+  SUIT_Tools::centerWidget(this, parent);
+}
+
+
+//=================================================================================
+// function : ~GEOMToolsGUI_LineWidthDlg()
+// purpose  : Destroys the object and frees any allocated resources
+//=================================================================================
+GEOMToolsGUI_LineWidthDlg::~GEOMToolsGUI_LineWidthDlg()
+{
+  // no need to delete child widgets, Qt does it all for us
+}
+
+int GEOMToolsGUI_LineWidthDlg::getTheLW() const
+{
+  return mySpinBox->text().toInt();
+}
+
+void GEOMToolsGUI_LineWidthDlg::setTheLW (const int v)
+{
+  mySpinBox->setValue(v);
+}
+
+
+//=================================================================================
+// function : ClickOnHelp()
+// purpose  :
+//=================================================================================
+void GEOMToolsGUI_LineWidthDlg::ClickOnHelp()
+{
+  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+  if (app) {
+    GeometryGUI* aGeomGUI = dynamic_cast<GeometryGUI*>(app->module("Geometry"));
+    app->onHelpContextModule(aGeomGUI ? app->moduleName(aGeomGUI->moduleName()) : QString(""), myHelpFileName);
+  }
+  else {
+    QString platform;
+#ifdef WIN32
+    platform = "winapplication";
+#else
+    platform = "application";
+#endif
+    SUIT_MessageBox::warning
+      (0, QObject::tr("WRN_WARNING"),
+       QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+       arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName),
+       QObject::tr("BUT_OK"));
+  }
+}
+
+//=================================================================================
+// function : keyPressEvent()
+// purpose  :
+//=================================================================================
+void GEOMToolsGUI_LineWidthDlg::keyPressEvent (QKeyEvent* e)
+{
+  QDialog::keyPressEvent(e);
+  if (e->isAccepted())
+    return;
+
+  if (e->key() == Qt::Key_F1) {
+    e->accept();
+    ClickOnHelp();
+  }
+}
diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_LineWidthDlg.h b/src/GEOMToolsGUI/GEOMToolsGUI_LineWidthDlg.h
new file mode 100644 (file)
index 0000000..09bfe44
--- /dev/null
@@ -0,0 +1,59 @@
+// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  GEOM GEOMGUI : GUI for Geometry component
+//  File   : GEOMToolsGUI_DeflectionDlg.h
+//  Author : OCC Team
+//
+#ifndef GEOMTOOLSGUI_LINEWIDTHDLG_H
+#define GEOMTOOLSGUI_LINEWIDTHDLG_H
+
+#include "GEOM_ToolsGUI.hxx"
+
+#include <QDialog>
+
+class SalomeApp_IntSpinBox;
+
+//=================================================================================
+// class    : GEOMToolsGUI_LineWidthDlg
+// purpose  :
+//=================================================================================
+class GEOMTOOLSGUI_EXPORT GEOMToolsGUI_LineWidthDlg : public QDialog
+{
+  Q_OBJECT
+
+public:
+  GEOMToolsGUI_LineWidthDlg( QWidget*, const QString& );
+  ~GEOMToolsGUI_LineWidthDlg();
+
+  int       getTheLW() const;
+  void      setTheLW( const int );
+
+private slots:
+  void      ClickOnHelp();
+
+private:
+ void       keyPressEvent( QKeyEvent* );
+
+private:
+ SalomeApp_IntSpinBox*    mySpinBox;
+ QString                  myHelpFileName;
+};
+
+#endif // GEOMTOOLSGUI_LINEWIDTHDLG_H
index 63afb84f2f687fc663ab9f81d6d8c9cb7641063b..c3a32d6f46dbcb7f3638712d6d6b4e328b784d64 100644 (file)
@@ -36,7 +36,8 @@ salomeinclude_HEADERS =                               \
        GEOMToolsGUI_DeleteDlg.h                \
        GEOMToolsGUI_MarkerDlg.h                \
        GEOMToolsGUI_PublishDlg.h               \
-       GEOMToolsGUI_MaterialPropertiesDlg.h
+       GEOMToolsGUI_MaterialPropertiesDlg.h    \
+       GEOMToolsGUI_LineWidthDlg.h
 
 dist_libGEOMToolsGUI_la_SOURCES =              \
        GEOMToolsGUI.cxx                        \
@@ -47,7 +48,8 @@ dist_libGEOMToolsGUI_la_SOURCES =             \
        GEOMToolsGUI_DeleteDlg.cxx              \
        GEOMToolsGUI_MarkerDlg.cxx              \
        GEOMToolsGUI_PublishDlg.cxx             \
-       GEOMToolsGUI_MaterialPropertiesDlg.cxx
+       GEOMToolsGUI_MaterialPropertiesDlg.cxx  \
+       GEOMToolsGUI_LineWidthDlg.cxx
 
 MOC_FILES =                                    \
        GEOMToolsGUI_TransparencyDlg_moc.cxx    \
@@ -56,7 +58,8 @@ MOC_FILES =                                   \
        GEOMToolsGUI_DeleteDlg_moc.cxx          \
        GEOMToolsGUI_MarkerDlg_moc.cxx          \
        GEOMToolsGUI_PublishDlg_moc.cxx         \
-       GEOMToolsGUI_MaterialPropertiesDlg_moc.cxx
+       GEOMToolsGUI_MaterialPropertiesDlg_moc.cxx \
+       GEOMToolsGUI_LineWidthDlg_moc.cxx
 
 nodist_libGEOMToolsGUI_la_SOURCES =            \
        $(MOC_FILES)
index 4a9f28201c5ba916916bf25ea018dac95e1b4b89..d196684f8baa1ec4c145b87ee6786940d4c1ba12 100644 (file)
 // class    : MeasureGUI
 // purpose  :
 //=================================================================================
+
+#define DISPLAY_PREVIEW_MACRO \
+SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); \
+int w = resMgr->integerValue("Geometry", "measures_line_width", 1); \
+displayPreview(true, false, true, true, w, -1, -1);
+
 class MeasureGUI : public GEOMGUI
 {
 public:
index d80594e04efb46d596dd50e905412a7a5bde5571..d628fa594d832bab3cb76603b2f956e7ce93fdbc 100644 (file)
@@ -377,6 +377,10 @@ SALOME_Prs* MeasureGUI_AngleDlg::buildPrs()
           anIO->SetArrowSize(arrowSize);
         }
 
+       SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+       int w = resMgr->integerValue("Geometry", "measures_line_width", 1);
+       anIO->SetWidth(w);
+
         SOCC_Prs* aPrs =
           dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
 
index c61cbc0af1a557b665c8a1a01a965f574525f6ef..2c8166beb986ba9f21842ac88f2fe91a4480fae0 100644 (file)
@@ -24,6 +24,7 @@
 // File   : MeasureGUI_CheckCompoundOfBlocksDlg.cxx
 // Author : Vladimir KLYACHIN, Open CASCADE S.A.S. (vladimir.klyachin@opencascade.com)
 //
+#include "MeasureGUI.h"
 #include "MeasureGUI_CheckCompoundOfBlocksDlg.h"
 #include "MeasureGUI_Widgets.h"
 
@@ -188,7 +189,7 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::SelectionIntoArgument()
   myObj = aSelectedObject;
   myGrp->LineEdit1->setText( GEOMBase::GetName( myObj ) );
   processObject();
-  displayPreview(true);
+  DISPLAY_PREVIEW_MACRO;
 }
 
 //=================================================================================
@@ -228,7 +229,7 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::ActivateThisDialog()
     connect( aSel, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
 
   activateSelection();
-  displayPreview(true);
+  DISPLAY_PREVIEW_MACRO
 }
 
 //=================================================================================
@@ -418,9 +419,11 @@ void MeasureGUI_CheckCompoundOfBlocksDlg::onSubShapesListSelectionChanged()
     QList<int>::iterator it;
     for ( it = aIds.begin(); it != aIds.end(); ++it ) {
       aSubShape = anIndices.FindKey(aObjLst[(*it)]);
+      SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+      int w = resMgr->integerValue("Geometry", "measures_line_width", 1);
       try {
         getDisplayer()->SetColor( Quantity_NOC_RED );
-        getDisplayer()->SetWidth( 3 );
+        getDisplayer()->SetWidth( w );
         getDisplayer()->SetToActivate( false );
         aPrs = !aSubShape.IsNull() ? getDisplayer()->BuildPrs( aSubShape ) : 0;
         if ( aPrs )
index ecd82d3e35da0da7828446ab776b51c56a6530bd..3b8bc2a13f218cc8b34db7a51815acb8194334cd 100644 (file)
@@ -327,6 +327,10 @@ SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs()
       Handle(AIS_LengthDimension) anIO = new AIS_LengthDimension(
         aVert1, aVert2, P, aDist, TCollection_ExtendedString((Standard_CString)aLabel.toLatin1().constData()));
       anIO->SetArrowSize(aDist/20);
+      
+      SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+      int w = resMgr->integerValue("Geometry", "measures_line_width", 1);
+      anIO->SetWidth(w);
 
       SOCC_Prs* aPrs = dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
 
index 44fc3639a47adabc818d0a032a3dfc97a5e81453..4b8ab9329858308d632fa3609a0e8f91c59bbf24 100644 (file)
@@ -21,6 +21,7 @@
 // File   : MeasureGUI_NormaleDlg.cxx
 // Author : Julia DOROVSKIKH, Open CASCADE S.A.S.
 //
+#include "MeasureGUI.h"
 #include "MeasureGUI_NormaleDlg.h"
 
 #include <DlgRef.h>
@@ -246,7 +247,7 @@ void MeasureGUI_NormaleDlg::SelectionIntoArgument()
       GroupArgs->PushButton1->click();
   }
 
-  displayPreview(true);
+  DISPLAY_PREVIEW_MACRO
 }
 
 //=================================================================================
@@ -286,7 +287,7 @@ void MeasureGUI_NormaleDlg::SetEditCurrentArgument()
   send->setDown(true);
 
   // seems we need it only to avoid preview disappearing, caused by selection mode change
-  displayPreview(true);
+  DISPLAY_PREVIEW_MACRO
 }
 
 //=================================================================================
@@ -313,7 +314,7 @@ void MeasureGUI_NormaleDlg::ActivateThisDialog()
   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
            this, SLOT( SelectionIntoArgument() ) );
 
-  displayPreview(true);
+  DISPLAY_PREVIEW_MACRO
 }
 
 //=================================================================================
index 318ea45b86e54b141b2a9b0084b4f561a4f2dc26..9b956bf68619c68e24455218a7ee0aeb988ff6d7 100644 (file)
@@ -497,6 +497,12 @@ void GEOM_Actor::SetWireframeProperty(vtkProperty* Prop)
   myWireframeFaceActor->SetProperty(Prop);
 }
 
+
+vtkProperty* GEOM_Actor::GetWireframeProperty()
+{
+  return myWireframeFaceActor->GetProperty();
+}
+
 void GEOM_Actor::SetShadingProperty(vtkProperty* Prop)
 {
 #ifdef MYDEBUG
@@ -506,6 +512,12 @@ void GEOM_Actor::SetShadingProperty(vtkProperty* Prop)
 }
 
 
+vtkProperty* GEOM_Actor::GetShadingProperty()
+{
+  return myShadingFaceProp;
+}
+
+
 void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *theMapper)
 {
 #ifdef MYDEBUG
@@ -995,6 +1007,27 @@ void GEOM_Actor::StoreIsoNumbers()
   myWireframeFaceSource->GetNbIso(myNbIsos[0], myNbIsos[1]);
 }
 
+void GEOM_Actor::SetIsosWidth(const int width) {
+  myWireframeFaceActor->GetProperty()->SetLineWidth(width);
+}
+
+int GEOM_Actor::GetIsosWidth() const {
+  return myWireframeFaceActor->GetProperty()->GetLineWidth();
+}
+
+void GEOM_Actor::SetWidth(const int width) {
+  myIsolatedEdgeActor->GetProperty()->SetLineWidth(width);
+  myOneFaceEdgeActor->GetProperty()->SetLineWidth(width);
+  mySharedEdgeActor->GetProperty()->SetLineWidth(width);
+  myHighlightProp->SetLineWidth(width);
+  myPreHighlightProp->SetLineWidth(width+1);
+
+}
+
+int GEOM_Actor::GetWidth() const {
+  return myIsolatedEdgeActor->GetProperty()->GetLineWidth();
+}
+    
 void GEOM_Actor::RestoreIsoNumbers()
 {
   if ( myNbIsos[0] > 0 || myNbIsos[1] > 0 )
index a6e890d65da11e4cc4040bc8f4d8e9f54fb1bcc9..c0c31fc5a7b51dc62703a3ccf0775449feea8900 100644 (file)
@@ -86,6 +86,9 @@ public:
   void SetWireframeProperty(vtkProperty* Prop);
   void SetShadingProperty(vtkProperty* Prop);
 
+  vtkProperty* GetWireframeProperty();
+  vtkProperty* GetShadingProperty();
+
   void setDeflection(double adef);
   virtual void setDisplayMode(int thenewmode);
 
@@ -166,6 +169,15 @@ public:
   void
   GetNbIsos(int &theNbU,int &theNbV);
   
+  virtual 
+  void SetIsosWidth(const int width);
+
+  int GetIsosWidth() const;
+
+  virtual void SetWidth(const int width);
+
+  int GetWidth() const;
+  
   //! Vector mode management
   virtual
   void
index 49bdabe8a7f5a1cabcfce531bf73cf3afd0d19b7..655dfc12589c1f44cbceee50a61c0968f5f7e670 100644 (file)
@@ -45,5 +45,7 @@
 #define MARKER_TYPE_PROP      "MarkerType"      //Marker type property
 #define FRONT_MATERIAL_PROP   "FrontMaterial"   //Object front material property
 #define BACK_MATERIAL_PROP    "BackMaterial"    //Object back material property
+#define EDGE_WIDTH_PROP       "EdgeWidth"       //Width of the edge
+#define ISOS_WIDTH_PROP       "IsosWidth"       //Width of the iso-lines 
 
 #endif //GEOM_CONSTANTS_H