Bug in edit mode when switching 2D/3D.
Preview for edit mode.
#include <SUIT_ViewManager.h>
#include <SOCC_Prs.h>
-#include <SOCC_ViewModel.h>
#include <SOCC_ViewWindow.h>
#include <Quantity_Color.hxx>
//================================================================
SALOME_Prs* GEOMGUI_AnnotationMgr::CreatePresentation( const GEOMGUI_AnnotationAttrs::Properties& theProperty,
GEOM::GEOM_Object_ptr theObject,
- SALOME_View* theView,
+ SOCC_Viewer* theView,
const QString& theEntry )
{
+ SOCC_Viewer* aView = viewOrActiveView( theView );
+ if ( !aView ) {
+ return NULL;
+ }
+
Handle ( GEOM_Annotation ) aPresentation = new GEOM_Annotation();
if ( !theEntry.isEmpty() ) {
// owner should be set to provide selection mechanizm
aPresentation->SetIsScreenFixed( theProperty.IsScreenFixed );
- setDisplayProperties( aPresentation, theView, getEntry( theObject ).c_str() );
+ 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() );
// add Prs to preview
SUIT_ViewWindow* vw = getApplication()->desktop()->activeWindow();
SOCC_Prs* aPrs =
- dynamic_cast<SOCC_Prs*>( ( ( SOCC_Viewer* ) ( vw->getViewManager()->getViewModel() ) )->CreatePrs(
- 0 ) );
+ dynamic_cast<SOCC_Prs*>( ( aView )->CreatePrs( 0 ) );
if ( aPrs )
aPrs->AddObject( aPresentation );
return aPrs;
}
-bool GEOMGUI_AnnotationMgr::IsDisplayed( const QString& theEntry, const int theIndex, SALOME_View* theView ) const
+bool GEOMGUI_AnnotationMgr::IsDisplayed( const QString& theEntry, const int theIndex, SOCC_Viewer* theView ) const
{
- SALOME_View* aView = viewOrActiveView( theView );
+ SOCC_Viewer* aView = viewOrActiveView( theView );
if ( !aView || !myVisualized.contains( aView ) )
return false;
// purpose : Displays annotation shape presentation in view. It creates an annotation presentation
// and stores it in an internal container
//=======================================================================
-void GEOMGUI_AnnotationMgr::Display( const QString& theEntry, const int theIndex, SALOME_View* theView )
+void GEOMGUI_AnnotationMgr::Display( const QString& theEntry, const int theIndex, SOCC_Viewer* theView )
{
- SALOME_View* aView = viewOrActiveView( theView );
+ SOCC_Viewer* aView = viewOrActiveView( theView );
if ( !aView )
return;
// display presentation in the viewer
QString anEntry = QString("%1%2%3").arg(theEntry).arg(GetEntrySeparator()).arg(theIndex);
SALOME_Prs* aPrs = CreatePresentation( aProperty, anObject, aView, anEntry );
- aView->Display( getDisplayer(), aPrs );
+ ((SALOME_View*)aView)->Display( getDisplayer(), aPrs );
getDisplayer()->UpdateViewer();
EntryToAnnotations anEntryToMap;
SUIT_ViewModel* vmodel = vman->getViewModel();
if ( vmodel )
{
- SALOME_View* aView = dynamic_cast<SALOME_View*>(vmodel);
+ SOCC_Viewer* aView = dynamic_cast<SOCC_Viewer*>(vmodel);
if ( aView )
Redisplay( theEntry, theIndex, theProperty, aView );
}
void GEOMGUI_AnnotationMgr::Redisplay( const QString& theEntry, const int theIndex,
const GEOMGUI_AnnotationAttrs::Properties& theProperty,
- SALOME_View* theView )
+ SOCC_Viewer* theView )
{
- SALOME_View* aView = viewOrActiveView( theView );
+ SOCC_Viewer* aView = viewOrActiveView( theView );
if ( !aView )
return;
// erase presentation from the viewer
SALOME_Prs* aPrs = anAnnotationToPrs[theIndex];
SOCC_Prs* anOCCPrs = dynamic_cast<SOCC_Prs*>( aPrs );
- SOCC_Viewer* anOCCViewer = dynamic_cast<SOCC_Viewer*>(theView);
- if ( anOCCPrs && anOCCViewer ) {
+ if ( anOCCPrs ) {
AIS_ListOfInteractive anIOs;
anOCCPrs->GetObjects( anIOs );
AIS_ListIteratorOfListOfInteractive anIter( anIOs );
Handle(GEOM_Annotation) aPresentation = Handle(GEOM_Annotation)::DownCast( aPrs );
GEOMGUI_AnnotationAttrs::SetupPresentation( aPresentation, theProperty, aShapeLCS );
- anOCCViewer->getAISContext()->Redisplay(aPresentation);
+ aView->getAISContext()->Redisplay( aPresentation );
}
}
}
-void GEOMGUI_AnnotationMgr::Erase( const QString& theEntry, const int theIndex, SALOME_View* theView )
+void GEOMGUI_AnnotationMgr::Erase( const QString& theEntry, const int theIndex, SOCC_Viewer* theView )
{
- SALOME_View* aView = viewOrActiveView( theView );
+ SOCC_Viewer* aView = viewOrActiveView( theView );
if ( !aView )
return;
// erase presentation from the viewer
SALOME_Prs* aPrs = anAnnotationToPrs[theIndex];
- aView->Erase( getDisplayer(), aPrs );
+ ((SALOME_View*)aView)->Erase( getDisplayer(), aPrs );
getDisplayer()->UpdateViewer();
// remove displayed parameters from an internal container
storeVisibleState( theEntry, theView );
}
-void GEOMGUI_AnnotationMgr::DisplayVisibleAnnotations( const QString& theEntry, SALOME_View* theView )
+void GEOMGUI_AnnotationMgr::DisplayVisibleAnnotations( const QString& theEntry, SOCC_Viewer* theView )
{
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApplication()->activeStudy() );
_PTR(SObject) aSObj = aStudy->studyDS()->FindObjectID( theEntry.toStdString() );
}
}
-void GEOMGUI_AnnotationMgr::EraseVisibleAnnotations( const QString& theEntry, SALOME_View* theView )
+void GEOMGUI_AnnotationMgr::EraseVisibleAnnotations( const QString& theEntry, SOCC_Viewer* theView )
{
- SALOME_View* aView = viewOrActiveView( theView );
+ SOCC_Viewer* aView = viewOrActiveView( theView );
if ( !myVisualized.contains( aView ) )
return;
// erase presentation from the viewer
SALOME_Prs* aPrs = anAnnotationToPrs[anIndex];
- aView->Erase( getDisplayer(), aPrs );
+ ((SALOME_View*)aView)->Erase( getDisplayer(), aPrs );
}
getDisplayer()->UpdateViewer();
anEntryToAnnotation.remove( theEntry );
// function : GEOMGUI_AnnotationMgr::UpdateVisibleAnnotations
// purpose :
//=======================================================================
-void GEOMGUI_AnnotationMgr::UpdateVisibleAnnotations( const QString& theEntry, SALOME_View* theView )
+void GEOMGUI_AnnotationMgr::UpdateVisibleAnnotations( const QString& theEntry, SOCC_Viewer* theView )
{
- SALOME_View* aView = viewOrActiveView( theView );
+ SOCC_Viewer* aView = viewOrActiveView( theView );
if ( !myVisualized.contains( aView ) )
return;
getDisplayer()->UpdateViewer();
}
+void GEOMGUI_AnnotationMgr::SetPreviewStyle( const QString& theEntry, const int theIndex, const bool theIsPreview )
+{
+ SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+ 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 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 );
+
+ QMap<SOCC_Viewer*, EntryToAnnotations>::Iterator aViewIt = myVisualized.begin();
+ for (; aViewIt != myVisualized.end(); ++aViewIt ) {
+
+ Handle(GEOM_Annotation) aPresentation = getAISPresentation ( theEntry, theIndex, aViewIt.key() );
+ if ( aPresentation.IsNull() ) {
+ continue;
+ }
+
+ if ( theIsPreview ) {
+ aPresentation->SetTextColor( Quantity_NOC_VIOLET );
+ aPresentation->SetLineColor( Quantity_NOC_VIOLET );
+ aPresentation->SetDepthCulling( Standard_False );
+ }
+ else {
+ aPresentation->SetTextColor( aOcctFontColor );
+ aPresentation->SetLineColor( aOcctLineColor );
+ aPresentation->SetDepthCulling( Standard_True );
+ }
+ }
+ getDisplayer()->UpdateViewer();
+}
+
Handle(SALOME_InteractiveObject) GEOMGUI_AnnotationMgr::FindInteractiveObject( const QString& theEntry,
const int theIndex,
- SALOME_View* theView ) const
+ SOCC_Viewer* theView ) const
{
Handle(SALOME_InteractiveObject) anIO;
- SALOME_View* aView = viewOrActiveView( theView );
+ SOCC_Viewer* aView = viewOrActiveView( theView );
if ( !myVisualized.contains( aView ) )
return anIO;
for ( ; anIter.More() && anIO.IsNull(); anIter.Next() ) {
Handle(AIS_InteractiveObject) aPrs = anIter.Value();
if ( aPrs->GetOwner() )
- anIO = Handle(SALOME_InteractiveObject)::DownCast(aPrs->GetOwner());
+ anIO = Handle(SALOME_InteractiveObject)::DownCast( aPrs->GetOwner() );
}
return anIO;
}
int GEOMGUI_AnnotationMgr::FindAnnotationIndex( Handle(SALOME_InteractiveObject) theIO,
- SALOME_View* theView )
+ SOCC_Viewer* theView )
{
int anIndex = -1;
- SALOME_View* aView = viewOrActiveView( theView );
+ SOCC_Viewer* aView = viewOrActiveView( theView );
if ( !myVisualized.contains( aView ) )
return anIndex;
// function : GEOMGUI_AnnotationMgr::RemoveView
// purpose :
//=======================================================================
-void GEOMGUI_AnnotationMgr::RemoveView( SALOME_View* theView )
+void GEOMGUI_AnnotationMgr::RemoveView( SOCC_Viewer* theView )
{
if ( !theView && myVisualized.contains( theView ) )
myVisualized.remove( theView );
}
-QString GEOMGUI_AnnotationMgr::getDisplayedIndicesInfo( const QString& theEntry, SALOME_View* theView ) const
+QString GEOMGUI_AnnotationMgr::getDisplayedIndicesInfo( const QString& theEntry, SOCC_Viewer* theView ) const
{
QString aDisplayedIndices;
return aDisplayedIndices;
}
-void GEOMGUI_AnnotationMgr::setDisplayedIndicesInfo( const QString& theEntry, SALOME_View* theView,
+void GEOMGUI_AnnotationMgr::setDisplayedIndicesInfo( const QString& theEntry, SOCC_Viewer* theView,
const QString theIndicesInfo )
{
if ( theIndicesInfo.isEmpty() )
return dynamic_cast<GEOM_Displayer*>( aModule->displayer() );
}
-SALOME_View* GEOMGUI_AnnotationMgr::viewOrActiveView(SALOME_View* theView) const
+SOCC_Viewer* GEOMGUI_AnnotationMgr::viewOrActiveView( SOCC_Viewer* theView ) const
{
- if ( theView ) {
- return dynamic_cast<SOCC_Viewer*>( theView );
- }
- else {
+ SOCC_Viewer* aView = theView;
+ if ( !aView ) {
SalomeApp_Application* anApp = getApplication();
SUIT_ViewWindow* anActiveWindow = anApp->desktop()->activeWindow();
if ( anActiveWindow ) {
- return dynamic_cast<SOCC_Viewer*>( anActiveWindow->getViewManager()->getViewModel() );
+ aView = dynamic_cast<SOCC_Viewer*>( anActiveWindow->getViewManager()->getViewModel() );
}
}
- return NULL;
+ return aView;
+}
+
+QString GEOMGUI_AnnotationMgr::makeAnnotationEntry( const QString& theEntry, const int theIndex )
+{
+ return QString("%1%2%3").arg(theEntry).arg(GetEntrySeparator()).arg(theIndex);
}
void GEOMGUI_AnnotationMgr::getObject( const QString& theEntry, const int theIndex,
}
}
-void GEOMGUI_AnnotationMgr::storeVisibleState( const QString& theEntry, SALOME_View* theView )
+void GEOMGUI_AnnotationMgr::storeVisibleState( const QString& theEntry, SOCC_Viewer* theView )
{
- SALOME_View* aView = viewOrActiveView( theView );
+ SOCC_Viewer* aView = viewOrActiveView( theView );
if ( !aView || !myVisualized.contains( aView ) )
return;
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() ) {\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
+ if ( !aShapeAnnotations.IsNull() ) {
+ const int aCount = aShapeAnnotations->GetNbAnnotation();
+ for ( int anIndex = 0; anIndex < aCount; ++anIndex ) {
+ bool aVisible = anAnnotationToPrs.contains( anIndex );
+ aShapeAnnotations->SetIsVisible( anIndex, aVisible );
+ }
}
}
// purpose :
//=======================================================================
void GEOMGUI_AnnotationMgr::setDisplayProperties( const Handle(GEOM_Annotation)& thePrs,
- SALOME_View* theView,
+ SOCC_Viewer* theView,
const QString& theEntry )
{
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
thePrs->SetLineWidth( aLineWidth );
thePrs->SetLineStyle( static_cast<Aspect_TypeOfLine>( aLineStyle ) );
thePrs->SetAutoHide( isAutoHide ? Standard_True : Standard_False );
+ thePrs->SetDepthCulling( Standard_True );
- SALOME_View* aView = viewOrActiveView( theView );
+ SOCC_Viewer* aView = viewOrActiveView( theView );
if ( aView && !theEntry.isEmpty() ) {
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApplication()->activeStudy() );
thePrs->SetDefaultZLayer();
}
}
+
+//=======================================================================
+// function : GEOMGUI_AnnotationMgr::getAISPresentation
+// purpose :
+//=======================================================================
+Handle(GEOM_Annotation) GEOMGUI_AnnotationMgr::getAISPresentation ( const QString& theEntry,
+ const int theIndex,
+ SOCC_Viewer* theView )
+{
+ if ( !myVisualized.contains( theView ) ) {
+ return Handle(GEOM_Annotation)();
+ }
+
+ EntryToAnnotations& aEntryToAnnotation = myVisualized[theView];
+ if ( !aEntryToAnnotation.contains( theEntry ) ) {
+ return Handle(GEOM_Annotation)();
+ }
+
+ AnnotationToPrs& aAnnotationToPrs = aEntryToAnnotation[theEntry];
+ if ( !aAnnotationToPrs.contains( theIndex ) ) {
+ return Handle(GEOM_Annotation)();
+ }
+
+ SALOME_Prs* aPrs = aAnnotationToPrs[theIndex];
+
+ // set or unset preview style for the presentation
+ AIS_ListOfInteractive aIObjects;
+ ((SOCC_Prs*)aPrs)->GetObjects( aIObjects );
+ AIS_ListOfInteractive::Iterator aIOIt( aIObjects );
+ for ( ; aIOIt.More(); aIOIt.Next() ) {
+ return Handle(GEOM_Annotation)::DownCast( aIOIt.Value() );
+ }
+
+ return Handle(GEOM_Annotation)();
+}
#include <SALOME_Prs.h>
#include <SALOME_InteractiveObject.hxx>
+#include <SOCC_ViewModel.h>
+
class SalomeApp_Application;
class GEOM_Annotation;
class GEOM_Displayer;
SALOME_Prs* CreatePresentation( const GEOMGUI_AnnotationAttrs::Properties& theProperty,
GEOM::GEOM_Object_ptr theObject,
- SALOME_View* theView = 0,
+ SOCC_Viewer* 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 );
- void Erase( const QString& theEntry, const int theIndex, SALOME_View* theView = 0 );
+ 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 Redisplay( const QString& theEntry, const int theIndex,
const GEOMGUI_AnnotationAttrs::Properties& theProperties);
void Redisplay( const QString& theEntry, const int theIndex,
- const GEOMGUI_AnnotationAttrs::Properties& theProperties, SALOME_View* theView );
+ const GEOMGUI_AnnotationAttrs::Properties& theProperties, SOCC_Viewer* theView );
- void DisplayVisibleAnnotations( const QString& theEntry, SALOME_View* theView = 0 );
- void EraseVisibleAnnotations( const QString& theEntry, SALOME_View* theView = 0 );
- void UpdateVisibleAnnotations( const QString& theEntry, SALOME_View* theView = 0 );
+ void DisplayVisibleAnnotations( const QString& theEntry, SOCC_Viewer* theView = 0 );
+ void EraseVisibleAnnotations( const QString& theEntry, SOCC_Viewer* theView = 0 );
+ void UpdateVisibleAnnotations( const QString& theEntry, SOCC_Viewer* theView = 0 );
+ void SetPreviewStyle( const QString& theEntry, const int theIndex, const bool theIsPreview );
- void RemoveView( SALOME_View* theView);
+ void RemoveView( SOCC_Viewer* theView );
int FindAnnotationIndex( Handle(SALOME_InteractiveObject) theIO,
- SALOME_View* theView = 0 );
+ SOCC_Viewer* theView = 0 );
Handle(SALOME_InteractiveObject) FindInteractiveObject( const QString& theEntry, const int theIndex,
- SALOME_View* theView = 0 ) const;
+ SOCC_Viewer* theView = 0 ) const;
+
+ QString getDisplayedIndicesInfo( const QString& theEntry, SOCC_Viewer* theView ) const;
- QString getDisplayedIndicesInfo( const QString& theEntry, SALOME_View* theView ) const;
+ void setDisplayedIndicesInfo( const QString& theEntry, SOCC_Viewer* theView, const QString theIndicesInfo );
- void setDisplayedIndicesInfo( const QString& theEntry, SALOME_View* theView, const QString theIndicesInfo );
+ QString makeAnnotationEntry( const QString& theEntry, const int theIndex );
protected:
GEOM_Displayer* getDisplayer() const;
- SALOME_View* viewOrActiveView(SALOME_View* theView) const;
+ SOCC_Viewer* viewOrActiveView( SOCC_Viewer* theView ) const;
void getObject( const QString& theEntry, const int theIndex,
GEOM::GEOM_Object_ptr& anObject,
GEOMGUI_AnnotationAttrs::Properties& aProperty );
- void storeVisibleState( const QString& theEntry, SALOME_View* theView );
+ void storeVisibleState( const QString& theEntry, SOCC_Viewer* theView );
std::string getEntry( const GEOM::GEOM_Object_ptr theObject );
std::string getName( const GEOM::GEOM_Object_ptr theObject );
void setDisplayProperties( const Handle(GEOM_Annotation)& thePrs,
- SALOME_View* theView = 0,
+ SOCC_Viewer* theView = 0,
const QString& theEntry = QString() );
+ Handle(GEOM_Annotation) getAISPresentation ( const QString& theEntry,
+ const int theIndex,
+ SOCC_Viewer* theView );
+
private:
SalomeApp_Application* myApplication;
typedef QMap<int, SALOME_Prs*> AnnotationToPrs;
typedef QMap<QString, AnnotationToPrs> EntryToAnnotations;
- QMap<SALOME_View*, EntryToAnnotations> myVisualized;
+ QMap<SOCC_Viewer*, EntryToAnnotations> myVisualized;
};
#endif
#if OCC_VERSION_MAJOR >= 7
myColorScale = new AIS_ColorScale;
myColorScale->SetZLayer (Graphic3d_ZLayerId_TopOSD);
- myColorScale->SetTransformPersistence (Graphic3d_TMF_2d, gp_Pnt (-1,-1,0));
+ myColorScale->SetTransformPersistence (
+ Graphic3d_TransformPers::FromDeprecatedParams(Graphic3d_TMF_2d, gp_Pnt (-1,-1,0)));
#endif
myFieldDataType = GEOM::FDT_Double;
GeometryGUI* aModule = dynamic_cast<GeometryGUI*>( anApp->activeModule() );
if ( aModule ) {
if ( !theViewFrame->isVisible( theIO ) ) {
- aModule->GetAnnotationMgr()->EraseVisibleAnnotations(QString(theIO->getEntry()), theViewFrame);
+ aModule->GetAnnotationMgr()->EraseVisibleAnnotations(QString(theIO->getEntry()), dynamic_cast<SOCC_Viewer*>( theViewFrame ));
}
else {
- aModule->GetAnnotationMgr()->DisplayVisibleAnnotations(QString(theIO->getEntry()), theViewFrame);
+ aModule->GetAnnotationMgr()->DisplayVisibleAnnotations(QString(theIO->getEntry()), dynamic_cast<SOCC_Viewer*>( theViewFrame ));
}
}
}
GeometryGUI* aModule = dynamic_cast<GeometryGUI*>( anApp->activeModule() );
if ( aModule ) {
if ( !myIsRedisplayed ) {
- aModule->GetAnnotationMgr()->DisplayVisibleAnnotations(QString(p->GetEntry()), v);
+ aModule->GetAnnotationMgr()->DisplayVisibleAnnotations(QString(p->GetEntry()), dynamic_cast<SOCC_Viewer*>( v ));
} else {
- aModule->GetAnnotationMgr()->UpdateVisibleAnnotations(QString(p->GetEntry()), v);
+ aModule->GetAnnotationMgr()->UpdateVisibleAnnotations(QString(p->GetEntry()), dynamic_cast<SOCC_Viewer*>( v ));
}
}
}
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
GeometryGUI* aModule = dynamic_cast<GeometryGUI*>( anApp->activeModule() );
if ( aModule )
- aModule->GetAnnotationMgr()->EraseVisibleAnnotations(QString(p->GetEntry()), v);
+ aModule->GetAnnotationMgr()->EraseVisibleAnnotations(QString(p->GetEntry()), dynamic_cast<SOCC_Viewer*>( v ));
}
}
break;
}
}
- GetAnnotationMgr()->RemoveView(dynamic_cast<SALOME_View*>(viewer));
+ SOCC_Viewer* aSOCCView = dynamic_cast<SOCC_Viewer*>(viewer);
+ if ( aSOCCView ) {
+ GetAnnotationMgr()->RemoveView( aSOCCView );
+ }
}
//================================================================================
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 );
+ }
}
if ( param == QString( "label_color" ) ) {
ViewManagerList aVMsVTK;
ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::IsosWidth )).toString().toStdString());
}
- if ( aAnnotationMgr ) {
- std::string anAnnotationInfo = GetAnnotationMgr()->getDisplayedIndicesInfo( o_it.key().toLatin1().data(), aView ).toStdString();
+ if ( vType == SOCC_Viewer::Type() && aAnnotationMgr ) {
+ std::string anAnnotationInfo = GetAnnotationMgr()->getDisplayedIndicesInfo(
+ o_it.key().toLatin1().data(), dynamic_cast<SOCC_Viewer*>(aView) ).toStdString();
if (!anAnnotationInfo.empty()) {
param = occParam + "ShapeAnnotationVisibleItems";
ip->setParameter(entry, param.toStdString(), anAnnotationInfo);
SALOME_View* aView = dynamic_cast<SALOME_View*>(vmodel);
displayer()->Display(entry, true, aView);
- PropMap& aProps = aListOfMap[index];
- if ( aProps.contains( "ShapeAnnotationVisibleItems" ) )
- GetAnnotationMgr()->setDisplayedIndicesInfo( entry, aView, aProps["ShapeAnnotationVisibleItems"].toString() );
+ if ( vmodel->getType() == SOCC_Viewer::Type() ) {
+ PropMap& aProps = aListOfMap[index];
+ if ( aProps.contains( "ShapeAnnotationVisibleItems" ) ) {
+ SOCC_Viewer* aSOCCView = dynamic_cast<SOCC_Viewer*>( aView );
+ GetAnnotationMgr()->setDisplayedIndicesInfo( entry, aSOCCView, aProps["ShapeAnnotationVisibleItems"].toString() );
+ }
+ }
}
}
} // for entries iterator
// connect controls
connect( myTextEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChange() ) );
connect( myTypeCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onTypeChange() ) );
+
+ myGeomGUI->GetAnnotationMgr()->SetPreviewStyle( myEditAnnotationEntry, myEditAnnotationIndex, true );
+
+ redisplayPreview();
}
}
//=================================================================================
void MeasureGUI_AnnotationDlg::onDragged( Handle_GEOM_Annotation theAnnotation )
{
- const PrsList& aPreview = getPreview();
- PrsList::const_iterator anIt = aPreview.cbegin();
- for ( ; anIt != aPreview.cend(); ++anIt ) {
-
- AIS_ListOfInteractive aIObjects;
- ((SOCC_Prs*)(*anIt))->GetObjects( aIObjects );
- AIS_ListOfInteractive::Iterator aIOIt( aIObjects );
- for ( ; aIOIt.More(); aIOIt.Next() ) {
-
- if ( aIOIt.Value() == theAnnotation ) {
-
- TopoDS_Shape aShape;
- GEOMBase::GetShape( myShape.get(), aShape );
- gp_Ax3 aShapeLCS = gp_Ax3().Transformed( aShape.Location().Transformation() );
- gp_Trsf aToShapeLCS;
- aToShapeLCS.SetTransformation( gp_Ax3(), aShapeLCS );
-
- if ( !myAnnotationProperties.IsScreenFixed ) {
- myAnnotationProperties.Position = theAnnotation->GetPosition().Transformed( aToShapeLCS );
- }
- else {
- myAnnotationProperties.Position = theAnnotation->GetPosition();
- }
-
- return;
- }
- }
+ TopoDS_Shape aShape;
+ GEOMBase::GetShape( myShape.get(), aShape );
+ gp_Ax3 aShapeLCS = gp_Ax3().Transformed( aShape.Location().Transformation() );
+ gp_Trsf aToShapeLCS;
+ aToShapeLCS.SetTransformation( gp_Ax3(), aShapeLCS );
+
+ if ( !myAnnotationProperties.IsScreenFixed ) {
+ myAnnotationProperties.Position = theAnnotation->GetPosition().Transformed( aToShapeLCS );
+ }
+ else {
+ myAnnotationProperties.Position = theAnnotation->GetPosition();
}
}
//=================================================================================
SALOME_Prs* MeasureGUI_AnnotationDlg::buildPrs()
{
- SALOME_Prs* aPrs = myGeomGUI->GetAnnotationMgr()->CreatePresentation( myAnnotationProperties, myShape.get() );
+ QString aEntry = myIsCreation ?
+ myGeomGUI->GetAnnotationMgr()->makeAnnotationEntry( myShape->GetStudyEntry(), - 1 ) :
+ myGeomGUI->GetAnnotationMgr()->makeAnnotationEntry( myEditAnnotationEntry, myEditAnnotationIndex );
+
+ SALOME_Prs* aPrs = myGeomGUI->GetAnnotationMgr()->CreatePresentation(
+ myAnnotationProperties, myShape.get(), 0, aEntry );
// set preview style for the created presentation
AIS_ListOfInteractive aIObjects;
((SOCC_Prs*)aPrs)->GetObjects( aIObjects );
AIS_ListOfInteractive::Iterator aIOIt( aIObjects );
for ( ; aIOIt.More(); aIOIt.Next() ) {
-
+
Handle( GEOM_Annotation ) aPresentation = Handle( GEOM_Annotation )::DownCast( aIOIt.Value() );
aPresentation->SetTextColor( Quantity_NOC_VIOLET );
aPresentation->SetLineColor( Quantity_NOC_VIOLET );
if ( SALOME_Prs* aPrs = buildPrs() )
displayPreview( aPrs );
- } catch ( const SALOME::SALOME_Exception& e ) {
- SalomeApp_Tools::QtCatchCorbaException( e );
- } catch ( ... ) {
+ } catch ( const SALOME::SALOME_Exception& e ) {
+ SalomeApp_Tools::QtCatchCorbaException( e );
+ } catch ( ... ) {
}
}
else {
myGeomGUI->GetAnnotationMgr()->Redisplay( myEditAnnotationEntry, myEditAnnotationIndex,
myAnnotationProperties );
}
+
+ QString anEntry;
+ if ( myIsCreation && !myShape->_is_nil() ) {
+ anEntry = myGeomGUI->GetAnnotationMgr()->makeAnnotationEntry( myShape->GetStudyEntry(), -1 );
+ }
+ else if ( !myIsCreation ) {
+ anEntry = myGeomGUI->GetAnnotationMgr()->makeAnnotationEntry( myEditAnnotationEntry, myEditAnnotationIndex );
+ }
+
+ myInteractor->SetEditEntry( anEntry );
}
//=================================================================================
{
QMouseEvent* aMouseEv = dynamic_cast<QMouseEvent*>( theEvent );
+ if ( myEditEntry.isEmpty() )
+ {
+ return false;
+ }
+
if ( !( aMouseEv->buttons() & Qt::LeftButton ) )
{
return false;
return false;
}
+ const Handle(SALOME_InteractiveObject) anIO =
+ Handle(SALOME_InteractiveObject)::DownCast( aAnnotation->GetOwner() );
+
+ if ( anIO.IsNull() || anIO->getEntry() != myEditEntry )
+ {
+ return false;
+ }
+
myStartPoint = aMouseEv->pos();
mySelection.Clear();
//! Disables event processing and interaction handlers.
void Disable();
+ //! Set entry of allowed annotation presentations.
+ void SetEditEntry( const QString& theEntry ) { myEditEntry = theEntry; }
+
protected:
//! Connect interactor's event handler to the view window given.
Handle(GEOM_Annotation) myActiveIO;
SelectMgr_SequenceOfOwner mySelection;
QPoint myStartPoint;
+ QString myEditEntry;
};
#endif
SetIsScreenFixed( Standard_False );
SetAttachPoint( gp_Pnt( 0.0, 0.0, 0.0 ) );
SetDisplayMode( 0 );
- SetZLayer( Graphic3d_ZLayerId_Default );
+ SetZLayer( Graphic3d_ZLayerId_Top );
SetAutoHide( Standard_True );
SetHilightMode( HighlightAll );
SetMutable( Standard_True );
{
myPosition = thePosition;
- Handle(Graphic3d_TransformPers) aPersistence;
if ( !myIsScreenFixed )
{
- AIS_InteractiveObject::SetTransformPersistence( Graphic3d_TMF_ZoomPers | Graphic3d_TMF_RotatePers, thePosition );
+ Handle(Graphic3d_TransformPers) aPersistence =
+ new Graphic3d_TransformPers( Graphic3d_TMF_ZoomRotatePers, thePosition );
+
+ AIS_InteractiveObject::SetTransformPersistence( aPersistence );
}
SetToUpdate();
{
myIsScreenFixed = theIsFixed;
+ Handle(Graphic3d_TransformPers) aPersistence;
+
if (!myIsScreenFixed)
{
- AIS_InteractiveObject::SetTransformPersistence( Graphic3d_TMF_ZoomPers | Graphic3d_TMF_RotatePers, myPosition );
+ aPersistence = new Graphic3d_TransformPers( Graphic3d_TMF_ZoomRotatePers, myPosition );
}
else
{
- AIS_InteractiveObject::SetTransformPersistence( Graphic3d_TMF_2d );
+ aPersistence = new Graphic3d_TransformPers( Graphic3d_TMF_2d, Aspect_TOTP_CENTER );
}
- SetZLayer( myIsScreenFixed ? Graphic3d_ZLayerId_Topmost : Graphic3d_ZLayerId_Default );
+ AIS_InteractiveObject::SetTransformPersistence( aPersistence );
+
+ SetZLayer( myIsScreenFixed ? Graphic3d_ZLayerId_Topmost : Graphic3d_ZLayerId_Top );
SetToUpdate();
// =======================================================================
void GEOM_Annotation::SetDefaultZLayer()
{
- SetZLayer( myIsScreenFixed ? Graphic3d_ZLayerId_Topmost : Graphic3d_ZLayerId_Default );
+ SetZLayer( myIsScreenFixed ? Graphic3d_ZLayerId_Topmost : Graphic3d_ZLayerId_Top );
SetToUpdate();
}
// function : HilightWithColor
// purpose : Perform highlighting of the presentation.
// =======================================================================
-void GEOM_Annotation::GEOM_AnnotationOwner::HilightWithColor( const Handle(PrsMgr_PresentationManager3d)& thePresentationMgr,
- const Quantity_NameOfColor theColor,
+void GEOM_Annotation::GEOM_AnnotationOwner::HilightWithColor( const Handle(PrsMgr_PresentationManager3d)& thePM,
+ const Handle(Graphic3d_HighlightStyle)& theStyle,
const Standard_Integer theMode )
{
- thePresentationMgr->Color( Selectable(), theColor, theMode, NULL, Selectable()->ZLayer() );
+ thePM->Color( Selectable(), theStyle, theMode, NULL, Selectable()->ZLayer() );
}
virtual void ComputeSelection( const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode ) Standard_OVERRIDE;
- virtual void SetLocalTransformation( const gp_Trsf& /*theTransformation*/ ) Standard_OVERRIDE {}
+ virtual void setLocalTransformation( const Handle(Geom_Transformation)& /*theTransformation*/ ) Standard_OVERRIDE {}
- virtual void SetTransformPersistence( const Graphic3d_TransModeFlags& /*theFlag*/,
- const gp_Pnt& /*thePoint*/ ) Standard_OVERRIDE {}
+ virtual void SetTransformPersistence( const Handle(Graphic3d_TransformPers)& /*theTrsfPers*/ ) Standard_OVERRIDE {}
Bnd_Box TextBoundingBox() const;
//! \param theColor [in] the highlighting color.
//! \param theMode [in] the display mode.
virtual void
- HilightWithColor( const Handle(PrsMgr_PresentationManager3d)& thePresentationMgr,
- const Quantity_NameOfColor theColor,
+ HilightWithColor( const Handle(PrsMgr_PresentationManager3d)& thePM,
+ const Handle(Graphic3d_HighlightStyle)& theStyle,
const Standard_Integer theMode = 0 ) Standard_OVERRIDE;
};