From: mpa Date: Mon, 23 Mar 2015 12:33:25 +0000 (+0300) Subject: INT PAL 0052625: GEOM module: customize labels color X-Git-Tag: V7_6_0a1~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=900bf17d4b306071068cd3f031b3b5ff11552ba6;p=modules%2Fgeom.git INT PAL 0052625: GEOM module: customize labels color --- diff --git a/doc/salome/gui/GEOM/images/name_mode.png b/doc/salome/gui/GEOM/images/name_mode.png new file mode 100644 index 000000000..cdac11ea3 Binary files /dev/null and b/doc/salome/gui/GEOM/images/name_mode.png differ diff --git a/doc/salome/gui/GEOM/images/pref15.png b/doc/salome/gui/GEOM/images/pref15.png index 64aa25d74..d2b5966a6 100644 Binary files a/doc/salome/gui/GEOM/images/pref15.png and b/doc/salome/gui/GEOM/images/pref15.png differ diff --git a/doc/salome/gui/GEOM/input/geometry_preferences.doc b/doc/salome/gui/GEOM/input/geometry_preferences.doc index ea011b8bf..87bb9fc56 100644 --- a/doc/salome/gui/GEOM/input/geometry_preferences.doc +++ b/doc/salome/gui/GEOM/input/geometry_preferences.doc @@ -32,6 +32,8 @@ default color for edges, vectors and wires (isolated lines). vertices.
  • Color of isolines - allows to select default color for isolines.
  • +
  • Color of labels - allows to select default color for +labels (textual fields, shape name).
  • Top level color - allows to select default color for objects which were brought to the viewer foreground.
  • Top level display mode - allows to select default top level display mode between:
  • diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in index 142a2ec38..84f53783c 100644 --- a/resources/SalomeApp.xml.in +++ b/resources/SalomeApp.xml.in @@ -58,6 +58,7 @@ + diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index 24f2c017c..f2dd8bdb0 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -832,6 +832,9 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap // - color for edges in shading+edges mode AISShape->SetEdgesInShadingColor( SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::OutlineColor ) ).value() ) ); + // - color of labels (textual fields and shape name) + AISShape->SetLabelColor( qColorFromResources( "label_color", QColor( 255, 255, 255 ) ) ); + // set display mode AISShape->SetDisplayMode( HasDisplayMode() ? // predefined display mode, manually set to displayer via GEOM_Displayer::SetDisplayMode() function @@ -1126,6 +1129,10 @@ void GEOM_Displayer::updateActorProperties( GEOM_Actor* actor, bool create ) c = propMap.value( GEOM::propertyName( GEOM::OutlineColor ) ).value(); actor->SetEdgesInShadingColor( c.redF(), c.greenF(), c.blueF() ); + // - color of labels (shape name) + c = colorFromResources( "label_color", QColor( 255, 255, 255 ) ); + actor->SetLabelColor( c.redF(), c.greenF(), c.blueF() ); + // set opacity if( HasTransparency() ) { actor->SetOpacity( 1.0 - GetTransparency() ); diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index 3d0ebd610..4da50d2e7 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -3304,6 +3304,10 @@ Please, select face, shell or solid and try again PREF_ISOS_COLOR Color of isolines + + PREF_LABEL_COLOR + Color of labels + PREF_TOPLEVEL_COLOR Top level color diff --git a/src/GEOMGUI/GEOM_msg_fr.ts b/src/GEOMGUI/GEOM_msg_fr.ts index 0dda5406f..69786b158 100644 --- a/src/GEOMGUI/GEOM_msg_fr.ts +++ b/src/GEOMGUI/GEOM_msg_fr.ts @@ -3288,6 +3288,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau PREF_ISOS_COLOR Couleur des isolignes + + PREF_LABEL_COLOR + Color of labels + PREF_TOPLEVEL_COLOR Couleur des objets mis au premier plan diff --git a/src/GEOMGUI/GEOM_msg_ja.ts b/src/GEOMGUI/GEOM_msg_ja.ts index a73d31a00..6b5668ec8 100644 --- a/src/GEOMGUI/GEOM_msg_ja.ts +++ b/src/GEOMGUI/GEOM_msg_ja.ts @@ -3231,6 +3231,10 @@ PREF_ISOS_COLOR 輪郭の色 + + PREF_LABEL_COLOR + Color of labels + PREF_TOPLEVEL_COLOR 前景オブジェクトの色 diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 526eeaac5..143f63b05 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -2260,6 +2260,11 @@ void GeometryGUI::createPreferences() addPreference( tr( "PREF_ISOS_COLOR" ), genGroup, LightApp_Preferences::Color, "Geometry", "isos_color" ); + addPreference( tr( "PREF_LABEL_COLOR" ), genGroup, + LightApp_Preferences::Color, "Geometry", "label_color" ); + + addPreference( "", genGroup, LightApp_Preferences::Space ); + addPreference( tr( "PREF_TOPLEVEL_COLOR" ), genGroup, LightApp_Preferences::Color, "Geometry", "toplevel_color" ); @@ -2637,7 +2642,8 @@ void GeometryGUI::preferencesChanged( const QString& section, const QString& par param == QString("dimensions_arrow_length") || param == QString("dimensions_show_units") || param == QString("dimensions_length_units") || - param == QString("dimensions_angle_units") ) + param == QString("dimensions_angle_units") || + param == QString("label_color") ) { SalomeApp_Application* anApp = getApp(); if ( !anApp ) @@ -2668,7 +2674,22 @@ void GeometryGUI::preferencesChanged( const QString& section, const QString& par aViewer->GetVisible( aVisible ); aDisplayer.Redisplay( aVisible, false, aViewer ); } - + if ( param == QString( "label_color" ) ) { + ViewManagerList aVMsVTK; + anApp->viewManagers( SVTK_Viewer::Type(), aVMsVTK ); + ViewManagerList::Iterator anIt = aVMsVTK.begin(); + for ( ; anIt != aVMsVTK.end(); ++anIt ) + { + SVTK_Viewer* aViewer = dynamic_cast( (*anIt)->getViewModel() ); + if ( !aViewer ) + { + continue; + } + SALOME_ListIO aVisible; + aViewer->GetVisible( aVisible ); + aDisplayer.Redisplay( aVisible, false, aViewer ); + } + } aDisplayer.UpdateViewer(); } else if ( param.startsWith( "dependency_tree") ) diff --git a/src/OBJECT/GEOM_AISShape.cxx b/src/OBJECT/GEOM_AISShape.cxx index 87838da18..b1f7ade34 100644 --- a/src/OBJECT/GEOM_AISShape.cxx +++ b/src/OBJECT/GEOM_AISShape.cxx @@ -344,6 +344,10 @@ void GEOM_AISShape::SetEdgesInShadingColor(const Quantity_Color &aCol) myEdgesInShadingColor = aCol; } +void GEOM_AISShape::SetLabelColor(const Quantity_Color &aCol) { + myLabelColor = aCol; +} + void GEOM_AISShape::highlightSubShapes(const TColStd_IndexedMapOfInteger& aIndexMap, const Standard_Boolean aHighlight ) { @@ -569,6 +573,7 @@ void GEOM_AISShape::drawField( const Handle(Prs3d_Presentation)& thePrs, Handle(Graphic3d_AspectText3d) anAspectText3d = new Graphic3d_AspectText3d(); anAspectText3d->SetStyle( Aspect_TOST_ANNOTATION ); + anAspectText3d->SetColor( myLabelColor ); aGroup->SetPrimitivesAspect( anAspectText3d ); aGroup->Text( aString.toLatin1().constData(), aVertex, 14 ); @@ -628,6 +633,7 @@ void GEOM_AISShape::drawName( const Handle(Prs3d_Presentation)& thePrs ) Handle(Graphic3d_AspectText3d) anAspectText3d = new Graphic3d_AspectText3d(); anAspectText3d->SetStyle( Aspect_TOST_ANNOTATION ); + anAspectText3d->SetColor( myLabelColor ); aGroup->SetPrimitivesAspect( anAspectText3d ); const char* aName = getIO()->getName(); diff --git a/src/OBJECT/GEOM_AISShape.hxx b/src/OBJECT/GEOM_AISShape.hxx index babd2a0b7..f66636126 100644 --- a/src/OBJECT/GEOM_AISShape.hxx +++ b/src/OBJECT/GEOM_AISShape.hxx @@ -79,6 +79,7 @@ public: Standard_EXPORT void SetShadingColor(const Quantity_Color &aCol); Standard_EXPORT void SetEdgesInShadingColor(const Quantity_Color &aCol); + Standard_EXPORT void SetLabelColor(const Quantity_Color &aCol); Standard_EXPORT void SetDisplayVectors(bool isShow); Standard_EXPORT void SetDisplayVertices(bool isShow); Standard_EXPORT void SetDisplayName(bool isShow); @@ -137,6 +138,7 @@ protected: private: Quantity_Color myShadingColor; Quantity_Color myEdgesInShadingColor; + Quantity_Color myLabelColor; TCollection_AsciiString myName; bool myDisplayVectors; diff --git a/src/OBJECT/GEOM_Actor.cxx b/src/OBJECT/GEOM_Actor.cxx index 09eb87754..306d146e0 100644 --- a/src/OBJECT/GEOM_Actor.cxx +++ b/src/OBJECT/GEOM_Actor.cxx @@ -444,12 +444,12 @@ GEOM_Actor void GEOM_Actor -::SetShapeName(const TopoDS_Shape& theShape) +::SetShapeName() { - if( !getIO() ) + if( !getIO() || myShape.IsNull() ) return; - gp_Ax3 anAx3 = GEOMUtils::GetPosition(theShape); + gp_Ax3 anAx3 = GEOMUtils::GetPosition(myShape); double center[3] = { anAx3.Location().X(), anAx3.Location().Y(), anAx3.Location().Z() }; @@ -538,7 +538,7 @@ void GEOM_Actor::SetShape (const TopoDS_Shape& theShape, myHighlightActor->GetDeviceActor()->SetInfinitive(true); } - SetShapeName( theShape ); + SetShapeName(); // 0051777: TC7.2.0: Element could not be selected in Hypothesis Construction myAppendFilter->Update(); @@ -856,6 +856,15 @@ void GEOM_Actor::SetIsosColor(double r, double g, double b) myWireframeFaceActor->GetProperty()->SetColor(r, g, b); } +/*! + \brief Set color of labels + This actor is shown only if 'Show name' is switched-on, see SetVisibility() +*/ +void GEOM_Actor::SetLabelColor(double r, double g, double b) +{ + myTextActor->GetTextProperty()->SetColor(r, g, b); +} + void GEOM_Actor::SetMaterial(std::vector theProps) { // we set material properties as back and front material diff --git a/src/OBJECT/GEOM_Actor.h b/src/OBJECT/GEOM_Actor.h index f2884817d..f0f362188 100644 --- a/src/OBJECT/GEOM_Actor.h +++ b/src/OBJECT/GEOM_Actor.h @@ -139,6 +139,8 @@ public: void SetEdgesInShadingColor(double r, double g, double b); // Color of iso-lines void SetIsosColor(double r, double g, double b); + // Color of labels + void SetLabelColor(double r, double g, double b); // Material @@ -224,7 +226,7 @@ protected: void SetModified(); void GetMatrix(vtkCamera* theCam, vtkMatrix4x4 *result); - void SetShapeName(const TopoDS_Shape& theShape); + void SetShapeName(); GEOM_Actor(); ~GEOM_Actor();