Salome HOME
size of image is limited by 7000 pixels
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Module.cxx
index d6d8f32cda753e82c086dac5c1553e6cd5d00dd7..d03db928ef466eb7eb5f1cc459461b76cc750b1f 100644 (file)
@@ -856,17 +856,57 @@ void HYDROGUI_Module::createPreferences()
   setPreferenceProperty( defaultStricklerCoef, "min", 0.00 );
   setPreferenceProperty( defaultStricklerCoef, "max", 1000000.00 );
   setPreferenceProperty( defaultStricklerCoef, "step", 0.01 );
+
+  int polylinesGroup = addPreference( tr( "PREF_GROUP_POLYLINES" ), genTab );
+  int polylineArrow = addPreference( tr( "PREF_POLYLINE_ARROW" ), polylinesGroup,
+    LightApp_Preferences::Selector, "polyline", "arrow_type" );
+
+  QList<QVariant> arrow_types;
+  arrow_types.append( tr( "No" ) );
+  arrow_types.append( tr( "Triangle" ) );
+  arrow_types.append( tr( "Cone" ) );
+  setPreferenceProperty( polylineArrow, "strings", arrow_types );
+
+  QList<QVariant> indices;
+  indices.append( 0 );
+  indices.append( 1 );
+  indices.append( 2 );
+  setPreferenceProperty( polylineArrow, "indexes", indices );
+  setPreferenceProperty( polylineArrow, "ids", indices );
+
+  int polylineSize = addPreference( tr( "PREF_POLYLINE_ARROW_SIZE" ), polylinesGroup,
+    LightApp_Preferences::IntSpin, "polyline", "arrow_size" );
 }
 
 void HYDROGUI_Module::preferencesChanged( const QString& theSection, const QString& thePref )
 {
+    SUIT_ResourceMgr* resMgr = application()->resourceMgr();
     if ( theSection == "preferences" && thePref == "default_strickler_coefficient" )
     {
-        SUIT_ResourceMgr* resMgr = application()->resourceMgr();
+        
         Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( application()->activeStudy()->id() );
         if ( resMgr && !aDoc.IsNull() )
             aDoc->SetDefaultStricklerCoefficient( resMgr->doubleValue( theSection, thePref, 0 ) );
     }
+    else if( theSection == "polyline" )
+    {
+      int aType = -1;
+      int aSize = -1;
+      if( resMgr )
+      {
+        resMgr->value( "polyline", "arrow_type", aType );
+        resMgr->value( "polyline", "arrow_size", aSize );
+      }
+      //Update polylines
+      ViewManagerMap::const_iterator it = myViewManagerMap.begin(), last = myViewManagerMap.end();
+      for( ; it!=last; it++ )
+      {
+        int aViewerId = it.key();
+        OCCViewer_ViewManager* aMgr = dynamic_cast<OCCViewer_ViewManager*>( it.value().first );
+        if( aMgr )
+          getOCCDisplayer()->UpdatePolylines( aViewerId, aType, aSize );
+      }
+    }
     else
         LightApp_Module::preferencesChanged( theSection, thePref );
 }