From: amx Date: Thu, 25 Jan 2007 08:33:25 +0000 (+0000) Subject: Add two fields in the Geometry preference menu : X-Git-Tag: V3_2_5pre1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=560d0907b9a7d8a565ba7cd0ee2488a91050e865;p=modules%2Fgeom.git Add two fields in the Geometry preference menu : - the type of the marker used to represent vertices. - the size of the marker. --- diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index 4557ba97b..48827ca65 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -237,6 +237,13 @@ GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* st ) myShadingColor = SalomeApp_Tools::color( col ); myDisplayMode = resMgr->integerValue("Geometry", "display_mode", 0); + myTypeOfMarker = (Aspect_TypeOfMarker)resMgr->integerValue("Geometry", "type_of_marker", 0); + myScaleOfMarker = resMgr->doubleValue("Geometry", "marker_scale", 1.); + if(myScaleOfMarker < 1.) + myScaleOfMarker = 1.; + if(myScaleOfMarker > 8.) + myScaleOfMarker = 8.; + myColor = -1; // This color is used for shape displaying. If it is equal -1 then @@ -527,17 +534,17 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) Quantity_Color aColor = SalomeApp_Tools::color( col ); int anUIsoNumber = aResMgr->integerValue("OCCViewer", "iso_number_u", 1); int aVIsoNumber = aResMgr->integerValue("OCCViewer", "iso_number_v", 1); - + Handle(Prs3d_IsoAspect) anAspect = AISShape->Attributes()->UIsoAspect(); anAspect->SetNumber( anUIsoNumber ); anAspect->SetColor( aColor ); AISShape->Attributes()->SetUIsoAspect( anAspect ); - + anAspect = AISShape->Attributes()->VIsoAspect(); anAspect->SetNumber( aVIsoNumber ); anAspect->SetColor( aColor ); AISShape->Attributes()->SetVIsoAspect( anAspect ); - + if ( HasColor() ) { AISShape->SetColor( (Quantity_NameOfColor)GetColor() ); @@ -545,6 +552,8 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) { Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect(); anAspect->SetColor( (Quantity_NameOfColor)GetColor() ); + anAspect->SetScale( myScaleOfMarker ); + anAspect->SetTypeOfMarker( myTypeOfMarker ); AISShape->Attributes()->SetPointAspect( anAspect ); } } @@ -554,17 +563,19 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) { col = aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) ); aColor = SalomeApp_Tools::color( col ); - + Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect(); anAspect->SetColor( aColor ); - AISShape->Attributes()->SetPointAspect( anAspect ); + anAspect->SetScale( myScaleOfMarker ); + anAspect->SetTypeOfMarker( myTypeOfMarker ); + AISShape->Attributes()->SetPointAspect( anAspect ); } else { // Set line aspect col = aResMgr->colorValue( "Geometry", "wireframe_color", QColor( 255, 255, 0 ) ); aColor = SalomeApp_Tools::color( col ); - + Handle(Prs3d_LineAspect) anAspect = AISShape->Attributes()->LineAspect(); anAspect->SetColor( aColor ); AISShape->Attributes()->SetLineAspect( anAspect ); @@ -577,15 +588,15 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) // Set free boundaries aspect col = aResMgr->colorValue( "Geometry", "free_bound_color", QColor( 0, 255, 0 ) ); aColor = SalomeApp_Tools::color( col ); - + anAspect = AISShape->Attributes()->FreeBoundaryAspect(); anAspect->SetColor( aColor ); AISShape->Attributes()->SetFreeBoundaryAspect( anAspect ); - + // Set wire aspect col = aResMgr->colorValue( "Geometry", "line_color", QColor( 255, 0, 0 ) ); aColor = SalomeApp_Tools::color( col ); - + anAspect = AISShape->Attributes()->WireAspect(); anAspect->SetColor( aColor ); AISShape->Attributes()->SetWireAspect( anAspect ); diff --git a/src/GEOMGUI/GEOM_Displayer.h b/src/GEOMGUI/GEOM_Displayer.h index 2668e7d84..f477a37e2 100644 --- a/src/GEOMGUI/GEOM_Displayer.h +++ b/src/GEOMGUI/GEOM_Displayer.h @@ -1,22 +1,22 @@ // GEOM GEOMGUI : GUI for Geometry component // // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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 +// 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 -// +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // @@ -35,6 +35,7 @@ #include #include #include +#include #include @@ -68,7 +69,7 @@ class SUIT_SelectionFilter; class GEOMGUI_WNT_EXPORT GEOM_Displayer : public LightApp_Displayer { - + public: /* Constructor */ GEOM_Displayer( SalomeApp_Study* app ); @@ -84,9 +85,9 @@ public: // This overloaded Display() method can be useful for operations // not using dialog boxes. - void Display ( GEOM::GEOM_Object_ptr theObj, + void Display ( GEOM::GEOM_Object_ptr theObj, const bool updateViewer = true ); - + void Redisplay ( const Handle(SALOME_InteractiveObject)& theIO, const bool updateViewer = true ); @@ -97,17 +98,17 @@ public: void Erase ( GEOM::GEOM_Object_ptr theObj, const bool forced = false, - const bool updateViewer = true ); + const bool updateViewer = true ); /* Display/Erase list of objects methods */ - + void Display ( const SALOME_ListIO& theIOList, const bool updateViewer = true ); - + void Erase ( const SALOME_ListIO& theIOList, const bool forced = false, const bool updateViewer = true ); - + void Redisplay ( const SALOME_ListIO& theIOList, const bool updateViewer = true ); @@ -155,20 +156,20 @@ protected: /* internal methods */ /* Builds presentation accordint to the current viewer type */ virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 ); - + /* Sets interactive object */ void setIO( const Handle(SALOME_InteractiveObject)& theIO ); - + /* Sets shape */ void setShape( const TopoDS_Shape& theShape ); - + /* Resets internal data */ void internalReset(); void clearTemporary( LightApp_SelectionMgr* theSelMgr ); SUIT_SelectionFilter* getFilter( const int theMode ); - + protected: Handle(SALOME_InteractiveObject) myIO; TopoDS_Shape myShape; @@ -182,6 +183,8 @@ protected: double myWidth; bool myToActivate; int myDisplayMode; + Aspect_TypeOfMarker myTypeOfMarker; + double myScaleOfMarker; private: SalomeApp_Application* myApp; diff --git a/src/GEOMGUI/GEOM_msg_en.po b/src/GEOMGUI/GEOM_msg_en.po index 6d538e649..051772917 100644 --- a/src/GEOMGUI/GEOM_msg_en.po +++ b/src/GEOMGUI/GEOM_msg_en.po @@ -2932,6 +2932,9 @@ msgstr "OCC Viewer 3d" msgid "PREF_GROUP_GENERAL" msgstr "General" +msgid "PREF_GROUP_VERTEX" +msgstr "Marker of Points" + msgid "PREF_SHADING_COLOR" msgstr "Default shading color" @@ -2959,6 +2962,39 @@ msgstr "Default display mode" msgid "PREF_TAB_SETTINGS" msgstr "Settings" +msgid "PREF_TYPE_OF_MARKER" +msgstr "Type" + +msgid "PREF_MARKER_SCALE" +msgstr "Size" + +msgid "TOM_POINT" +msgstr "." + +msgid "TOM_PLUS" +msgstr "+" + +msgid "TOM_STAR" +msgstr "*" + +msgid "TOM_O" +msgstr "O" + +msgid "TOM_X" +msgstr "X" + +msgid "TOM_O_POINT" +msgstr ". in O" + +msgid "TOM_O_PLUS" +msgstr "+ in O" + +msgid "TOM_O_STAR" +msgstr "* in O" + +msgid "TOM_O_X" +msgstr "X in O" + msgid "ERROR_SHAPE_TYPE" msgstr "Object of incorrect type selected!\nPlease, select face, shell or solid and try again" diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index df6fc2ed6..bd3d9759d 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -61,6 +61,7 @@ #include #include +#include #include #include @@ -1673,6 +1674,14 @@ void GeometryGUI::createPreferences() int step = addPreference( tr( "PREF_STEP_VALUE" ), genGroup, LightApp_Preferences::IntSpin, "Geometry", "SettingsGeomStep" ); + int VertexGroup = addPreference( tr( "PREF_GROUP_VERTEX" ), tabId ); + + int typeOfMarker = addPreference( tr( "PREF_TYPE_OF_MARKER" ), VertexGroup, + LightApp_Preferences::Selector, "Geometry", "type_of_marker" ); + + int markerScale = addPreference( tr( "PREF_MARKER_SCALE" ), VertexGroup, + LightApp_Preferences::IntSpin, "Geometry", "marker_scale" ); + // Set property for default display mode QStringList aModesList; aModesList.append( tr("MEN_WIREFRAME") ); @@ -1690,6 +1699,37 @@ void GeometryGUI::createPreferences() setPreferenceProperty( step, "max", 10000 ); setPreferenceProperty( step, "precision", 3 ); + // Set property for type of vertex marker + QStringList aTypeOfMarkerList; + aTypeOfMarkerList.append( tr("TOM_POINT") ); + aTypeOfMarkerList.append( tr("TOM_PLUS") ); + aTypeOfMarkerList.append( tr("TOM_STAR") ); + aTypeOfMarkerList.append( tr("TOM_O") ); + aTypeOfMarkerList.append( tr("TOM_X") ); + aTypeOfMarkerList.append( tr("TOM_O_POINT") ); + aTypeOfMarkerList.append( tr("TOM_O_PLUS") ); + aTypeOfMarkerList.append( tr("TOM_O_STAR") ); + aTypeOfMarkerList.append( tr("TOM_O_X") ); + + QValueList anTypeOfMarkerIndexesList; + anTypeOfMarkerIndexesList.append(Aspect_TOM_POINT); + anTypeOfMarkerIndexesList.append(Aspect_TOM_PLUS); + anTypeOfMarkerIndexesList.append(Aspect_TOM_STAR); + anTypeOfMarkerIndexesList.append(Aspect_TOM_O); + anTypeOfMarkerIndexesList.append(Aspect_TOM_X); + anTypeOfMarkerIndexesList.append(Aspect_TOM_O_POINT); + anTypeOfMarkerIndexesList.append(Aspect_TOM_O_PLUS); + anTypeOfMarkerIndexesList.append(Aspect_TOM_O_STAR); + anTypeOfMarkerIndexesList.append(Aspect_TOM_O_X); + + setPreferenceProperty( typeOfMarker, "strings", aTypeOfMarkerList ); + setPreferenceProperty( typeOfMarker, "indexes", anTypeOfMarkerIndexesList ); + + // Set property for Vertex Marker scale + setPreferenceProperty( markerScale, "min", 0.25 ); + setPreferenceProperty( markerScale, "max", 10. ); + setPreferenceProperty( markerScale, "precision", 1 ); + } void GeometryGUI::preferencesChanged( const QString& section, const QString& param )