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
@ -527,17 +534,17 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
Quantity_Color aColor = SalomeApp_Tools::color( col ); Quantity_Color aColor = SalomeApp_Tools::color( col );
int anUIsoNumber = aResMgr->integerValue("OCCViewer", "iso_number_u", 1); int anUIsoNumber = aResMgr->integerValue("OCCViewer", "iso_number_u", 1);
int aVIsoNumber = aResMgr->integerValue("OCCViewer", "iso_number_v", 1); int aVIsoNumber = aResMgr->integerValue("OCCViewer", "iso_number_v", 1);
Handle(Prs3d_IsoAspect) anAspect = AISShape->Attributes()->UIsoAspect(); Handle(Prs3d_IsoAspect) anAspect = AISShape->Attributes()->UIsoAspect();
anAspect->SetNumber( anUIsoNumber ); anAspect->SetNumber( anUIsoNumber );
anAspect->SetColor( aColor ); anAspect->SetColor( aColor );
AISShape->Attributes()->SetUIsoAspect( anAspect ); AISShape->Attributes()->SetUIsoAspect( anAspect );
anAspect = AISShape->Attributes()->VIsoAspect(); anAspect = AISShape->Attributes()->VIsoAspect();
anAspect->SetNumber( aVIsoNumber ); anAspect->SetNumber( aVIsoNumber );
anAspect->SetColor( aColor ); anAspect->SetColor( aColor );
AISShape->Attributes()->SetVIsoAspect( anAspect ); AISShape->Attributes()->SetVIsoAspect( anAspect );
if ( HasColor() ) if ( HasColor() )
{ {
AISShape->SetColor( (Quantity_NameOfColor)GetColor() ); AISShape->SetColor( (Quantity_NameOfColor)GetColor() );
@ -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 );
} }
} }
@ -554,17 +563,19 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
{ {
col = aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) ); col = aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) );
aColor = SalomeApp_Tools::color( col ); aColor = SalomeApp_Tools::color( col );
Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect(); Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
anAspect->SetColor( aColor ); anAspect->SetColor( aColor );
AISShape->Attributes()->SetPointAspect( anAspect ); anAspect->SetScale( myScaleOfMarker );
anAspect->SetTypeOfMarker( myTypeOfMarker );
AISShape->Attributes()->SetPointAspect( anAspect );
} }
else else
{ {
// Set line aspect // Set line aspect
col = aResMgr->colorValue( "Geometry", "wireframe_color", QColor( 255, 255, 0 ) ); col = aResMgr->colorValue( "Geometry", "wireframe_color", QColor( 255, 255, 0 ) );
aColor = SalomeApp_Tools::color( col ); aColor = SalomeApp_Tools::color( col );
Handle(Prs3d_LineAspect) anAspect = AISShape->Attributes()->LineAspect(); Handle(Prs3d_LineAspect) anAspect = AISShape->Attributes()->LineAspect();
anAspect->SetColor( aColor ); anAspect->SetColor( aColor );
AISShape->Attributes()->SetLineAspect( anAspect ); AISShape->Attributes()->SetLineAspect( anAspect );
@ -577,15 +588,15 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
// Set free boundaries aspect // Set free boundaries aspect
col = aResMgr->colorValue( "Geometry", "free_bound_color", QColor( 0, 255, 0 ) ); col = aResMgr->colorValue( "Geometry", "free_bound_color", QColor( 0, 255, 0 ) );
aColor = SalomeApp_Tools::color( col ); aColor = SalomeApp_Tools::color( col );
anAspect = AISShape->Attributes()->FreeBoundaryAspect(); anAspect = AISShape->Attributes()->FreeBoundaryAspect();
anAspect->SetColor( aColor ); anAspect->SetColor( aColor );
AISShape->Attributes()->SetFreeBoundaryAspect( anAspect ); AISShape->Attributes()->SetFreeBoundaryAspect( anAspect );
// Set wire aspect // Set wire aspect
col = aResMgr->colorValue( "Geometry", "line_color", QColor( 255, 0, 0 ) ); col = aResMgr->colorValue( "Geometry", "line_color", QColor( 255, 0, 0 ) );
aColor = SalomeApp_Tools::color( col ); aColor = SalomeApp_Tools::color( col );
anAspect = AISShape->Attributes()->WireAspect(); anAspect = AISShape->Attributes()->WireAspect();
anAspect->SetColor( aColor ); anAspect->SetColor( aColor );
AISShape->Attributes()->SetWireAspect( anAspect ); AISShape->Attributes()->SetWireAspect( anAspect );

View File

@ -1,22 +1,22 @@
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either // License as published by the Free Software Foundation; either
// version 2.1 of the License. // version 2.1 of the License.
// //
// This library is distributed in the hope that it will be useful, // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details. // Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software // 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 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// //
@ -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>
@ -68,7 +69,7 @@ class SUIT_SelectionFilter;
class GEOMGUI_WNT_EXPORT GEOM_Displayer : public LightApp_Displayer class GEOMGUI_WNT_EXPORT GEOM_Displayer : public LightApp_Displayer
{ {
public: public:
/* Constructor */ /* Constructor */
GEOM_Displayer( SalomeApp_Study* app ); GEOM_Displayer( SalomeApp_Study* app );
@ -84,9 +85,9 @@ public:
// This overloaded Display() method can be useful for operations // This overloaded Display() method can be useful for operations
// not using dialog boxes. // not using dialog boxes.
void Display ( GEOM::GEOM_Object_ptr theObj, void Display ( GEOM::GEOM_Object_ptr theObj,
const bool updateViewer = true ); const bool updateViewer = true );
void Redisplay ( const Handle(SALOME_InteractiveObject)& theIO, void Redisplay ( const Handle(SALOME_InteractiveObject)& theIO,
const bool updateViewer = true ); const bool updateViewer = true );
@ -97,17 +98,17 @@ public:
void Erase ( GEOM::GEOM_Object_ptr theObj, void Erase ( GEOM::GEOM_Object_ptr theObj,
const bool forced = false, const bool forced = false,
const bool updateViewer = true ); const bool updateViewer = true );
/* Display/Erase list of objects methods */ /* Display/Erase list of objects methods */
void Display ( const SALOME_ListIO& theIOList, void Display ( const SALOME_ListIO& theIOList,
const bool updateViewer = true ); const bool updateViewer = true );
void Erase ( const SALOME_ListIO& theIOList, void Erase ( const SALOME_ListIO& theIOList,
const bool forced = false, const bool forced = false,
const bool updateViewer = true ); const bool updateViewer = true );
void Redisplay ( const SALOME_ListIO& theIOList, void Redisplay ( const SALOME_ListIO& theIOList,
const bool updateViewer = true ); const bool updateViewer = true );
@ -155,20 +156,20 @@ protected:
/* internal methods */ /* internal methods */
/* Builds presentation accordint to the current viewer type */ /* Builds presentation accordint to the current viewer type */
virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 ); virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 );
/* Sets interactive object */ /* Sets interactive object */
void setIO( const Handle(SALOME_InteractiveObject)& theIO ); void setIO( const Handle(SALOME_InteractiveObject)& theIO );
/* Sets shape */ /* Sets shape */
void setShape( const TopoDS_Shape& theShape ); void setShape( const TopoDS_Shape& theShape );
/* Resets internal data */ /* Resets internal data */
void internalReset(); void internalReset();
void clearTemporary( LightApp_SelectionMgr* theSelMgr ); void clearTemporary( LightApp_SelectionMgr* theSelMgr );
SUIT_SelectionFilter* getFilter( const int theMode ); SUIT_SelectionFilter* getFilter( const int theMode );
protected: protected:
Handle(SALOME_InteractiveObject) myIO; Handle(SALOME_InteractiveObject) myIO;
TopoDS_Shape myShape; TopoDS_Shape myShape;
@ -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 )