mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-11 16:19:17 +05:00
INT PAL 0052625: GEOM module: customize labels color
This commit is contained in:
parent
909440ce50
commit
900bf17d4b
BIN
doc/salome/gui/GEOM/images/name_mode.png
Normal file
BIN
doc/salome/gui/GEOM/images/name_mode.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
Binary file not shown.
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 115 KiB |
@ -32,6 +32,8 @@ default color for edges, vectors and wires (isolated lines).</li>
|
||||
vertices.</li>
|
||||
<li><b>Color of isolines</b> - allows to select default color for
|
||||
isolines.</li>
|
||||
<li><b>Color of labels</b> - allows to select default color for
|
||||
labels (textual fields, shape name).</li>
|
||||
<li><b>Top level color</b> - allows to select default color for objects which
|
||||
were brought to the viewer foreground.</li>
|
||||
<li><b>Top level display mode</b> - allows to select default top level display mode between:</li>
|
||||
|
@ -58,6 +58,7 @@
|
||||
<parameter name="line_color" value="255, 0, 0" />
|
||||
<parameter name="point_color" value="#ff7700" />
|
||||
<parameter name="isos_color" value="200, 200, 200" />
|
||||
<parameter name="label_color" value="255, 255, 255" />
|
||||
<parameter name="toplevel_color" value="170, 85, 0" />
|
||||
<parameter name="toplevel_dm" value="0" />
|
||||
<parameter name="editgroup_color" value="170, 85, 0" />
|
||||
|
@ -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<QColor>() ) );
|
||||
|
||||
// - 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<QColor>();
|
||||
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() );
|
||||
|
@ -3304,6 +3304,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>PREF_ISOS_COLOR</source>
|
||||
<translation>Color of isolines</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_LABEL_COLOR</source>
|
||||
<translation>Color of labels</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_TOPLEVEL_COLOR</source>
|
||||
<translation>Top level color</translation>
|
||||
|
@ -3288,6 +3288,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
|
||||
<source>PREF_ISOS_COLOR</source>
|
||||
<translation>Couleur des isolignes</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_LABEL_COLOR</source>
|
||||
<translation type="unfinished">Color of labels</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_TOPLEVEL_COLOR</source>
|
||||
<translation>Couleur des objets mis au premier plan</translation>
|
||||
|
@ -3231,6 +3231,10 @@
|
||||
<source>PREF_ISOS_COLOR</source>
|
||||
<translation>輪郭の色</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_LABEL_COLOR</source>
|
||||
<translation type="unfinished">Color of labels</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_TOPLEVEL_COLOR</source>
|
||||
<translation>前景オブジェクトの色</translation>
|
||||
|
@ -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<SVTK_Viewer*>( (*anIt)->getViewModel() );
|
||||
if ( !aViewer )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
SALOME_ListIO aVisible;
|
||||
aViewer->GetVisible( aVisible );
|
||||
aDisplayer.Redisplay( aVisible, false, aViewer );
|
||||
}
|
||||
}
|
||||
aDisplayer.UpdateViewer();
|
||||
}
|
||||
else if ( param.startsWith( "dependency_tree") )
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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<vtkProperty*> theProps)
|
||||
{
|
||||
// we set material properties as back and front material
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user