Add two fields in the Geometry preference menu :

- the type of the marker used to represent vertices.
- the size of the marker.
This commit is contained in:
amx 2007-01-25 08:33:25 +00:00
parent 376fa35cef
commit 560d0907b9
4 changed files with 124 additions and 34 deletions

View File

@ -237,6 +237,13 @@ GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* st )
myShadingColor = SalomeApp_Tools::color( col ); myShadingColor = SalomeApp_Tools::color( col );
myDisplayMode = resMgr->integerValue("Geometry", "display_mode", 0); 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; myColor = -1;
// This color is used for shape displaying. If it is equal -1 then // This color is used for shape displaying. If it is equal -1 then
@ -545,6 +552,8 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
{ {
Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect(); Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
anAspect->SetColor( (Quantity_NameOfColor)GetColor() ); anAspect->SetColor( (Quantity_NameOfColor)GetColor() );
anAspect->SetScale( myScaleOfMarker );
anAspect->SetTypeOfMarker( myTypeOfMarker );
AISShape->Attributes()->SetPointAspect( anAspect ); AISShape->Attributes()->SetPointAspect( anAspect );
} }
} }
@ -557,6 +566,8 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect(); Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
anAspect->SetColor( aColor ); anAspect->SetColor( aColor );
anAspect->SetScale( myScaleOfMarker );
anAspect->SetTypeOfMarker( myTypeOfMarker );
AISShape->Attributes()->SetPointAspect( anAspect ); AISShape->Attributes()->SetPointAspect( anAspect );
} }
else else

View File

@ -35,6 +35,7 @@
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <Quantity_Color.hxx> #include <Quantity_Color.hxx>
#include <LightApp_Displayer.h> #include <LightApp_Displayer.h>
#include <Aspect_TypeOfMarker.hxx>
#include <list> #include <list>
@ -182,6 +183,8 @@ protected:
double myWidth; double myWidth;
bool myToActivate; bool myToActivate;
int myDisplayMode; int myDisplayMode;
Aspect_TypeOfMarker myTypeOfMarker;
double myScaleOfMarker;
private: private:
SalomeApp_Application* myApp; SalomeApp_Application* myApp;

View File

@ -2932,6 +2932,9 @@ msgstr "OCC Viewer 3d"
msgid "PREF_GROUP_GENERAL" msgid "PREF_GROUP_GENERAL"
msgstr "General" msgstr "General"
msgid "PREF_GROUP_VERTEX"
msgstr "Marker of Points"
msgid "PREF_SHADING_COLOR" msgid "PREF_SHADING_COLOR"
msgstr "Default shading color" msgstr "Default shading color"
@ -2959,6 +2962,39 @@ msgstr "Default display mode"
msgid "PREF_TAB_SETTINGS" msgid "PREF_TAB_SETTINGS"
msgstr "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" msgid "ERROR_SHAPE_TYPE"
msgstr "Object of incorrect type selected!\nPlease, select face, shell or solid and try again" msgstr "Object of incorrect type selected!\nPlease, select face, shell or solid and try again"

View File

@ -61,6 +61,7 @@
#include <Prs3d_Drawer.hxx> #include <Prs3d_Drawer.hxx>
#include <Prs3d_IsoAspect.hxx> #include <Prs3d_IsoAspect.hxx>
#include <Aspect_TypeOfMarker.hxx>
#include <OSD_SharedLibrary.hxx> #include <OSD_SharedLibrary.hxx>
#include <utilities.h> #include <utilities.h>
@ -1673,6 +1674,14 @@ void GeometryGUI::createPreferences()
int step = addPreference( tr( "PREF_STEP_VALUE" ), genGroup, int step = addPreference( tr( "PREF_STEP_VALUE" ), genGroup,
LightApp_Preferences::IntSpin, "Geometry", "SettingsGeomStep" ); 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 // Set property for default display mode
QStringList aModesList; QStringList aModesList;
aModesList.append( tr("MEN_WIREFRAME") ); aModesList.append( tr("MEN_WIREFRAME") );
@ -1690,6 +1699,37 @@ void GeometryGUI::createPreferences()
setPreferenceProperty( step, "max", 10000 ); setPreferenceProperty( step, "max", 10000 );
setPreferenceProperty( step, "precision", 3 ); 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<QVariant> 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 ) void GeometryGUI::preferencesChanged( const QString& section, const QString& param )