mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-28 20:50:32 +05:00
Preferences and compilation errors
This commit is contained in:
parent
804c280322
commit
5e351de3da
8
resources/SalomeApp.xml.in
Normal file → Executable file
8
resources/SalomeApp.xml.in
Normal file → Executable file
@ -100,6 +100,14 @@
|
||||
<parameter name="dimensions_default_flyout" value="20" />
|
||||
<parameter name="dimensions_use_text3d" value="0" />
|
||||
|
||||
<!-- Shape annotation presentation properties -->
|
||||
<parameter name="shape_annotation_font_color" value="#ffffff" />
|
||||
<parameter name="shape_annotation_font" value="Y14.5M-2009,14" />
|
||||
<parameter name="shape_annotation_line_color" value="#ffffff" />
|
||||
<parameter name="shape_annotation_line_width" value="1.0" />
|
||||
<parameter name="shape_annotation_line_style" value="0" />
|
||||
<parameter name="shape_annotation_autohide" value="false" />
|
||||
|
||||
<!-- Scalar bar for field step presentation -->
|
||||
<parameter name="scalar_bar_x_position" value="0.05" />
|
||||
<parameter name="scalar_bar_y_position" value="0.1" />
|
||||
|
@ -25,7 +25,6 @@
|
||||
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
|
||||
|
||||
#include "GEOM_Displayer.h"
|
||||
#include "GEOMGUI_DimensionProperty.h"
|
||||
#include "GeometryGUI.h"
|
||||
|
||||
#include <GEOM_Constants.h>
|
||||
@ -39,12 +38,16 @@
|
||||
|
||||
#include <GEOM_Actor.h>
|
||||
#include <GEOM_AISDimension.hxx>
|
||||
#include <GEOM_Annotation.hxx>
|
||||
#include <GEOM_TopWireframeShape.hxx>
|
||||
#include <GEOM_AISVector.hxx>
|
||||
#include <GEOM_AISTrihedron.hxx>
|
||||
#include <GEOM_VTKTrihedron.hxx>
|
||||
#include <GEOM_VTKPropertyMaterial.hxx>
|
||||
|
||||
#include <GEOMGUI_DimensionProperty.h>
|
||||
#include <GEOMGUI_ShapeAnnotations.h>
|
||||
|
||||
#include <GEOMUtils.hxx>
|
||||
|
||||
#include <Material_Model.h>
|
||||
@ -1386,6 +1389,7 @@ void GEOM_Displayer::updateShapeAnnotations( const Handle(SALOME_InteractiveObje
|
||||
AIS_ListIteratorOfListOfInteractive aIterateIO( aListOfIO );
|
||||
|
||||
// remove existing presentations of shape annotations
|
||||
bool isAnyRemoved = false;
|
||||
for ( ; aIterateIO.More(); aIterateIO.Next() )
|
||||
{
|
||||
const Handle(AIS_InteractiveObject)& anIO = aIterateIO.Value();
|
||||
@ -1393,64 +1397,63 @@ void GEOM_Displayer::updateShapeAnnotations( const Handle(SALOME_InteractiveObje
|
||||
continue;
|
||||
|
||||
aListOfIO.Remove( aIterateIO );
|
||||
isAnyRemoved = true;
|
||||
if ( !aIterateIO.More() )
|
||||
break;
|
||||
}
|
||||
|
||||
// read annotation preferences
|
||||
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
|
||||
|
||||
QColor aQColor = aResMgr->colorValue ( "Geometry", "shape_annotation_color", QColor( 0, 0, 0 ) );
|
||||
int aLineWidth = aResMgr->integerValue( "Geometry", "shape_annotation_line_width", 1 );
|
||||
QFont aFont = aResMgr->fontValue ( "Geometry", "shape_annotation_font", QFont("Arial", 14) );
|
||||
bool aAutoHide = aResMgr->fontValue ( "Geometry", "shape_annotation_autohide", true );
|
||||
const QFont aFont = aResMgr->fontValue( "Geometry", "shape_annotation_font", QFont( "Arial", 14 ) );
|
||||
const QColor aFontColor = aResMgr->colorValue( "Geometry", "shape_annotation_font_color", QColor( 255, 255, 255 ) );
|
||||
const QColor aLineColor = aResMgr->colorValue( "Geometry", "shape_annotation_line_color", QColor( 255, 255, 255 ) );
|
||||
const double aLineWidth = aResMgr->doubleValue( "Geometry", "shape_annotation_line_width", 1.0 );
|
||||
const int aLineStyle = aResMgr->integerValue( "Geometry", "shape_annotation_line_style", 0 );
|
||||
const bool isAutoHide = aResMgr->booleanValue( "Geometry", "shape_annotation_autohide", false );
|
||||
|
||||
// create shape annotations using data from the attribute of a study
|
||||
QVariant aProperty = aStudy->getObjectProperty( GEOM::sharedPropertiesId(),
|
||||
theIO->getEntry(),
|
||||
GEOM::propertyName( GEOM::ShapeAnnotations ),
|
||||
QVariant() );
|
||||
|
||||
GEOMGUI_ShapeAnnotationProperty aStudyAnnotations;
|
||||
GEOMGUI_ShapeAnnotations aAnnotationList;
|
||||
|
||||
if ( aProperty.isValid() && aProperty.canConvert<GEOMGUI_DimensionProperty>() )
|
||||
if ( aProperty.isValid() && aProperty.canConvert<GEOMGUI_ShapeAnnotations>() )
|
||||
{
|
||||
aStudyAnnotations = aProperty.value<GEOMGUI_ShapeAnnotationProperty>();
|
||||
}
|
||||
else
|
||||
{
|
||||
aStudyAnnotations.LoadFromAttribute( getStudy(), theIO->getEntry() );
|
||||
}
|
||||
aAnnotationList = aProperty.value<GEOMGUI_ShapeAnnotations>();
|
||||
|
||||
// create up-to-date shape annotation presentations
|
||||
for ( int aPrsIt = 0; aPrsIt < aStudyAnnotations.GetNumber(); ++aPrsIt )
|
||||
for ( int anI = 0; anI < aAnnotationList.Count(); ++anI )
|
||||
{
|
||||
if ( !aStudyAnnotations.IsVisible( aPrsIt ) )
|
||||
if ( !aAnnotationList.Get( anI ).IsVisible )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Handle(GEOM_Annotation) aPrs = new GEOM_Annotation();
|
||||
Handle(GEOM_Annotation) aPresentation = new GEOM_Annotation();
|
||||
|
||||
aStudyAnnotations.GetRecord( aPrsIt )->Update( aPrs );
|
||||
aAnnotationList.ToPresentation ( anI, aPresentation, theShapeLCS );
|
||||
|
||||
gp_Trsf aToLCS;
|
||||
aToLCS.SetTransformation( theLCS, gp_Ax3() );
|
||||
aPrs->SetLocalTransformation( aToLCS );
|
||||
aPrs->SetOwner( theIO );
|
||||
aPresentation->SetOwner( theIO );
|
||||
|
||||
Quantity_Color aColor( aQColor.redF(), aQColor.greenF(), aQColor.blueF(), Quantity_TOC_RGB );
|
||||
const Quantity_Color aOcctFontColor( aFontColor.redF(), aFontColor.greenF(), aFontColor.blueF(), Quantity_TOC_RGB );
|
||||
const Quantity_Color aOcctLineColor( aLineColor.redF(), aLineColor.greenF(), aLineColor.blueF(), Quantity_TOC_RGB );
|
||||
const Standard_Real aFontHeight = aFont.pixelSize() != -1 ? aFont.pixelSize() : aFont.pointSize();
|
||||
|
||||
Standard_Real aFontHeight = aFont.pixelSize() != -1 ? aFont.pixelSize() : aFont.pointSize();
|
||||
aPrs->SetColor( aColor );
|
||||
aPrs->SetTextHeight( aFontHeight );
|
||||
aPrs->SetFont( aFont.family().toLatin1().data() );
|
||||
aPrs->SetLineWidth( aLineWidth );
|
||||
aPresentation->SetTextHeight( aFont.pixelSize() != -1 ? aFont.pixelSize() : aFont.pointSize() );
|
||||
aPresentation->SetTextColor( Quantity_Color( aFontColor.redF(), aFontColor.greenF(), aFontColor.blueF(), Quantity_TOC_RGB ) );
|
||||
aPresentation->SetLineColor( Quantity_Color( aLineColor.redF(), aLineColor.greenF(), aLineColor.blueF(), Quantity_TOC_RGB ) );
|
||||
aPresentation->SetLineWidth( aLineWidth );
|
||||
aPresentation->SetLineStyle( static_cast<Aspect_TypeOfLine>( aLineStyle ) );
|
||||
aPresentation->SetAutoHide( isAutoHide ? Standard_True : Standard_False );
|
||||
|
||||
aListOfIO.Append( aPrs );
|
||||
aListOfIO.Append( aPresentation );
|
||||
}
|
||||
}
|
||||
else if ( !isAnyRemoved )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// update presentation
|
||||
anOccPrs->Clear();
|
||||
|
||||
for ( aIterateIO.Initialize( aListOfIO ); aIterateIO.More(); aIterateIO.Next() )
|
||||
@ -1649,7 +1652,7 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
|
||||
}
|
||||
|
||||
updateDimensions( myIO, occPrs, gp_Ax3().Transformed( myShape.Location().Transformation() ) );
|
||||
updateAnnotations( myIO, occPrs, gp_Ax3().Transformed( myShape.Location().Transformation() ) );
|
||||
updateShapeAnnotations( myIO, occPrs, gp_Ax3().Transformed( myShape.Location().Transformation() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
44
src/GEOMGUI/GEOM_msg_en.ts
Normal file → Executable file
44
src/GEOMGUI/GEOM_msg_en.ts
Normal file → Executable file
@ -3500,6 +3500,50 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>PREF_DIMENSIONS_USE_TEXT3D</source>
|
||||
<translation>Use 3D text</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS</source>
|
||||
<translation>Shape annotations</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_FONT</source>
|
||||
<translation>Font</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_FONT_COLOR</source>
|
||||
<translation>Font color</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINE_COLOR</source>
|
||||
<translation>Line color</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINE_WIDTH</source>
|
||||
<translation>Line width</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINE_STYLE</source>
|
||||
<translation>Line style</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_AUTOHIDE</source>
|
||||
<translation>Hide when attachment is invisible</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINESTYLE_SOLID</source>
|
||||
<translation>Solid</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINESTYLE_DASH</source>
|
||||
<translation>Dashed</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINESTYLE_DOT</source>
|
||||
<translation>Dotted</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINESTYLE_DOTDASH</source>
|
||||
<translation>Mixed</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_HIDE_INPUT_OBJECT</source>
|
||||
<translation>Hide input objects from the viewer</translation>
|
||||
|
33
src/GEOMGUI/GEOM_msg_fr.ts
Normal file → Executable file
33
src/GEOMGUI/GEOM_msg_fr.ts
Normal file → Executable file
@ -3492,6 +3492,39 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
|
||||
<source>PREF_DIMENSIONS_USE_TEXT3D</source>
|
||||
<translation>Utiliser du texte 3D</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_FONT</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_FONT_COLOR</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINE_COLOR</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINE_WIDTH</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINE_STYLE</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_AUTOHIDE</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINESTYLE_SOLID</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINESTYLE_DASH</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINESTYLE_DOT</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINESTYLE_DOTDASH</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_HIDE_INPUT_OBJECT</source>
|
||||
<translation>Cacher dans la vue les objets en entrée</translation>
|
||||
|
33
src/GEOMGUI/GEOM_msg_ja.ts
Normal file → Executable file
33
src/GEOMGUI/GEOM_msg_ja.ts
Normal file → Executable file
@ -3495,6 +3495,39 @@
|
||||
<source>PREF_DIMENSIONS_USE_TEXT3D</source>
|
||||
<translation>3Dテキストの使用</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_FONT</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_FONT_COLOR</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINE_COLOR</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINE_WIDTH</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINE_STYLE</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_AUTOHIDE</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINESTYLE_SOLID</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINESTYLE_DASH</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINESTYLE_DOT</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINESTYLE_DOTDASH</source>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_HIDE_INPUT_OBJECT</source>
|
||||
<translation>ビューワから入力したオブジェクトの非表示</translation>
|
||||
|
51
src/GEOMGUI/GeometryGUI.cxx
Normal file → Executable file
51
src/GEOMGUI/GeometryGUI.cxx
Normal file → Executable file
@ -2355,6 +2355,10 @@ void GeometryGUI::createPreferences()
|
||||
addPreference( tr( "PREF_AUTO_BRING_TO_FRONT" ), genGroup,
|
||||
LightApp_Preferences::Bool, "Geometry", "auto_bring_to_front" );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Dimensions (Measurements) preferences
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
int aDimGroupId = addPreference( tr( "PREF_DIMENSIONS" ), tabId );
|
||||
setPreferenceProperty( aDimGroupId, "columns", 2 );
|
||||
|
||||
@ -2438,6 +2442,53 @@ void GeometryGUI::createPreferences()
|
||||
addPreference( tr( "PREF_DIMENSIONS_USE_TEXT3D" ), aDimGroupId,
|
||||
LightApp_Preferences::Bool, "Geometry", "dimensions_use_text3d" );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Shape annotation preferences
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
const int aShapeAnnGroupId = addPreference( tr( "PREF_SHAPE_ANNOTATIONS" ), tabId );
|
||||
setPreferenceProperty( aShapeAnnGroupId, "columns", 2 );
|
||||
|
||||
addPreference( tr( "PREF_SHAPE_ANNOTATIONS_FONT_COLOR" ), aShapeAnnGroupId, LightApp_Preferences::Color, "Geometry", "shape_annotation_font_color" );
|
||||
addPreference( tr( "PREF_SHAPE_ANNOTATIONS_LINE_COLOR" ), aShapeAnnGroupId, LightApp_Preferences::Color, "Geometry", "shape_annotation_line_color" );
|
||||
const int aShapeAnnFont =
|
||||
addPreference( tr( "PREF_SHAPE_ANNOTATIONS_FONT" ), aShapeAnnGroupId, LightApp_Preferences::Font, "Geometry", "shape_annotation_font" );
|
||||
|
||||
int aShapeAnnFontFeatures = QtxFontEdit::Family | QtxFontEdit::Size | QtxFontEdit::Bold | QtxFontEdit::Italic;
|
||||
setPreferenceProperty( aShapeAnnFont, "features", aShapeAnnFontFeatures );
|
||||
setPreferenceProperty( aShapeAnnFont, "mode", QtxFontEdit::Custom );
|
||||
setPreferenceProperty( aShapeAnnFont, "fonts", anOCCFonts );
|
||||
|
||||
const int aShapeAnnLineWidth =
|
||||
addPreference( tr( "PREF_SHAPE_ANNOTATIONS_LINE_WIDTH" ), aShapeAnnGroupId, LightApp_Preferences::IntSpin, "Geometry", "shape_annotation_line_width" );
|
||||
|
||||
setPreferenceProperty( aShapeAnnLineWidth, "min", 1 );
|
||||
setPreferenceProperty( aShapeAnnLineWidth, "max", 5 );
|
||||
|
||||
addPreference( tr( "PREF_SHAPE_ANNOTATIONS_AUTOHIDE" ), aShapeAnnGroupId, LightApp_Preferences::Bool, "Geometry", "shape_annotation_autohide" );
|
||||
|
||||
const int aShapeAnnLineStyle =
|
||||
addPreference( tr( "PREF_SHAPE_ANNOTATIONS_LINE_STYLE" ), aShapeAnnGroupId, LightApp_Preferences::Selector, "Geometry", "shape_annotation_line_style" );
|
||||
|
||||
QStringList aLineStyleList;
|
||||
aLineStyleList.append( tr("PREF_SHAPE_ANNOTATIONS_LINESTYLE_SOLID") );
|
||||
aLineStyleList.append( tr("PREF_SHAPE_ANNOTATIONS_LINESTYLE_DASH") );
|
||||
aLineStyleList.append( tr("PREF_SHAPE_ANNOTATIONS_LINESTYLE_DOT") );
|
||||
aLineStyleList.append( tr("PREF_SHAPE_ANNOTATIONS_LINESTYLE_DOTDASH") );
|
||||
|
||||
QList<QVariant> aLineStyleIds;
|
||||
aLineStyleIds.append(0);
|
||||
aLineStyleIds.append(1);
|
||||
aLineStyleIds.append(2);
|
||||
aLineStyleIds.append(3);
|
||||
|
||||
setPreferenceProperty( aShapeAnnLineStyle, "strings", aLineStyleList );
|
||||
setPreferenceProperty( aShapeAnnLineStyle, "indexes", aLineStyleIds );
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Isoline drawing preferences
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
int isoGroup = addPreference( tr( "PREF_ISOS" ), tabId );
|
||||
setPreferenceProperty( isoGroup, "columns", 2 );
|
||||
int isoU = addPreference( tr( "PREF_ISOS_U" ), isoGroup,
|
||||
|
@ -38,7 +38,9 @@
|
||||
#include <OpenGl_Context.hxx>
|
||||
#include <OpenGl_GraphicDriver.hxx>
|
||||
#include <OpenGl_Group.hxx>
|
||||
#include <OpenGl_PrimitiveArray.hxx>
|
||||
#include <OpenGl_Structure.hxx>
|
||||
#include <OpenGl_Text.hxx>
|
||||
#include <OpenGl_View.hxx>
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
#include <Prs3d_Root.hxx>
|
||||
@ -80,7 +82,9 @@ GEOM_Annotation::GEOM_Annotation() : AIS_InteractiveObject()
|
||||
void GEOM_Annotation::SetText( const TCollection_ExtendedString& theText )
|
||||
{
|
||||
if (myText != theText)
|
||||
{
|
||||
SetToUpdate();
|
||||
}
|
||||
|
||||
myText = theText;
|
||||
}
|
||||
@ -93,7 +97,7 @@ void GEOM_Annotation::SetPosition (const gp_Pnt& thePosition)
|
||||
{
|
||||
myPosition = thePosition;
|
||||
|
||||
AIS_InteractiveObject::SetTransformPersistence (Graphic3d_TMF_ZoomPers | Graphic3d_TMF_RotatePers, thePosition);
|
||||
UpdatePersistence();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@ -103,6 +107,8 @@ void GEOM_Annotation::SetPosition (const gp_Pnt& thePosition)
|
||||
void GEOM_Annotation::SetScreenFixed( const Standard_Boolean theIsFixed )
|
||||
{
|
||||
myIsScreenFixed = theIsFixed;
|
||||
|
||||
UpdatePersistence();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@ -119,10 +125,31 @@ void GEOM_Annotation::SetAttachPoint (const gp_Pnt& thePoint)
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void GEOM_Annotation::SetColor( const Quantity_Color& theColor )
|
||||
{
|
||||
SetTextColor( theColor );
|
||||
SetLineColor( theColor );
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetTextColor
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void GEOM_Annotation::SetTextColor( const Quantity_Color& theColor )
|
||||
{
|
||||
myDrawer->TextAspect()->SetColor( theColor );
|
||||
|
||||
SetToUpdate();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetLineColor
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void GEOM_Annotation::SetLineColor( const Quantity_Color& theColor )
|
||||
{
|
||||
myDrawer->LineAspect()->SetColor( theColor );
|
||||
AIS_InteractiveObject::SetColor (theColor);
|
||||
|
||||
SetToUpdate();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@ -134,6 +161,7 @@ void GEOM_Annotation::SetTextHeight (const Standard_Real theHeight)
|
||||
if (GetTextHeight() != theHeight)
|
||||
{
|
||||
myDrawer->TextAspect()->SetHeight( theHeight );
|
||||
|
||||
SetToUpdate ();
|
||||
}
|
||||
}
|
||||
@ -147,6 +175,7 @@ void GEOM_Annotation::SetFontAspect (const Font_FontAspect theFontAspect)
|
||||
if (GetFontAspect() != theFontAspect)
|
||||
{
|
||||
myDrawer->TextAspect()->Aspect()->SetTextFontAspect( theFontAspect );
|
||||
|
||||
SetToUpdate();
|
||||
}
|
||||
}
|
||||
@ -160,6 +189,7 @@ void GEOM_Annotation::SetFont (const TCollection_AsciiString& theFont)
|
||||
if (GetFont() != theFont)
|
||||
{
|
||||
myDrawer->TextAspect()->Aspect()->SetFont( theFont );
|
||||
|
||||
SetToUpdate();
|
||||
}
|
||||
}
|
||||
@ -169,8 +199,43 @@ void GEOM_Annotation::SetFont (const TCollection_AsciiString& theFont)
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void GEOM_Annotation::SetLineWidth( const Standard_Real theLineWidth )
|
||||
{
|
||||
if (GetLineWidth() != theLineWidth)
|
||||
{
|
||||
myDrawer->LineAspect()->SetWidth( theLineWidth );
|
||||
|
||||
SetToUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetLineStyle
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void GEOM_Annotation::SetLineStyle( const Aspect_TypeOfLine theStyle )
|
||||
{
|
||||
if (GetLineStyle() != theStyle)
|
||||
{
|
||||
myDrawer->LineAspect()->SetTypeOfLine( theStyle );
|
||||
|
||||
SetToUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : UpdatePersistence
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void GEOM_Annotation::UpdatePersistence()
|
||||
{
|
||||
if (!myIsScreenFixed)
|
||||
{
|
||||
AIS_InteractiveObject::SetTransformPersistence( Graphic3d_TMF_ZoomPers | Graphic3d_TMF_RotatePers, myPosition );
|
||||
}
|
||||
else
|
||||
{
|
||||
AIS_InteractiveObject::SetTransformPersistence( Graphic3d_TMF_2d, gp_Pnt( 0.0, 0.0, 0.0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@ -203,9 +268,9 @@ void GEOM_Annotation::Compute (const Handle(PrsMgr_PresentationManager3d)& /*the
|
||||
aGroup->SetGroupPrimitivesAspect( myDrawer->TextAspect()->Aspect() );
|
||||
aGroup->SetGroupPrimitivesAspect( myDrawer->LineAspect()->Aspect() );
|
||||
|
||||
NCollection_Handle<Bnd_Box> aBoundingBox = TextBoundingBox();
|
||||
gp_Pnt aBoxMin = aBoundingBox->CornerMin();
|
||||
gp_Pnt aBoxMax = aBoundingBox->CornerMax();
|
||||
const NCollection_Handle<Bnd_Box> aBoundingBox = TextBoundingBox();
|
||||
const gp_Pnt aBoxMin = aBoundingBox->CornerMin();
|
||||
const gp_Pnt aBoxMax = aBoundingBox->CornerMax();
|
||||
aGroup->ChangeBoundingBox() = Graphic3d_BndBox4f (
|
||||
Graphic3d_Vec4( static_cast<Standard_ShortReal>( aBoxMin.X() ),
|
||||
static_cast<Standard_ShortReal>( aBoxMin.Y() ),
|
||||
@ -229,9 +294,9 @@ void GEOM_Annotation::ComputeSelection (const Handle(SelectMgr_Selection)& theSe
|
||||
|
||||
theSelection->Clear();
|
||||
|
||||
NCollection_Handle<Bnd_Box> aBoundingBox = TextBoundingBox();
|
||||
Handle(SelectMgr_EntityOwner) anEntityOwner = new SelectMgr_EntityOwner (this, 10);
|
||||
Handle(Select3D_SensitiveBox) aSensitive = new Select3D_SensitiveBox (anEntityOwner, *aBoundingBox.get());
|
||||
const NCollection_Handle<Bnd_Box> aBoundingBox = TextBoundingBox();
|
||||
const Handle(SelectMgr_EntityOwner) anEntityOwner = new SelectMgr_EntityOwner( this, 10 );
|
||||
const Handle(Select3D_SensitiveBox) aSensitive = new Select3D_SensitiveBox( anEntityOwner, *aBoundingBox.get() );
|
||||
theSelection->Add( aSensitive );
|
||||
}
|
||||
|
||||
@ -246,10 +311,12 @@ NCollection_Handle<Bnd_Box> GEOM_Annotation::TextBoundingBox() const
|
||||
Font_FTFont aFont;
|
||||
unsigned int aResolution = GetContext()->CurrentViewer()->DefaultRenderingParams().Resolution;
|
||||
if ( aFont.Init( anAsp->Aspect()->Font().ToCString(),
|
||||
anAsp->Aspect()->GetTextFontAspect(), (unsigned int)anAsp->Height(), aResolution))
|
||||
anAsp->Aspect()->GetTextFontAspect(),
|
||||
(unsigned int)anAsp->Height(),
|
||||
aResolution ) )
|
||||
{
|
||||
const NCollection_String aText( (Standard_Utf16Char* )myText.ToExtString() );
|
||||
Font_Rect aFontRect = aFont.BoundingBox (aText, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM);
|
||||
const Font_Rect aFontRect = aFont.BoundingBox( aText, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM );
|
||||
NCollection_Handle<Bnd_Box> aBox = new Bnd_Box();
|
||||
aBox->Add( gp_Pnt( 0.0, 0.0, 0.0 ) );
|
||||
aBox->Add( gp_Pnt( aFontRect.Width(), aFontRect.Height(), 0.0 ) );
|
||||
@ -424,3 +491,4 @@ void GEOM_Annotation::OpenGl_Annotation::Render (const Handle(OpenGl_Workspace)&
|
||||
theWorkspace->SetHighlight( toHighlight );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,8 +34,6 @@
|
||||
#include <NCollection_Handle.hxx>
|
||||
#include <NCollection_String.hxx>
|
||||
#include <OpenGl_Element.hxx>
|
||||
#include <OpenGl_PrimitiveArray.hxx>
|
||||
#include <OpenGl_Text.hxx>
|
||||
#include <OpenGl_TextParam.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
@ -44,6 +42,10 @@
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
class OpenGl_GraphicDriver;
|
||||
class OpenGl_PrimitiveArray;
|
||||
class OpenGl_Text;
|
||||
|
||||
/*!
|
||||
* \class GEOM_Annotation
|
||||
* \brief Interactive object, representating annotation entity
|
||||
@ -111,8 +113,17 @@ public:
|
||||
//! Sets color for the presentation.
|
||||
Standard_EXPORT virtual void SetColor( const Quantity_Color& theColor ) Standard_OVERRIDE;
|
||||
|
||||
//! Sets text color.
|
||||
Standard_EXPORT void SetTextColor( const Quantity_Color& theColor );
|
||||
|
||||
//! Returns color for the text's label.
|
||||
Quantity_Color GetColor() const { return myDrawer->TextAspect()->Aspect()->Color(); }
|
||||
Quantity_Color GetTextColor() const { return myDrawer->TextAspect()->Aspect()->Color(); }
|
||||
|
||||
//! Sets line's color.
|
||||
Standard_EXPORT void SetLineColor( const Quantity_Color& theColor);
|
||||
|
||||
//! Returns color for the connection line.
|
||||
Quantity_Color GetLineColor() const { return myDrawer->LineAspect()->Aspect()->Color(); }
|
||||
|
||||
//! Sets text height in pixels.
|
||||
Standard_EXPORT void SetTextHeight( const Standard_Real theHeight );
|
||||
@ -136,7 +147,13 @@ public:
|
||||
Standard_EXPORT void SetLineWidth( const Standard_Real theLineWidth );
|
||||
|
||||
//! Returns line width for drawing the annotation's extension line and underline.
|
||||
Standard_Real LineWidth() const { return myDrawer->LineAspect()->Aspect()->Width(); }
|
||||
Standard_Real GetLineWidth() const { return myDrawer->LineAspect()->Aspect()->Width(); }
|
||||
|
||||
//! Sets style of connection line.
|
||||
Standard_EXPORT void SetLineStyle( const Aspect_TypeOfLine theStyle );
|
||||
|
||||
//! Retusn style of connection line.
|
||||
Aspect_TypeOfLine GetLineStyle() const { return myDrawer->LineAspect()->Aspect()->Type(); }
|
||||
|
||||
//! Sets annotation auto-hiding option.
|
||||
//! \param theIsEnable [in] the option flag. If passed true, the annotation
|
||||
@ -156,11 +173,13 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
|
||||
void UpdatePersistence();
|
||||
|
||||
virtual void Compute( const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode = 0 ) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
virtual void ComputeSelection( const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode ) Standard_OVERRIDE;
|
||||
|
||||
virtual void SetLocalTransformation( const gp_Trsf& theTransformation ) Standard_OVERRIDE {}
|
||||
|
@ -104,7 +104,9 @@ namespace GEOM
|
||||
// texture
|
||||
"Texture", // -
|
||||
// dimensions
|
||||
"Dimensions" // -
|
||||
"Dimensions", // -
|
||||
// shape annotations
|
||||
"ShapeAnnotations" // -
|
||||
};
|
||||
return ( type >= GEOM::Visibility && type <= GEOM::LastProperty ) ? names[type] : QString();
|
||||
}
|
||||
|
@ -58,7 +58,8 @@ namespace GEOM
|
||||
OutlineColor,
|
||||
Texture,
|
||||
Dimensions,
|
||||
LastProperty = Dimensions,
|
||||
ShapeAnnotations,
|
||||
LastProperty = ShapeAnnotations,
|
||||
};
|
||||
|
||||
GEOM_OBJECT_EXPORT double minDeflection();
|
||||
|
Loading…
Reference in New Issue
Block a user