diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in
index 0256007de..72d1c700f 100755
--- a/resources/SalomeApp.xml.in
+++ b/resources/SalomeApp.xml.in
@@ -101,9 +101,9 @@
-
+
-
+
diff --git a/src/GEOMGUI/GEOMGUI_AnnotationMgr.cxx b/src/GEOMGUI/GEOMGUI_AnnotationMgr.cxx
index b77b46059..d7e8f3249 100755
--- a/src/GEOMGUI/GEOMGUI_AnnotationMgr.cxx
+++ b/src/GEOMGUI/GEOMGUI_AnnotationMgr.cxx
@@ -43,7 +43,9 @@
#include
#include
+#include
#include
+#include
#include
#include
@@ -88,8 +90,26 @@ SALOME_Prs* GEOMGUI_AnnotationMgr::CreatePresentation( const GEOMGUI_AnnotationA
setDisplayProperties( aPresentation, aView, getEntry( theObject ).c_str() );
TopoDS_Shape aShape = GEOM_Client::get_client().GetShape( GeometryGUI::GetGeomGen(), theObject );
- gp_Ax3 aShapeLCS = gp_Ax3().Transformed( aShape.Location().Transformation() );
- GEOMGUI_AnnotationAttrs::SetupPresentation( aPresentation, theProperty, aShapeLCS );
+ if ( !aShape.IsNull() ) {
+
+ gp_Ax3 aShapeLCS = gp_Ax3().Transformed( aShape.Location().Transformation() );
+
+ GEOMGUI_AnnotationAttrs::SetupPresentation( aPresentation, theProperty, aShapeLCS );
+
+ if ( theProperty.ShapeType == TopAbs_SHAPE ) {
+
+ aPresentation->SetHilightShape( aShape );
+ }
+ else if ( theProperty.ShapeIndex > 0 ) {
+
+ TopTools_IndexedMapOfShape aSubShapeMap;
+ TopExp::MapShapes( aShape, static_cast( theProperty.ShapeType ), aSubShapeMap );
+ if ( theProperty.ShapeIndex <= aSubShapeMap.Extent() ) {
+
+ aPresentation->SetHilightShape( aSubShapeMap( theProperty.ShapeIndex ) );
+ }
+ }
+ }
// add Prs to preview
SUIT_ViewWindow* vw = getApplication()->desktop()->activeWindow();
@@ -318,6 +338,43 @@ void GEOMGUI_AnnotationMgr::EraseVisibleAnnotations( const QString& theEntry, SO
myVisualized[aView] = anEntryToAnnotation;
}
+//=======================================================================
+// function : GEOMGUI_AnnotationMgr::EraseRemovedAnnotation
+// purpose : Method to update internal maps after removing an
+// annotation from the object.
+//=======================================================================
+void GEOMGUI_AnnotationMgr::EraseRemovedAnnotation( const QString& theEntry, const int theIndex )
+{
+ QMap::iterator aEntryMapIt = myVisualized.begin();
+ for ( ; aEntryMapIt != myVisualized.end(); ++aEntryMapIt ) {
+ SOCC_Viewer* aView = aEntryMapIt.key();
+ EntryToAnnotations& anEntryToAnnotation = aEntryMapIt.value();
+ if ( !anEntryToAnnotation.contains( theEntry ) )
+ continue;
+
+ AnnotationToPrs aUpdatedToPrs;
+ AnnotationToPrs& anAnnotationToPrs = anEntryToAnnotation[theEntry];
+ AnnotationToPrs::iterator anAnnotationIt = anAnnotationToPrs.begin();
+ for ( ; anAnnotationIt != anAnnotationToPrs.end(); ++anAnnotationIt ) {
+
+ const int aIndex = anAnnotationIt.key();
+ SALOME_Prs* aPrs = anAnnotationIt.value();
+ if ( aIndex > theIndex ) {
+ aUpdatedToPrs[aIndex - 1] = aPrs;
+ }
+ else if ( aIndex != theIndex ) {
+ aUpdatedToPrs[aIndex] = aPrs;
+ }
+ else {
+ ((SALOME_View*)aView)->Erase( getDisplayer(), aPrs );
+ }
+ }
+
+ anAnnotationToPrs = aUpdatedToPrs;
+ }
+ getDisplayer()->UpdateViewer();
+}
+
//=======================================================================
// function : GEOMGUI_AnnotationMgr::UpdateVisibleAnnotations
// purpose :
@@ -532,6 +589,18 @@ QString GEOMGUI_AnnotationMgr::makeAnnotationEntry( const QString& theEntry, con
return QString("%1%2%3").arg(theEntry).arg(GetEntrySeparator()).arg(theIndex);
}
+bool GEOMGUI_AnnotationMgr::getIndexFromEntry( const QString& theEntry, QString& theObjEntry, int& theIndex )
+{
+ QStringList aSplit = theEntry.split( GetEntrySeparator() );
+ if ( aSplit.size() < 2 )
+ return false;
+
+ bool isOk = true;
+ theObjEntry = aSplit.at( 0 );
+ theIndex = aSplit.at( 1 ).toInt( &isOk );
+ return isOk;
+}
+
void GEOMGUI_AnnotationMgr::getObject( const QString& theEntry, const int theIndex,
GEOM::GEOM_Object_ptr& theObject,
GEOMGUI_AnnotationAttrs::Properties& theProperty )
@@ -671,8 +740,8 @@ void GEOMGUI_AnnotationMgr::setDisplayProperties( const Handle(GEOM_Annotation)&
{
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
const QFont aFont = aResMgr->fontValue( "Geometry", "shape_annotation_font", QFont( "Y14.5M-2009", 24 ) );
- 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 QColor aFontColor = aResMgr->colorValue( "Geometry", "shape_annotation_font_color", QColor( 0, 0, 127 ) );
+ const QColor aLineColor = aResMgr->colorValue( "Geometry", "shape_annotation_line_color", QColor( 0, 0, 127 ) );
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 );
diff --git a/src/GEOMGUI/GEOMGUI_AnnotationMgr.h b/src/GEOMGUI/GEOMGUI_AnnotationMgr.h
index 44ae4313d..56a46acec 100755
--- a/src/GEOMGUI/GEOMGUI_AnnotationMgr.h
+++ b/src/GEOMGUI/GEOMGUI_AnnotationMgr.h
@@ -61,6 +61,7 @@ public:
bool IsDisplayed( const QString& theEntry, const int theIndex, SOCC_Viewer* theView = 0 ) const;
void Display( const QString& theEntry, const int theIndex, SOCC_Viewer* theView = 0 );
void Erase( const QString& theEntry, const int theIndex, SOCC_Viewer* theView = 0 );
+ void EraseRemovedAnnotation( const QString& theEntry, const int theIndex );
void Redisplay( const QString& theEntry, const int theIndex,
const GEOMGUI_AnnotationAttrs::Properties& theProperties);
void Redisplay( const QString& theEntry, const int theIndex,
@@ -87,6 +88,10 @@ public:
void storeFixedPosition( const QString& theEntry, SOCC_Viewer* theView );
+ bool getIndexFromEntry( const QString& theEntry, QString& theObjEntry, int& theIndex );
+
+ bool isAnnotationEntry( const QString& theEntry ) { return theEntry.indexOf( GetEntrySeparator() ) != -1; }
+
protected:
SalomeApp_Application* getApplication() const { return myApplication; }
diff --git a/src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx b/src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx
index 1c6b1acbf..47dd3441e 100755
--- a/src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx
+++ b/src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx
@@ -97,7 +97,9 @@ namespace
myEntry = theEntry.c_str();
myStudy = theStudy;
_PTR(SObject) aSObj = theStudy->studyDS()->FindObjectID( theEntry );
- myAttr = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
+ if ( aSObj ) {
+ myAttr = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
+ }
}
virtual int GetNumber() Standard_OVERRIDE {
return !myAttr.IsNull() ? myAttr->GetNbAnnotation() : 0;
@@ -542,6 +544,9 @@ void GEOMGUI_TextTreeWdg::showContextMenu( const QPoint& pos )
QAction* anEditAction = aModule->action(GEOMOp::OpEditAnnotation);
if ( anEditAction )
aMenu.addAction( anEditAction );
+ QAction* aDeleteAction = aModule->action(GEOMOp::OpDeleteAnnotation);
+ if ( aDeleteAction )
+ aMenu.addAction( aDeleteAction );
// Show/Hide actions
if ( aProp->GetIsVisible( idFromItem( anItem ) ) )
aMenu.addAction( myActions[GEOMOp::OpHide] );
diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts
index 722a05998..5aa4cf1e2 100755
--- a/src/GEOMGUI/GEOM_msg_en.ts
+++ b/src/GEOMGUI/GEOM_msg_en.ts
@@ -5028,6 +5028,18 @@ Please, select face, shell or solid and try again
Edit Annotation
+
+
+ Delete Annotation
+
+
+
+ Delete
+
+
+
+ Delete Annotation
+
Show dependency tree
diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx
index 9f3c4b9bd..487291674 100755
--- a/src/GEOMGUI/GeometryGUI.cxx
+++ b/src/GEOMGUI/GeometryGUI.cxx
@@ -686,6 +686,7 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
case GEOMOp::OpManageDimensions: // MENU MEASURE - MANAGE DIMENSIONS
case GEOMOp::OpAnnotation: // MENU MEASURE - ANNOTATION
case GEOMOp::OpEditAnnotation: // POPUP MENU - EDIT ANNOTATION
+ case GEOMOp::OpDeleteAnnotation: // POPUP MENU - DELETE ANNOTATION
#ifndef DISABLE_PLOT2DVIEWER
case GEOMOp::OpShapeStatistics: // MENU MEASURE - SHAPE STATISTICS
#endif
@@ -1071,6 +1072,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( GEOMOp::OpManageDimensions, "MANAGE_DIMENSIONS" );
createGeomAction( GEOMOp::OpAnnotation, "ANNOTATION" );
createGeomAction( GEOMOp::OpEditAnnotation, "EDIT_ANNOTATION" );
+ createGeomAction( GEOMOp::OpDeleteAnnotation, "DELETE_ANNOTATION" );
createGeomAction( GEOMOp::OpTolerance, "TOLERANCE" );
createGeomAction( GEOMOp::OpWhatIs, "WHAT_IS" );
@@ -1622,6 +1624,8 @@ void GeometryGUI::initialize( CAM_Application* app )
mgr->insert( action( GEOMOp::OpEditAnnotation ), -1, -1 ); // edit annotation
mgr->setRule( action( GEOMOp::OpEditAnnotation ), QString("($component={'GEOM'}) and type='Shape' and selcount=1"), QtxPopupMgr::VisibleRule );
+ mgr->insert( action( GEOMOp::OpDeleteAnnotation ), -1, -1 ); // delete annotation
+ mgr->setRule( action( GEOMOp::OpDeleteAnnotation ), QString("($component={'GEOM'}) and type='Shape' and selcount=1"), QtxPopupMgr::VisibleRule );
mgr->insert( separator(), -1, -1 ); // -----------
QString canDisplay = "($component={'GEOM'}) and (selcount>0) and ({true} in $canBeDisplayed) ",
@@ -2847,13 +2851,21 @@ void GeometryGUI::preferencesChanged( const QString& section, const QString& par
SALOME_ListIO aVisible;
aViewer->GetVisible( aVisible );
- aDisplayer.Redisplay( aVisible, false, aViewer );
- GEOMGUI_AnnotationMgr* aAnnotationMgr = GetAnnotationMgr();
- SALOME_ListIteratorOfListIO Iter( aVisible );
- for ( ; Iter.More(); Iter.Next() ) {
- aAnnotationMgr->DisplayVisibleAnnotations( QString(Iter.Value()->getEntry()), aViewer );
+ GEOMGUI_AnnotationMgr* anAnnotationMgr = GetAnnotationMgr();
+ if ( anAnnotationMgr ) {
+ SALOME_ListIteratorOfListIO anIter( aVisible );
+ while ( anIter.More() ) {
+ if ( anAnnotationMgr->isAnnotationEntry( anIter.Value()->getEntry() ) ) {
+ aVisible.Remove( anIter );
+ }
+ else {
+ anIter.Next();
+ }
+ }
}
+
+ aDisplayer.Redisplay( aVisible, false, aViewer );
}
if ( param == QString( "label_color" ) ) {
ViewManagerList aVMsVTK;
diff --git a/src/GEOMGUI/GeometryGUI_Operations.h b/src/GEOMGUI/GeometryGUI_Operations.h
old mode 100644
new mode 100755
index caa75d779..da8ae797e
--- a/src/GEOMGUI/GeometryGUI_Operations.h
+++ b/src/GEOMGUI/GeometryGUI_Operations.h
@@ -211,6 +211,7 @@ namespace GEOMOp {
OpEditAnnotation = 5021, // POPUP MENU - EDIT ANNOTATION
OpShowAllAnnotations = 5022, // POPUP MENU - SHOW ALL ANNOTATIONS
OpHideAllAnnotations = 5023, // POPUP MENU - HIDE ALL ANNOTATIONS
+ OpDeleteAnnotation = 5024, // POPUP MENU - DELETE ANNOTATION
// GroupGUI --------------------//--------------------------------
OpGroupCreate = 6000, // MENU GROUP - CREATE
OpGroupEdit = 6001, // MENU GROUP - EDIT
diff --git a/src/MeasureGUI/MeasureGUI.cxx b/src/MeasureGUI/MeasureGUI.cxx
index d9ad2c7f0..ea9758c95 100755
--- a/src/MeasureGUI/MeasureGUI.cxx
+++ b/src/MeasureGUI/MeasureGUI.cxx
@@ -169,6 +169,9 @@ bool MeasureGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
case GEOMOp::OpHideAllAnnotations:
ChangeAnnotationsVisibility( false );
break; // HIDE ALL ANNOTATIONS
+ case GEOMOp::OpDeleteAnnotation:
+ DeleteAnnotation();
+ break; // DELETE ANNOTATIOn
default:
app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
break;
@@ -232,16 +235,16 @@ void MeasureGUI::ChangeAnnotationsVisibility( const bool theIsVisible )
|| !anIObject->hasEntry() )
return;
- const QString aEntry = anIObject->getEntry(),c_str();
+ const QString aEntry = anIObject->getEntry();
- _PTR(SObject) aSObj = anActiveStudy->studyDS()->FindObjectID( aEntry.toStdString() );
+ _PTR(SObject) aSObj = anActiveStudy->studyDS()->FindObjectID( aEntry.toStdString() );
- const Handle(GEOMGUI_AnnotationAttrs)
- aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
+ const Handle(GEOMGUI_AnnotationAttrs)
+ aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
- if ( aShapeAnnotations.IsNull() ) {
- return;
- }
+ if ( aShapeAnnotations.IsNull() ) {
+ return;
+ }
const int aCount = aShapeAnnotations->GetNbAnnotation();
@@ -258,6 +261,52 @@ void MeasureGUI::ChangeAnnotationsVisibility( const bool theIsVisible )
getGeometryGUI()->GetAnnotationMgr()->Display( aEntry , anI );
}
}
+
+ getGeometryGUI()->emitAnnotationsUpdated( aEntry );
+ }
+}
+
+//=======================================================================
+// function : DeleteAnnotation
+// purpose :
+//=======================================================================
+void MeasureGUI::DeleteAnnotation()
+{
+ SalomeApp_Application* anApp = getGeometryGUI()->getApp();
+ if ( !anApp )
+ return;
+
+ SalomeApp_Study* anActiveStudy = dynamic_cast( anApp->activeStudy() );
+ if ( !anActiveStudy )
+ return;
+
+ Handle(SALOME_InteractiveObject) anIObject = getSingleSelectedIO();
+ if ( anIObject.IsNull()
+ || !anIObject->hasEntry() )
+ return;
+
+ const QString aEntry = anIObject->getEntry();
+
+ QString aObjEntry;
+
+ int aIndex = 0;
+
+ if ( getGeometryGUI()->GetAnnotationMgr()->getIndexFromEntry( aEntry, aObjEntry, aIndex ) )
+ {
+ _PTR(SObject) aSObj = anActiveStudy->studyDS()->FindObjectID( aObjEntry.toStdString() );
+
+ const Handle(GEOMGUI_AnnotationAttrs)
+ aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
+
+ if ( aShapeAnnotations.IsNull() ) {
+ return;
+ }
+
+ aShapeAnnotations->Remove( aIndex );
+
+ getGeometryGUI()->GetAnnotationMgr()->EraseRemovedAnnotation( aObjEntry, aIndex );
+
+ getGeometryGUI()->emitAnnotationsUpdated( aObjEntry );
}
}
diff --git a/src/MeasureGUI/MeasureGUI.h b/src/MeasureGUI/MeasureGUI.h
old mode 100644
new mode 100755
index 03a3bf51c..524225a39
--- a/src/MeasureGUI/MeasureGUI.h
+++ b/src/MeasureGUI/MeasureGUI.h
@@ -60,6 +60,9 @@ public:
// Show/hide all shape annotations created for GEOM object
void ChangeAnnotationsVisibility( const bool theIsVisible );
+ // Deletes the selected annotation
+ void DeleteAnnotation();
+
private:
// Returns selected interactive object for single selection
Handle(SALOME_InteractiveObject) getSingleSelectedIO();
diff --git a/src/MeasureGUI/MeasureGUI_AnnotationDlg.cxx b/src/MeasureGUI/MeasureGUI_AnnotationDlg.cxx
index d6dfb03bc..62020ff9c 100755
--- a/src/MeasureGUI/MeasureGUI_AnnotationDlg.cxx
+++ b/src/MeasureGUI/MeasureGUI_AnnotationDlg.cxx
@@ -326,6 +326,14 @@ void MeasureGUI_AnnotationDlg::Init()
myGeomGUI->GetAnnotationMgr()->SetPreviewStyle( myEditAnnotationEntry, myEditAnnotationIndex, true );
+ SalomeApp_Application* anApp = myGeomGUI->getApp();
+ if ( anApp )
+ {
+ OCCViewer_ViewManager* aVM = (OCCViewer_ViewManager*)anApp->getViewManager( OCCViewer_Viewer::Type(), false );
+ OCCViewer_Viewer* aViewer = (OCCViewer_Viewer*)aVM->getViewModel();
+ aViewer->unHighlightAll( true, true );
+ }
+
redisplayPreview();
}
}
@@ -759,6 +767,8 @@ bool MeasureGUI_AnnotationDlg::execute()
erasePreview( true );
+ globalSelection( myGeomGUI->getLocalSelectionMode() , true );
+
myGeomGUI->GetAnnotationMgr()->Display( myShape->GetStudyEntry(), aShapeAnnotations->GetNbAnnotation()-1 );
}
else {
diff --git a/src/MeasureGUI/MeasureGUI_AnnotationInteractor.cxx b/src/MeasureGUI/MeasureGUI_AnnotationInteractor.cxx
index b7bb34729..2d0cd204a 100755
--- a/src/MeasureGUI/MeasureGUI_AnnotationInteractor.cxx
+++ b/src/MeasureGUI/MeasureGUI_AnnotationInteractor.cxx
@@ -249,13 +249,8 @@ bool MeasureGUI_AnnotationInteractor::eventFilter( QObject* theObject, QEvent* t
mySelection.Append( anAISContext->SelectedOwner() );
}
- if ( anAISContext->IsHilighted( myActiveIO ) )
- {
- anAISContext->Unhilight( myActiveIO, Standard_False );
- }
-
anAISContext->ClearSelected( Standard_False );
- anAISContext->AddOrRemoveSelected( aDetected );
+ anAISContext->Unhilight( myActiveIO, Standard_True );
myActiveViewPort = aViewPort;
myActiveViewPort->grabMouse();
diff --git a/src/OBJECT/GEOM_Annotation.cxx b/src/OBJECT/GEOM_Annotation.cxx
index 8a0a0b1c9..71d92ddfd 100755
--- a/src/OBJECT/GEOM_Annotation.cxx
+++ b/src/OBJECT/GEOM_Annotation.cxx
@@ -46,6 +46,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -207,6 +208,22 @@ void GEOM_Annotation::SetAttachPoint( const gp_Pnt& thePoint )
myAttach = thePoint;
}
+// =======================================================================
+// function : SetHilightShape
+// purpose : Sets shape (annotated shape) that will be used for hilighting.
+// =======================================================================
+void GEOM_Annotation::SetHilightShape( const TopoDS_Shape& theShape )
+{
+ if ( myShape.IsEqual( theShape ) )
+ {
+ return;
+ }
+
+ myShape = theShape;
+ SetToUpdate();
+ UpdateSelection();
+}
+
// =======================================================================
// function : SetColor
// purpose :
@@ -505,7 +522,7 @@ void GEOM_Annotation::ComputeSelection( const Handle(SelectMgr_Selection)& theSe
aBox = aBox.Transformed( aOffset2d );
}
- const Handle(GEOM_AnnotationOwner) anEntityOwner = new GEOM_AnnotationOwner( this, 10 );
+ const Handle(GEOM_AnnotationOwner) anEntityOwner = new GEOM_AnnotationOwner( myShape, this, 10 );
const Handle(GEOM_AnnotationSensEntity) aSensitive =
new GEOM_AnnotationSensEntity( anEntityOwner, aBox, myIsDepthCulling );
@@ -866,5 +883,60 @@ void GEOM_Annotation::GEOM_AnnotationOwner::HilightWithColor( const Handle(PrsMg
const Handle(Graphic3d_HighlightStyle)& theStyle,
const Standard_Integer theMode )
{
+ if ( myPrsSh.IsNull() )
+ {
+ Handle(Prs3d_Drawer) aDrawer = new Prs3d_Drawer;
+ aDrawer->Link( Selectable()->HilightAttributes() );
+
+ Handle(Prs3d_IsoAspect) aUIsoAspect = new Prs3d_IsoAspect(
+ aDrawer->UIsoAspect()->Aspect()->Color(),
+ aDrawer->UIsoAspect()->Aspect()->Type(),
+ aDrawer->UIsoAspect()->Aspect()->Width(), 0 );
+
+ Handle(Prs3d_IsoAspect) aVIsoAspect = new Prs3d_IsoAspect(
+ aDrawer->UIsoAspect()->Aspect()->Color(),
+ aDrawer->UIsoAspect()->Aspect()->Type(),
+ aDrawer->UIsoAspect()->Aspect()->Width(), 0 );
+
+ aDrawer->SetIsoOnPlane( Standard_False );
+ aDrawer->SetUIsoAspect( aUIsoAspect );
+ aDrawer->SetVIsoAspect( aVIsoAspect );
+ myPrsSh = new StdSelect_Shape( myShape, aDrawer );
+ }
+
+ myPrsSh->SetZLayer ( Selectable()->ZLayer() );
+
thePM->Color( Selectable(), theStyle, theMode, NULL, Selectable()->ZLayer() );
+ thePM->Color( myPrsSh, theStyle, theMode, Selectable(), Graphic3d_ZLayerId_Topmost );
+}
+
+// =======================================================================
+// subclass : GEOM_AnnotationOwner
+// function : Unhilight
+// purpose : Removes highlighting from the type of shape.
+// =======================================================================
+void GEOM_Annotation::GEOM_AnnotationOwner::Unhilight ( const Handle(PrsMgr_PresentationManager)& thePM,
+ const Standard_Integer theMode )
+{
+ SelectMgr_EntityOwner::Unhilight( thePM, theMode );
+
+ thePM->Unhighlight( myPrsSh, theMode );
+}
+
+// =======================================================================
+// subclass : GEOM_AnnotationOwner
+// function : Clear
+// purpose : Clears the presentation manager object aPM of all shapes
+// with the given selection mode.
+// =======================================================================
+void GEOM_Annotation::GEOM_AnnotationOwner::Clear ( const Handle(PrsMgr_PresentationManager)& thePM,
+ const Standard_Integer theMode )
+{
+ SelectMgr_EntityOwner::Clear( thePM, theMode );
+
+ if ( !myPrsSh.IsNull() ) {
+ thePM->Clear( myPrsSh, theMode );
+ }
+
+ myPrsSh.Nullify();
}
diff --git a/src/OBJECT/GEOM_Annotation.hxx b/src/OBJECT/GEOM_Annotation.hxx
index 2fec2aaa3..ac8bf3a2f 100755
--- a/src/OBJECT/GEOM_Annotation.hxx
+++ b/src/OBJECT/GEOM_Annotation.hxx
@@ -41,6 +41,7 @@
#include
#include
#include
+#include
#include
class OpenGl_GraphicDriver;
@@ -121,6 +122,12 @@ public:
//! Returns attachment point of extension line.
const gp_Pnt& GetAttachPoint() const { return myAttach; }
+ //! Sets shape (annotated shape) that will be used for hilighting.
+ Standard_EXPORT void SetHilightShape( const TopoDS_Shape& theShape );
+
+ //! Returns the hilighting shape.
+ const TopoDS_Shape HilightShape() const { return myShape; }
+
public:
//! Sets color for the presentation.
@@ -279,6 +286,7 @@ private:
Standard_Boolean myIsDepthCulling; //!< Flag indiciating whether the "depth culling" is turned on.
HighlightMode myHilightMode; //!< Highlight mode for presentation.
TCollection_ExtendedString myText; //!< Text string of the label presentation.
+ TopoDS_Shape myShape; //!< Hilighting shape.
private:
@@ -341,9 +349,11 @@ public:
public:
//! Constructor.
- GEOM_AnnotationOwner( const Handle(SelectMgr_SelectableObject)& theSelectable,
- const Standard_Integer thePriority = 0 )
- : SelectMgr_EntityOwner( theSelectable, thePriority ) {}
+ GEOM_AnnotationOwner( const TopoDS_Shape& theShape,
+ const Handle(SelectMgr_SelectableObject)& theSelectable,
+ const Standard_Integer thePriority )
+ : SelectMgr_EntityOwner( theSelectable, thePriority ),
+ myShape( theShape ) {}
//! Perform highlighting of the presentation.
//! \param thePresentationMgr [in] the presentation manager.
@@ -353,6 +363,22 @@ public:
HilightWithColor( const Handle(PrsMgr_PresentationManager3d)& thePM,
const Handle(Graphic3d_HighlightStyle)& theStyle,
const Standard_Integer theMode = 0 ) Standard_OVERRIDE;
+
+ //! Removes highlighting from the type of shape.
+ virtual void
+ Unhilight ( const Handle(PrsMgr_PresentationManager)& thePM,
+ const Standard_Integer theMode = 0 ) Standard_OVERRIDE;
+
+ //! Clears the presentation manager object aPM of all shapes
+ //! with the given selection mode.
+ virtual void
+ Clear ( const Handle(PrsMgr_PresentationManager)& thePM,
+ const Standard_Integer theMode = 0 ) Standard_OVERRIDE;
+
+ private:
+
+ TopoDS_Shape myShape;
+ Handle(StdSelect_Shape) myPrsSh;
};
//! Custom sensitive entity with implementing option to support selection