// change persistent for the entry: set visible state in true for indices which presentations are shown
storeVisibleState( theEntry, theView );
+ storeFixedPosition( theEntry, theView );
}
void GEOMGUI_AnnotationMgr::Redisplay( const QString& theEntry, const int theIndex,
}
}
+void GEOMGUI_AnnotationMgr::storeFixedPosition( const QString& theEntry, SOCC_Viewer* 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() )
+ return;
+
+
+ EntryToAnnotations anEntryToAnnotation = myVisualized[aView];
+ AnnotationToPrs anAnnotationToPrs;
+ if ( anEntryToAnnotation.contains( theEntry ) )
+ anAnnotationToPrs = anEntryToAnnotation[theEntry];
+
+ AnnotationToPrs::iterator anIt = anAnnotationToPrs.begin();
+ for (; anIt != anAnnotationToPrs.end(); ++anIt ) {
+ int anIndex = anIt.key();
+ bool isFixedAnnotation = aShapeAnnotations->GetIsScreenFixed( anIndex );
+ if ( !isFixedAnnotation )
+ continue;
+
+ SOCC_Prs* aPrs = dynamic_cast<SOCC_Prs*> (anIt.value());
+ Handle(GEOM_Annotation) anAnnotationPresentation;
+
+ AIS_ListOfInteractive aIObjects;
+ aPrs->GetObjects( aIObjects );
+ AIS_ListOfInteractive::Iterator aIOIt( aIObjects );
+ for ( ; aIOIt.More(); aIOIt.Next() ) {
+ anAnnotationPresentation = Handle(GEOM_Annotation)::DownCast( aIOIt.Value() );
+ if ( !anAnnotationPresentation.IsNull() )
+ break;
+ }
+ if ( !anAnnotationPresentation.IsNull() )
+ aShapeAnnotations->SetPosition( anIndex, anAnnotationPresentation->GetPosition() );
+ }
+}
+
void GEOMGUI_AnnotationMgr::storeVisibleState( const QString& theEntry, SOCC_Viewer* theView )
{
SOCC_Viewer* aView = viewOrActiveView( theView );
myShapeName->setEnabled( myIsCreation );
// data type
- QLabel* typeLabel = new QLabel( tr( "ANNOTATION_TYPE" ), propGroup );
- myTypeCombo = new QComboBox( propGroup );
- myTypeCombo->addItem( tr( "3D" ), 0 );
- myTypeCombo->addItem( tr( "2D" ), 1 );
- myTypeCombo->setCurrentIndex( 0 ); // 3D, not fixed
+ myIsScreenFixed = new QCheckBox( tr( "ANNOTATION_IS_SCREEN_FIXED" ), propGroup );
+ myIsScreenFixed->setChecked( false ); // 3D, not fixed
propLayout->addWidget( shapeLabel, 1, 0 );
propLayout->addWidget( myShapeSelBtn, 1, 1 );
propLayout->addWidget( myShapeName, 1, 2 );
- propLayout->addWidget( typeLabel, 2, 0, 1, 2 );
- propLayout->addWidget( myTypeCombo, 2, 2 );
+ propLayout->addWidget( myIsScreenFixed, 2, 0, 1, 3 );
propLayout->setColumnStretch( 2, 5 );
QLabel* shapeTypeLabel = new QLabel( tr( "ANNOTATION_SUB_SHAPE" ), propGroup );
myTextEdit->setText( myAnnotationProperties.Text );
myShapeNameModified = false;
- myTypeCombo->setCurrentIndex( !myAnnotationProperties.IsScreenFixed ? 0 : 1 );
+ myIsScreenFixed->setChecked( myAnnotationProperties.IsScreenFixed );
int aSubShapeTypeIndex = -1;
int aTypesCount = aTypesCount = mySubShapeTypeCombo->count();
SLOT( SetEditCurrentArgument() ) );
connect( myTextEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChange() ) );
- connect( myTypeCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onTypeChange() ) );
+ connect( myIsScreenFixed, SIGNAL( clicked( bool ) ), this, SLOT( onTypeChange() ) );
connect( mySubShapeTypeCombo, SIGNAL( currentIndexChanged( int ) ),
this, SLOT( onSubShapeTypeChange() ) );
/// fill dialog controls
myTextEdit->setText( myAnnotationProperties.Text );
myShapeNameModified = false;
- myTypeCombo->setCurrentIndex( !myAnnotationProperties.IsScreenFixed ? 0 : 1 );
+ myIsScreenFixed->setChecked( myAnnotationProperties.IsScreenFixed );
int aSubShapeTypeIndex = -1;
int aTypesCount = aTypesCount = mySubShapeTypeCombo->count();
// connect controls
connect( myTextEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChange() ) );
- connect( myTypeCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onTypeChange() ) );
+ connect( myIsScreenFixed, SIGNAL( clicked( bool ) ), this, SLOT( onTypeChange() ) );
myGeomGUI->GetAnnotationMgr()->SetPreviewStyle( myEditAnnotationEntry, myEditAnnotationIndex, true );
{
const bool isScreenFixedBefore = myAnnotationProperties.IsScreenFixed;
- myAnnotationProperties.IsScreenFixed = myTypeCombo->currentIndex() == 1;
+ myAnnotationProperties.IsScreenFixed = myIsScreenFixed->isChecked();
// convert point position from screen space to 3D space
if ( myIsPositionDefined ) {
if ( !myAnnotationProperties.IsScreenFixed ) {
myAnnotationProperties.Position = theAnnotation->GetPosition().Transformed( aToShapeLCS );
+
+ if ( !myIsCreation ) {
+ myGeomGUI->GetAnnotationMgr()->storeFixedPosition( myEditAnnotationEntry, 0 );
+ }
}
else {
myAnnotationProperties.Position = theAnnotation->GetPosition();