#include <GEOMGUI_AnnotationAttrs.h>
#include <GEOM_Annotation.hxx>
#include <GEOM_Client.hxx>
+#include <GEOM_Constants.h>
#include <GEOM_Displayer.h>
+
#include <GeometryGUI.h>
#include <SalomeApp_Application.h>
//================================================================
SALOME_Prs* GEOMGUI_AnnotationMgr::CreatePresentation( const GEOMGUI_AnnotationAttrs::Properties& theProperty,
GEOM::GEOM_Object_ptr theObject,
+ SALOME_View* theView,
const QString& theEntry )
{
Handle ( GEOM_Annotation ) aPresentation = new GEOM_Annotation();
gp_Ax3 aShapeLCS = gp_Ax3().Transformed( aShape.Location().Transformation() );
GEOMGUI_AnnotationAttrs::SetupPresentation( aPresentation, theProperty, aShapeLCS );
+ SALOME_View* aView = viewOrActiveView( theView );
+ if ( aView ) {
+
+ // set top-level flag correspondingly
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApplication()->activeStudy() );
+ int aMgrId = dynamic_cast< SUIT_ViewModel* >( aView )->getViewManager()->getGlobalId();
+ QVariant aVal = aStudy->getObjectProperty( aMgrId, QString( getEntry( theObject ).c_str() ), GEOM::propertyName( GEOM::TopLevel ), QVariant() );
+ bool isBringToFront = aVal.isValid() ? aVal.toBool() : false;
+ if( isBringToFront ) {
+ aPresentation->SetZLayer( Graphic3d_ZLayerId_Topmost );
+ }
+ }
+
// add Prs to preview
SUIT_ViewWindow* vw = getApplication()->desktop()->activeWindow();
SOCC_Prs* aPrs =
// display presentation in the viewer
QString anEntry = QString("%1%2%3").arg(theEntry).arg(GetEntrySeparator()).arg(theIndex);
- SALOME_Prs* aPrs = CreatePresentation( aProperty, anObject, anEntry );
+ SALOME_Prs* aPrs = CreatePresentation( aProperty, anObject, aView, anEntry );
aView->Display( getDisplayer(), aPrs );
getDisplayer()->UpdateViewer();
myVisualized[aView] = anEntryToMap;
// change persistent for the entry: set visible state in true for indices which presentations are shown
- storeVisibleState( theEntry, theView, theIndex );
+ storeVisibleState( theEntry, theView );
}
void GEOMGUI_AnnotationMgr::Erase( const QString& theEntry, const int theIndex, SALOME_View* theView )
myVisualized[aView] = anEntryToAnnotation;
// change persistent for the entry: set visible state in true for indices which presentations are shown
- storeVisibleState( theEntry, theView, theIndex );
+ storeVisibleState( theEntry, theView );
}
void GEOMGUI_AnnotationMgr::DisplayVisibleAnnotations( const QString& theEntry, SALOME_View* theView )
const Handle(GEOMGUI_AnnotationAttrs) aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
if ( !aShapeAnnotations.IsNull() ) {
const int aCount = aShapeAnnotations->GetNbAnnotation();
+ std::vector<bool> isVisible( aCount );
for ( int anIndex = 0; anIndex < aCount; ++anIndex )
{
- if ( aShapeAnnotations->GetIsVisible( anIndex ) )
+ isVisible[anIndex] = aShapeAnnotations->GetIsVisible( anIndex );
+ }
+ for ( int anIndex = 0; anIndex < aCount; ++anIndex )
+ {
+ if ( isVisible[anIndex] )
Display( theEntry, anIndex, theView );
}
}
}
}
-void GEOMGUI_AnnotationMgr::storeVisibleState( const QString& theEntry, SALOME_View* theView, const int theIndex )
+void GEOMGUI_AnnotationMgr::storeVisibleState( const QString& theEntry, SALOME_View* theView )
{
SALOME_View* aView = viewOrActiveView( theView );
if ( !aView || !myVisualized.contains( aView ) )
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApplication()->activeStudy() );
_PTR(SObject) aSObj = aStudy->studyDS()->FindObjectID( theEntry.toStdString() );
const Handle(GEOMGUI_AnnotationAttrs) aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
- if ( !aShapeAnnotations.IsNull() ) {
-
- bool aVisible = anAnnotationToPrs.contains( theIndex );
- aShapeAnnotations->SetIsVisible( theIndex, aVisible );
+ if ( !aShapeAnnotations.IsNull() ) {\r
+ const int aCount = aShapeAnnotations->GetNbAnnotation();\r
+ for ( int anIndex = 0; anIndex < aCount; ++anIndex ) {\r
+ bool aVisible = anAnnotationToPrs.contains( anIndex );\r
+ aShapeAnnotations->SetIsVisible( anIndex, aVisible );\r
+ }\r
}
}
-
//=======================================================================
// function : GEOMGUI_AnnotationMgr::getEntry
// purpose :
#include <SALOME_InteractiveObject.hxx>
class SalomeApp_Application;
-class GEOM_Annotation;
class GEOM_Displayer;
/*!
static QString GetEntrySeparator();
SALOME_Prs* CreatePresentation( const GEOMGUI_AnnotationAttrs::Properties& theProperty,
- GEOM::GEOM_Object_ptr theObject, const QString& theEntry = QString() );
+ GEOM::GEOM_Object_ptr theObject,
+ SALOME_View* theView = 0,
+ const QString& theEntry = QString() );
bool IsDisplayed( const QString& theEntry, const int theIndex, SALOME_View* theView = 0 ) const;
void Display( const QString& theEntry, const int theIndex, SALOME_View* theView = 0 );
GEOM::GEOM_Object_ptr& anObject,
GEOMGUI_AnnotationAttrs::Properties& aProperty );
- void storeVisibleState( const QString& theEntry, SALOME_View* theView, const int theIndex );
+ void storeVisibleState( const QString& theEntry, SALOME_View* theView );
std::string getEntry( const GEOM::GEOM_Object_ptr theObject );
std::string getName( const GEOM::GEOM_Object_ptr theObject );
- void setAISProperties( const Handle(GEOM_Annotation)& thePresentation,
- const GEOMGUI_AnnotationAttrs::Properties& theProperty,
- const gp_Ax3& theLCS );
-
private:
SalomeApp_Application* myApplication;
#include <GEOMGUI_DimensionProperty.h>
#include <GEOMGUI_AnnotationAttrs.h>
+#include <GEOMGUI_AnnotationMgr.h>
#include <LightApp_SelectionMgr.h>
#include <SUIT_OverrideCursor.h>
|| !anIObject->hasEntry() )
return;
- _PTR(SObject) aSObj = anActiveStudy->studyDS()->FindObjectID( anIObject->getEntry() );\r
+ const QString aEntry = anIObject->getEntry(),c_str();
+
+ _PTR(SObject) aSObj = anActiveStudy->studyDS()->FindObjectID( aEntry.toStdString() );\r
const Handle(GEOMGUI_AnnotationAttrs)\r
aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );\r
- if ( aShapeAnnotations.IsNull() )\r
+ if ( aShapeAnnotations.IsNull() ) {\r
return;\r
+ }\r
const int aCount = aShapeAnnotations->GetNbAnnotation();
for ( int anI = 0; anI <= aCount; ++anI ) {
- aShapeAnnotations->SetIsVisible( anI, theIsVisible );
+ if ( !theIsVisible ) {
+ getGeometryGUI()->GetAnnotationMgr()->Erase( aEntry, anI );
+ }
+ else {
+ getGeometryGUI()->GetAnnotationMgr()->Display( aEntry , anI );
+ }
}
-
- GEOM_Displayer( anActiveStudy ).Redisplay( anIObject, true );
}
}