mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-28 05:50:34 +05:00
Remove name from annotation. Dump/Restore study.
This commit is contained in:
parent
ba59095bec
commit
675ca69b6d
@ -48,9 +48,6 @@ namespace
|
||||
std::string PARAMETER_IS_2D( const int i ) {
|
||||
return PARAMETER_I( "GEOMGUI_AnnotationAttrs_Is2D", i );
|
||||
}
|
||||
std::string PARAMETER_NAME( const int i ) {
|
||||
return PARAMETER_I( "GEOMGUI_AnnotationAttrs_Name", i );
|
||||
}
|
||||
std::string PARAMETER_TEXT( const int i ) {
|
||||
return PARAMETER_I( "GEOMGUI_AnnotationAttrs_Text", i );
|
||||
}
|
||||
@ -63,7 +60,34 @@ namespace
|
||||
std::string PARAMETER_SHAPE( const int i ) {
|
||||
return PARAMETER_I( "GEOMGUI_AnnotationAttrs_Shape", i );
|
||||
}
|
||||
}
|
||||
|
||||
// REGEXP pattern for converting array of entries into plain text string.
|
||||
// The pattern has the following structure:
|
||||
// ENTRY: { text[string] : visibility[bool] : screen fixed[bool] : position[xyz] : attach[xyz] }
|
||||
static const QString PATTERN_ITEM_GROUP = "\\{ (Text=(?::{2,}|.)*:(?!:)Screen=.*:Position=\\{(.*):(.*):(.*)\\}:Attach=\\{(.*):(.*):(.*)\\}:ShapeIdx=.*:ShapeType=.*) \\}";
|
||||
static const QString PATTERN_ITEM = "Text=((?::{2,}|.)*):(?!:)Screen=(\\d{1}):Position=\\{(.*):(.*):(.*)\\}:Attach=\\{(.*):(.*):(.*)\\}:ShapeIdx=(\\-?\\d{1,}):ShapeType=(\\d{1})";
|
||||
static QString toPattern (const QString& theText,
|
||||
const bool theIsFixed,
|
||||
const gp_Pnt& thePosition,
|
||||
const gp_Pnt& theAttach,
|
||||
const int theShapeIndex,
|
||||
const int theShapeType)
|
||||
{
|
||||
return QString( "{ Text=" ) + theText +
|
||||
QString( ":" ) + QString( "Screen=" ) + QString::number( theIsFixed ? 1 : 0 ) +
|
||||
QString( ":" ) + QString( "Position={" ) +
|
||||
QString::number( thePosition.X() ) + QString( ":" ) +
|
||||
QString::number( thePosition.Y() ) + QString( ":" ) +
|
||||
QString::number( thePosition.Z() ) + QString( "}" ) +
|
||||
QString( ":" ) + QString( "Attach={" ) +
|
||||
QString::number( theAttach.X() ) + QString( ":" ) +
|
||||
QString::number( theAttach.Y() ) + QString( ":" ) +
|
||||
QString::number( theAttach.Z() ) + QString( "}" ) +
|
||||
QString( ":" ) + QString( "ShapeIdx=" ) + QString::number( theShapeIndex ) +
|
||||
QString( ":" ) + QString( "ShapeType=" ) + QString::number( theShapeType ) +
|
||||
QString( " }" );
|
||||
}
|
||||
};
|
||||
|
||||
//=================================================================================
|
||||
// function : FindAttributes
|
||||
@ -133,7 +157,6 @@ void GEOMGUI_AnnotationAttrs::Remove( const _PTR(SObject)& theObject )
|
||||
{
|
||||
aParameterMap->RemoveID( PARAMETER_IS_VISIBLE( anI ), PT_BOOLEAN );
|
||||
aParameterMap->RemoveID( PARAMETER_IS_2D( anI ), PT_BOOLEAN );
|
||||
aParameterMap->RemoveID( PARAMETER_NAME( anI ), PT_STRING );
|
||||
aParameterMap->RemoveID( PARAMETER_TEXT( anI ), PT_STRING );
|
||||
aParameterMap->RemoveID( PARAMETER_POSITION( anI ), PT_REALARRAY );
|
||||
aParameterMap->RemoveID( PARAMETER_ATTACH( anI ), PT_REALARRAY );
|
||||
@ -143,6 +166,85 @@ void GEOMGUI_AnnotationAttrs::Remove( const _PTR(SObject)& theObject )
|
||||
aParameterMap->RemoveID( PARAMETER_COUNT, PT_INTEGER );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ExportAsPropertyString
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
QString GEOMGUI_AnnotationAttrs::ExportAsPropertyString() const
|
||||
{
|
||||
QStringList anItems;
|
||||
|
||||
for ( int anI = 0; anI < GetNbAnnotation(); ++anI )
|
||||
{
|
||||
Properties aEntry;
|
||||
|
||||
GetProperties( anI, aEntry );
|
||||
|
||||
anItems.append( toPattern( aEntry.Text,
|
||||
aEntry.IsScreenFixed,
|
||||
aEntry.Position,
|
||||
aEntry.Attach,
|
||||
aEntry.ShapeIndex,
|
||||
aEntry.ShapeType ) );
|
||||
}
|
||||
|
||||
return anItems.join( ":" );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ImportFromPropertyString
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GEOMGUI_AnnotationAttrs::ImportFromPropertyString( const QString& theString )
|
||||
{
|
||||
SetNbAnnotation( 0 );
|
||||
|
||||
QRegExp aRegExpItemGroups( PATTERN_ITEM_GROUP );
|
||||
QRegExp aRegExpItem( "^" + PATTERN_ITEM + "$" );
|
||||
aRegExpItemGroups.setMinimal( true );
|
||||
aRegExpItem.setMinimal( true );
|
||||
|
||||
int aPos = 0;
|
||||
while ( ( aPos = aRegExpItemGroups.indexIn( theString, aPos ) ) != -1 )
|
||||
{
|
||||
aPos += aRegExpItemGroups.matchedLength();
|
||||
|
||||
QString aStrItem = aRegExpItemGroups.cap(1);
|
||||
|
||||
if ( aRegExpItem.indexIn( aStrItem ) < 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
QString aStrText = aRegExpItem.cap( 1 );
|
||||
QString aStrFixed = aRegExpItem.cap( 2 );
|
||||
QString aStrPosX = aRegExpItem.cap( 3 );
|
||||
QString aStrPosY = aRegExpItem.cap( 4 );
|
||||
QString aStrPosZ = aRegExpItem.cap( 5 );
|
||||
QString aStrAttX = aRegExpItem.cap( 6 );
|
||||
QString aStrAttY = aRegExpItem.cap( 7 );
|
||||
QString aStrAttZ = aRegExpItem.cap( 8 );
|
||||
QString aStrShapeIdx = aRegExpItem.cap( 9 );
|
||||
QString aStrShapeType = aRegExpItem.cap( 10 );
|
||||
aStrText.replace( "::", ":" );
|
||||
|
||||
Properties aEntry;
|
||||
aEntry.Text = aStrText;
|
||||
aEntry.IsVisible = false;
|
||||
aEntry.IsScreenFixed = aStrFixed.toInt() != 0;
|
||||
aEntry.Position.SetX( aStrPosX.toDouble() );
|
||||
aEntry.Position.SetY( aStrPosY.toDouble() );
|
||||
aEntry.Position.SetZ( aStrPosZ.toDouble() );
|
||||
aEntry.Attach.SetX( aStrAttX.toDouble() );
|
||||
aEntry.Attach.SetY( aStrAttY.toDouble() );
|
||||
aEntry.Attach.SetZ( aStrAttZ.toDouble() );
|
||||
aEntry.ShapeIndex = aStrShapeIdx.toInt();
|
||||
aEntry.ShapeType = aStrShapeType.toInt();
|
||||
|
||||
Append( aEntry );
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SetNbAnnotation
|
||||
// purpose :
|
||||
@ -158,7 +260,6 @@ void GEOMGUI_AnnotationAttrs::SetNbAnnotation( const int theCount ) const
|
||||
{
|
||||
myParameterMap->SetBool( PARAMETER_IS_VISIBLE( anI ), true );
|
||||
myParameterMap->SetBool( PARAMETER_IS_2D( anI ), false );
|
||||
myParameterMap->SetString( PARAMETER_NAME( anI ), std::string() );
|
||||
myParameterMap->SetString( PARAMETER_TEXT( anI ), std::string() );
|
||||
myParameterMap->SetRealArray( PARAMETER_POSITION( anI ), std::vector<double>(3, 0.0) );
|
||||
myParameterMap->SetRealArray( PARAMETER_ATTACH( anI ), std::vector<double>(3, 0.0) );
|
||||
@ -172,7 +273,6 @@ void GEOMGUI_AnnotationAttrs::SetNbAnnotation( const int theCount ) const
|
||||
{
|
||||
myParameterMap->RemoveID( PARAMETER_IS_VISIBLE( anI ), PT_BOOLEAN );
|
||||
myParameterMap->RemoveID( PARAMETER_IS_2D( anI ), PT_BOOLEAN );
|
||||
myParameterMap->RemoveID( PARAMETER_NAME( anI ), PT_STRING );
|
||||
myParameterMap->RemoveID( PARAMETER_TEXT( anI ), PT_STRING );
|
||||
myParameterMap->RemoveID( PARAMETER_POSITION( anI ), PT_REALARRAY );
|
||||
myParameterMap->RemoveID( PARAMETER_ATTACH( anI ), PT_REALARRAY );
|
||||
@ -192,24 +292,6 @@ int GEOMGUI_AnnotationAttrs::GetNbAnnotation() const
|
||||
return myParameterMap->GetInt( PARAMETER_COUNT );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SetName
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GEOMGUI_AnnotationAttrs::SetName( const int theIndex, const QString& theName )
|
||||
{
|
||||
myParameterMap->SetString( PARAMETER_NAME( theIndex ), theName.toStdString() );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : GetName
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
QString GEOMGUI_AnnotationAttrs::GetName( const int theIndex ) const
|
||||
{
|
||||
return QString::fromStdString( myParameterMap->GetString( PARAMETER_NAME( theIndex ) ) );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SetVisible
|
||||
// purpose :
|
||||
@ -384,7 +466,6 @@ void GEOMGUI_AnnotationAttrs::SetProperties( const int theIndex, const Propertie
|
||||
gp_Trsf aToShapeLCS;
|
||||
aToShapeLCS.SetTransformation( gp_Ax3(), theShapeLCS );
|
||||
|
||||
this->SetName( theIndex, theProps.Name );
|
||||
this->SetText( theIndex, theProps.Text );
|
||||
this->SetIsVisible( theIndex, theProps.IsVisible );
|
||||
this->SetIsScreenFixed( theIndex, theProps.IsScreenFixed );
|
||||
@ -400,7 +481,6 @@ void GEOMGUI_AnnotationAttrs::SetProperties( const int theIndex, const Propertie
|
||||
//=================================================================================
|
||||
void GEOMGUI_AnnotationAttrs::GetProperties( const int theIndex, Properties& theProps ) const
|
||||
{
|
||||
theProps.Name = this->GetName( theIndex );
|
||||
theProps.Text = this->GetText( theIndex );
|
||||
theProps.IsVisible = this->GetIsVisible( theIndex );
|
||||
theProps.IsScreenFixed = this->GetIsScreenFixed( theIndex );
|
||||
|
@ -61,6 +61,15 @@ public:
|
||||
//! Remove annotation data fields for an object.
|
||||
GEOMGUI_EXPORT static void Remove( const _PTR(SObject)& theObject );
|
||||
|
||||
// Import / Export
|
||||
public:
|
||||
|
||||
//! Exports annotation records as a property string.
|
||||
GEOMGUI_EXPORT QString ExportAsPropertyString() const;
|
||||
|
||||
//! Imports annotation records from a property string.
|
||||
GEOMGUI_EXPORT void ImportFromPropertyString( const QString& theString );
|
||||
|
||||
public:
|
||||
|
||||
/*!
|
||||
@ -68,7 +77,6 @@ public:
|
||||
*/
|
||||
struct Properties
|
||||
{
|
||||
QString Name; //!< Application name of annotation.
|
||||
QString Text; //!< Displayed annotation text.
|
||||
bool IsVisible; //!< Application visibility flag of annotation.
|
||||
bool IsScreenFixed; //!< Fixed screen mode flag.
|
||||
@ -105,15 +113,6 @@ public:
|
||||
//! Returns number of annotation definitions stored on the object.
|
||||
GEOMGUI_EXPORT int GetNbAnnotation() const;
|
||||
|
||||
//! Sets application name property of an annotation definition.
|
||||
//! @param theIndex [in] the index of the annotation definition.
|
||||
//! @param theName [in] the new application name.
|
||||
GEOMGUI_EXPORT void SetName( const int theIndex, const QString& theName );
|
||||
|
||||
//! Returns application name of an annotation definition.
|
||||
//! @param theIndex [in] the index of the annotation definition.
|
||||
GEOMGUI_EXPORT QString GetName( const int theIndex ) const;
|
||||
|
||||
//! Sets application visibility state of an annotation definition.
|
||||
//! @param theIndex [in] the index of the annotation definition.
|
||||
//! @param theIsVisible [in] the visibility state.
|
||||
@ -196,8 +195,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
GEOMGUI_AnnotationAttrs( const _PTR(SObject)& theObject,
|
||||
const _PTR(AttributeParameter)& theParameter )
|
||||
GEOMGUI_AnnotationAttrs( const _PTR(SObject)& theObject, const _PTR(AttributeParameter)& theParameter )
|
||||
: myObj( theObject ),
|
||||
myParameterMap( theParameter ) {}
|
||||
|
||||
|
@ -75,7 +75,7 @@ SALOME_Prs* GEOMGUI_AnnotationMgr::CreatePresentation( const GEOMGUI_AnnotationA
|
||||
aPresentation->SetOwner( anIO );
|
||||
}
|
||||
|
||||
aPresentation->SetOwner( new SALOME_InteractiveObject( getEntry( theObject ).c_str(), "GEOM", getName( theObject ).c_str() ) );
|
||||
//aPresentation->SetOwner( new SALOME_InteractiveObject( getEntry( theObject ).c_str(), "GEOM", getName( theObject ).c_str() ) );
|
||||
|
||||
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
|
||||
const QFont aFont = aResMgr->fontValue( "Geometry", "shape_annotation_font", QFont( "Y14.5M-2009", 24 ) );
|
||||
@ -170,7 +170,7 @@ void GEOMGUI_AnnotationMgr::Display( const QString& theEntry, const int theIndex
|
||||
myVisualized[aView] = anEntryToMap;
|
||||
|
||||
// change persistent for the entry: set visible state in true for indices which presentations are shown
|
||||
storeVisibleState( theEntry, theView );
|
||||
storeVisibleState( theEntry, theView, theIndex );
|
||||
}
|
||||
|
||||
void GEOMGUI_AnnotationMgr::Erase( const QString& theEntry, const int theIndex, SALOME_View* theView )
|
||||
@ -190,7 +190,6 @@ void GEOMGUI_AnnotationMgr::Erase( const QString& theEntry, const int theIndex,
|
||||
if ( !anAnnotationToPrs.contains( theIndex ) )
|
||||
return;
|
||||
|
||||
|
||||
// erase presentation from the viewer
|
||||
SALOME_Prs* aPrs = anAnnotationToPrs[theIndex];
|
||||
aView->Erase( getDisplayer(), aPrs );
|
||||
@ -208,7 +207,7 @@ void GEOMGUI_AnnotationMgr::Erase( const QString& theEntry, const int theIndex,
|
||||
myVisualized[aView] = anEntryToAnnotation;
|
||||
|
||||
// change persistent for the entry: set visible state in true for indices which presentations are shown
|
||||
storeVisibleState( theEntry, theView );
|
||||
storeVisibleState( theEntry, theView, theIndex );
|
||||
}
|
||||
|
||||
void GEOMGUI_AnnotationMgr::DisplayVisibleAnnotations( const QString& theEntry, SALOME_View* theView )
|
||||
@ -347,6 +346,10 @@ QString GEOMGUI_AnnotationMgr::getDisplayedIndicesInfo( const QString& theEntry,
|
||||
|
||||
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApplication()->activeStudy() );
|
||||
_PTR(SObject) aSObj = aStudy->studyDS()->FindObjectID( theEntry.toStdString() );
|
||||
if ( !aSObj )
|
||||
{
|
||||
return aDisplayedIndices;
|
||||
}
|
||||
const Handle(GEOMGUI_AnnotationAttrs) aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
|
||||
if ( !aShapeAnnotations.IsNull() )
|
||||
{
|
||||
@ -406,7 +409,7 @@ void GEOMGUI_AnnotationMgr::getObject( const QString& theEntry, const int theInd
|
||||
}
|
||||
}
|
||||
|
||||
void GEOMGUI_AnnotationMgr::storeVisibleState( const QString& theEntry, SALOME_View* theView )
|
||||
void GEOMGUI_AnnotationMgr::storeVisibleState( const QString& theEntry, SALOME_View* theView, const int theIndex )
|
||||
{
|
||||
SALOME_View* aView = viewOrActiveView( theView );
|
||||
if ( !aView || !myVisualized.contains( aView ) )
|
||||
@ -422,12 +425,9 @@ void GEOMGUI_AnnotationMgr::storeVisibleState( const QString& theEntry, SALOME_V
|
||||
_PTR(SObject) aSObj = aStudy->studyDS()->FindObjectID( theEntry.toStdString() );
|
||||
const Handle(GEOMGUI_AnnotationAttrs) aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
|
||||
if ( !aShapeAnnotations.IsNull() ) {
|
||||
const int aCount = aShapeAnnotations->GetNbAnnotation();
|
||||
for ( int anIndex = 0; anIndex < aCount; ++anIndex )
|
||||
{
|
||||
bool aVisible = anAnnotationToPrs.contains( anIndex );
|
||||
aShapeAnnotations->SetIsVisible( anIndex, aVisible );
|
||||
}
|
||||
|
||||
bool aVisible = anAnnotationToPrs.contains( theIndex );
|
||||
aShapeAnnotations->SetIsVisible( theIndex, aVisible );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ protected:
|
||||
GEOM::GEOM_Object_ptr& anObject,
|
||||
GEOMGUI_AnnotationAttrs::Properties& aProperty );
|
||||
|
||||
void storeVisibleState( const QString& theEntry, SALOME_View* theView );
|
||||
void storeVisibleState( const QString& theEntry, SALOME_View* theView, const int theIndex );
|
||||
|
||||
std::string getEntry( const GEOM::GEOM_Object_ptr theObject );
|
||||
|
||||
|
@ -106,10 +106,19 @@ namespace
|
||||
return !myAttr.IsNull() ? myAttr->GetText( theIndex ) : QString();
|
||||
}
|
||||
virtual bool GetIsVisible( const int theIndex ) Standard_OVERRIDE {
|
||||
return annotationMgr()->IsDisplayed(myEntry, theIndex);
|
||||
GEOMGUI_AnnotationMgr* aMgr = annotationMgr();
|
||||
if (!aMgr) {
|
||||
return false;
|
||||
}
|
||||
return aMgr->IsDisplayed( myEntry, theIndex );
|
||||
//return annotationMgr()->IsDisplayed(myEntry, theIndex);
|
||||
//return !myAttr.IsNull() ? myAttr->GetIsVisible( theIndex ) : false;
|
||||
}
|
||||
virtual void SetIsVisible( const int theIndex, const bool theIsVisible ) Standard_OVERRIDE {
|
||||
GEOMGUI_AnnotationMgr* aMgr = annotationMgr();
|
||||
if (!aMgr) {
|
||||
return;
|
||||
}
|
||||
if (theIsVisible)
|
||||
annotationMgr()->Display(myEntry, theIndex);
|
||||
else
|
||||
@ -128,6 +137,9 @@ protected:
|
||||
{
|
||||
CAM_Application* anApp = dynamic_cast<CAM_Application*>(myStudy->application());
|
||||
GeometryGUI* aModule = dynamic_cast<GeometryGUI*>(anApp->activeModule());
|
||||
if (!aModule) {
|
||||
return NULL;
|
||||
}
|
||||
return aModule->GetAnnotationMgr();
|
||||
}
|
||||
|
||||
|
58
src/GEOMGUI/GeometryGUI.cxx
Normal file → Executable file
58
src/GEOMGUI/GeometryGUI.cxx
Normal file → Executable file
@ -2897,6 +2897,7 @@ void GeometryGUI::storeVisualParameters (int savePoint)
|
||||
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy());
|
||||
if ( !appStudy || !appStudy->studyDS() )
|
||||
return;
|
||||
|
||||
_PTR(Study) studyDS = appStudy->studyDS();
|
||||
|
||||
// componentName is used for encoding of entries when storing them in IParameters
|
||||
@ -2914,6 +2915,8 @@ void GeometryGUI::storeVisualParameters (int savePoint)
|
||||
QList<SUIT_ViewManager*> lst;
|
||||
QList<SUIT_ViewManager*>::Iterator it;
|
||||
|
||||
GEOMGUI_AnnotationMgr* aAnnotationMgr = GetAnnotationMgr();
|
||||
|
||||
// main cycle to store parameters of displayed objects
|
||||
lst.clear();
|
||||
getApp()->viewManagers(lst);
|
||||
@ -3045,39 +3048,39 @@ void GeometryGUI::storeVisualParameters (int savePoint)
|
||||
ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::IsosWidth )).toString().toStdString());
|
||||
}
|
||||
|
||||
std::string anAnnotationInfo = GetAnnotationMgr()->getDisplayedIndicesInfo(entry.c_str(), aView).toStdString();
|
||||
if (!anAnnotationInfo.empty()) {
|
||||
param = occParam + "AttributeParameter";
|
||||
ip->setParameter(entry, param.toStdString(), anAnnotationInfo);
|
||||
if ( aAnnotationMgr ) {
|
||||
std::string anAnnotationInfo = GetAnnotationMgr()->getDisplayedIndicesInfo( o_it.key().toLatin1().data(), aView ).toStdString();
|
||||
if (!anAnnotationInfo.empty()) {
|
||||
param = occParam + "ShapeAnnotationVisibleItems";
|
||||
ip->setParameter(entry, param.toStdString(), anAnnotationInfo);
|
||||
}
|
||||
}
|
||||
|
||||
} // object iterator
|
||||
} // for (views)
|
||||
} // for (viewManagers)
|
||||
|
||||
// store dimension attributes of objects:
|
||||
// store shape annotation and dimension attributes of objects:
|
||||
// since the displayed object always persists in property map, we remember the object entries
|
||||
// on the passes when we store viewer related properties - to avoid extra iterations on GEOM component tree.
|
||||
QString aDimensionParam = OCCViewer_Viewer::Type() + GEOM::sectionSeparator() + GEOM::propertyName( GEOM::Dimensions );
|
||||
const QString aDimensionParam = OCCViewer_Viewer::Type() + GEOM::sectionSeparator() + GEOM::propertyName( GEOM::Dimensions );
|
||||
const QString aAnnotationParam = OCCViewer_Viewer::Type() + GEOM::sectionSeparator() + GEOM::propertyName( GEOM::ShapeAnnotations );
|
||||
QSet<QString>::ConstIterator aEntryIt = anEntriesToStoreShared.constBegin();
|
||||
for ( ; aEntryIt != anEntriesToStoreShared.constEnd(); ++aEntryIt )
|
||||
{
|
||||
std::string aStudyEntry = (*aEntryIt).toLatin1().data();
|
||||
std::string aStoreEntry = ip->encodeEntry( aStudyEntry, componentName);
|
||||
std::string aStoreEntry = ip->encodeEntry( aStudyEntry, componentName );
|
||||
|
||||
// store dimension parameters
|
||||
GEOMGUI_DimensionProperty aDimensions( appStudy, aStudyEntry );
|
||||
|
||||
if ( aDimensions.GetNumber() == 0 )
|
||||
{
|
||||
continue;
|
||||
if ( aDimensions.GetNumber() != 0 ) {
|
||||
ip->setParameter( aStoreEntry, aDimensionParam.toStdString(), ((QString)aDimensions).toLatin1().data() );
|
||||
}
|
||||
|
||||
ip->setParameter( aStoreEntry, aDimensionParam.toStdString(), ((QString)aDimensions).toLatin1().data() );
|
||||
|
||||
// store annotation parameters
|
||||
//GetAnnotationMgr()->storeVisualParameters(ip, aStudyEntry);
|
||||
//_PTR(IParameters) ip = ClientFactory::getIParameters(ap);
|
||||
_PTR(SObject) aObj( studyDS->FindObjectID( aStudyEntry ) );
|
||||
const Handle(GEOMGUI_AnnotationAttrs) aShapeAnnAttr = GEOMGUI_AnnotationAttrs::FindAttributes( aObj );
|
||||
if ( !aShapeAnnAttr.IsNull() ) {
|
||||
ip->setParameter( aStoreEntry, aAnnotationParam.toStdString(), aShapeAnnAttr->ExportAsPropertyString().toLatin1().data() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3160,6 +3163,13 @@ void GeometryGUI::restoreVisualParameters (int savePoint)
|
||||
GEOMGUI_DimensionProperty aDimensionProp( aValuesStr );
|
||||
aDimensionProp.SaveToAttribute( appStudy, entry.toLatin1().data() );
|
||||
}
|
||||
else if ( aParamNameStr == GEOM::propertyName( GEOM::ShapeAnnotations ) )
|
||||
{
|
||||
Handle(GEOMGUI_AnnotationAttrs) anAttr =
|
||||
GEOMGUI_AnnotationAttrs::FindOrCreateAttributes( so, appStudy );
|
||||
|
||||
anAttr->ImportFromPropertyString( aValuesStr );
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
@ -3215,8 +3225,8 @@ void GeometryGUI::restoreVisualParameters (int savePoint)
|
||||
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::LineWidth ), val.toInt());
|
||||
} else if (paramNameStr == GEOM::propertyName( GEOM::IsosWidth )) {
|
||||
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::IsosWidth ), val.toInt());
|
||||
} else if (paramNameStr == "AttributeParameter") {
|
||||
aListOfMap[viewIndex].insert( "AttributeParameter", val);
|
||||
} else if (paramNameStr == "ShapeAnnotationVisibleItems") {
|
||||
aListOfMap[viewIndex].insert( "ShapeAnnotationVisibleItems", val);
|
||||
}
|
||||
|
||||
} // for names/parameters iterator
|
||||
@ -3233,9 +3243,9 @@ void GeometryGUI::restoreVisualParameters (int savePoint)
|
||||
SALOME_View* aView = dynamic_cast<SALOME_View*>(vmodel);
|
||||
displayer()->Display(entry, true, aView);
|
||||
|
||||
PropMap aProps = aListOfMap[index];
|
||||
if ( aProps.contains( "AttributeParameter" ) )
|
||||
GetAnnotationMgr()->setDisplayedIndicesInfo( entry, aView, aProps["AttributeParameter"].toString() );
|
||||
PropMap& aProps = aListOfMap[index];
|
||||
if ( aProps.contains( "ShapeAnnotationVisibleItems" ) )
|
||||
GetAnnotationMgr()->setDisplayedIndicesInfo( entry, aView, aProps["ShapeAnnotationVisibleItems"].toString() );
|
||||
}
|
||||
}
|
||||
} // for entries iterator
|
||||
@ -3259,6 +3269,10 @@ void GeometryGUI::restoreVisualParameters (int savePoint)
|
||||
occVMod->Repaint();
|
||||
}
|
||||
}
|
||||
|
||||
if ( myTextTreeWdg ) {
|
||||
myTextTreeWdg->updateTree();
|
||||
}
|
||||
}
|
||||
|
||||
// Compute current name mode of the viewer
|
||||
|
@ -223,7 +223,6 @@ void MeasureGUI_AnnotationDlg::Init()
|
||||
|
||||
// default presentation values
|
||||
myIsPositionDefined = false;
|
||||
myAnnotationProperties.Name = getNewObjectName();
|
||||
myAnnotationProperties.Text = tr( "ANNOTATION_PREFIX" );
|
||||
myAnnotationProperties.IsVisible = false;
|
||||
myAnnotationProperties.IsScreenFixed = false;
|
||||
@ -708,7 +707,6 @@ bool MeasureGUI_AnnotationDlg::execute()
|
||||
Handle(GEOMGUI_AnnotationAttrs) aShapeAnnotations =
|
||||
GEOMGUI_AnnotationAttrs::FindOrCreateAttributes( aSObj, aStudy );
|
||||
|
||||
myAnnotationProperties.Name = getNewObjectName(); // update here as we do not listen name modification
|
||||
myAnnotationProperties.IsVisible = true; // initially created annotation is hidden
|
||||
|
||||
aShapeAnnotations->Append( myAnnotationProperties );
|
||||
|
Loading…
Reference in New Issue
Block a user