continue;
}
+ QString aStrName = "Annotation_X"; // TODO
QString aStrText = aRegExpItem.cap( 1 );
QString aStrVisible = aRegExpItem.cap( 2 );
QString aStrFixed = aRegExpItem.cap( 3 );
aStrText.replace( "::", ":" );
ShapeAnnotation aEntry;
+ aEntry.Name = aStrName;
aEntry.Text = aStrText;
aEntry.IsVisible = aStrVisible.toInt() != 0;
aEntry.IsScreenFixed = aStrFixed.toInt() != 0;
//
ShapeAnnotation& aChangeEntry = myAnnotations[theIndex];
aChangeEntry.IsScreenFixed = theShapeAnnotation->GetIsScreenFixed();
+ aChangeEntry.Name = "Annotation_X"; /// TODO
aChangeEntry.Text = QString( (QChar*) theShapeAnnotation->GetText().ToExtString(), theShapeAnnotation->GetText().Length() );
aChangeEntry.Attach = theShapeAnnotation->GetAttachPoint().Transformed( aFromLCS );
aChangeEntry.Position = theShapeAnnotation->GetPosition();
const Handle(GEOM_Annotation)& theShapeAnnotation,
const gp_Ax3& theLCS )
{
- //gp_Trsf aToLCS;
- //aToLCS.SetTransformation( theLCS, gp_Ax3() );
- //
- const ShapeAnnotation& aEntry = myAnnotations[theIndex];
- aEntry.ToPresentation(theShapeAnnotation, theLCS);
- ////
- //TCollection_ExtendedString aText;
- //for (int i = 0; i < (int)aEntry.Text.length(); i++ )
- // aText.Insert( i + 1, aEntry.Text[ i ].unicode() );
- ////
- //theShapeAnnotation->SetScreenFixed( aEntry.IsScreenFixed );
- //theShapeAnnotation->SetText( aText );
- //theShapeAnnotation->SetPosition( aEntry.Position );
- //theShapeAnnotation->SetAttachPoint( aEntry.Attach.Transformed( aToLCS ) );
-}
-
-bool GEOMGUI_ShapeAnnotations::IsVisible( const int theIndex ) const
-{
- return myAnnotations[theIndex].IsVisible;
-}
-
-void GEOMGUI_ShapeAnnotations::SetVisible( const int theIndex, const bool theIsVisible )
-{
- ShapeAnnotation& aChangeEntry = myAnnotations[theIndex];
- aChangeEntry.IsVisible = theIsVisible;
-}
-
-QString GEOMGUI_ShapeAnnotations::GetName( const int theIndex ) const
-{
- return "Name";
-}
-
-void GEOMGUI_ShapeAnnotations::SetName( const int theIndex, const QString& theName )
-{
+ myAnnotations[theIndex].ToPresentation(theShapeAnnotation, theLCS);
}
//=================================================================================
*/
struct ShapeAnnotation
{
+ QString Name; // annotation name label
QString Text; // annotation text label
bool IsVisible; // visibility of annotation
bool IsScreenFixed; // fixed screen mode flag
bool operator == (const ShapeAnnotation& theOther) const
{
- return Text == theOther.Text
+ return Name == theOther.Name
+ && Text == theOther.Text
&& IsVisible == theOther.IsVisible
&& IsScreenFixed == theOther.IsScreenFixed
&& Position.IsEqual (theOther.Position, 0.0)
*
* \param theIndex [in] the index of the dimension record.
*/
- virtual bool IsVisible( const int theIndex ) const;
+ virtual bool IsVisible( const int theIndex ) const
+ {
+ return myAnnotations[theIndex].IsVisible;
+ }
/*!
* \brief Changes visibility state of the dimension record.
* \param theIndex [in] the index of the dimension record.
* \param theIsVisible [in] the new visibility state.
*/
- virtual void SetVisible( const int theIndex, const bool theIsVisible );
+ virtual void SetVisible( const int theIndex, const bool theIsVisible )
+ {
+ myAnnotations[theIndex].IsVisible = theIsVisible;
+ }
/*!
* \brief Returns name of dimension record by its index.
*
* \param theIndex [in] the index of the dimension record.
*/
- virtual QString GetName( const int theIndex ) const;
+ virtual QString GetName( const int theIndex ) const
+ {
+ return myAnnotations[theIndex].Name;
+ }
/*!
* \brief Changes name of dimension record.
* \param theIndex [in] the index of the dimension record.
* \param theName [in] the new name.
*/
- virtual void SetName( const int theIndex, const QString& theName );
+ virtual void SetName( const int theIndex, const QString& theName )
+ {
+ myAnnotations[theIndex].Name = theName;
+ }
public:
initName(tr("ANNOTATION_PREFIX"));
// default presentation values
+ myAnnotationProperties.Name = getNewObjectName();
myAnnotationProperties.Position = gp_Pnt(250, 250, 250);
myAnnotationProperties.Text = tr("ANNOTATION_PREFIX");
- myAnnotationProperties.IsVisible = true;
+ myAnnotationProperties.IsVisible = false;
myAnnotationProperties.IsScreenFixed = false;
myAnnotationProperties.Attach = gp_Pnt(0, 0, 0);
myAnnotationProperties.ShapeIndex = -1;
return false; \
}
+//=================================================================================
+// function : createOperation
+// purpose :
+//=================================================================================
+GEOM::GEOM_IOperations_ptr MeasureGUI_AnnotationDlg::createOperation()
+{
+ return getGeomEngine()->GetILocalOperations(getStudyId());
+}
+
//=================================================================================
// function : isValid()
// purpose : Verify validity of input data
return false;
if (myIsCreation) {
- QString aName = getNewObjectName();
-
SalomeApp_Study* aStudy = getStudy();
GEOMGUI_ShapeAnnotations aProp =
aStudy->getObjectProperty( GEOM::sharedPropertiesId(),
.value<GEOMGUI_ShapeAnnotations>();
// append new dimension record to data
+ int aPropId = aProp.GetNumber() - 1;
+ myAnnotationProperties.Name = getNewObjectName(); // update here as we do not listen name modification
+ myAnnotationProperties.IsVisible = true; // initially created annotation is hidden
aProp.Add( myAnnotationProperties );
- aProp.SetName( aProp.GetNumber() - 1, aName );
- aProp.SetVisible( aProp.GetNumber() - 1, true );
// store modified property data
aStudy->setObjectProperty( GEOM::sharedPropertiesId(),
myShape->GetStudyEntry(), GEOM::propertyName(GEOM::ShapeAnnotations),
aProp);
+ aProp.SaveToAttribute( aStudy, myShape->GetStudyEntry() );
myGeomGUI->emitDimensionsUpdated( QString( myShape->GetStudyEntry() ) );
}
else {
return;
}
- erasePreview(false);
+ erasePreview( false );
try {
//SUIT_OverrideCursor wc;
//getDisplayer()->SetColor(Quantity_NOC_VIOLET);
//getDisplayer()->SetToActivate(false);
- if (SALOME_Prs* aPrs = buildPrs())
+ if ( SALOME_Prs* aPrs = buildPrs() )
displayPreview(aPrs);
- } catch (const SALOME::SALOME_Exception& e) {
- SalomeApp_Tools::QtCatchCorbaException(e);
+ } catch ( const SALOME::SALOME_Exception& e ) {
+ SalomeApp_Tools::QtCatchCorbaException( e );
} catch (...) {
}
}
// function : getAttachPoint
// purpose : finds a point on shape to attach annotation object
//=================================================================================
-gp_Pnt MeasureGUI_AnnotationDlg::getAttachPoint(const TopoDS_Shape& theShape) {
- gp_Pnt aPoint = gp_Pnt(0, 0, 0);
+gp_Pnt MeasureGUI_AnnotationDlg::getAttachPoint(const TopoDS_Shape& theShape)
+{
+ gp_Pnt aPoint = gp_Pnt( 0, 0, 0 );
return aPoint;
}
protected:
// redefined from GEOMBase_Helper
+ virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid (QString&);
virtual bool execute ();