mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-13 18:20:35 +05:00
Fix for the bug "IPAL22425 TC6.3.0: Wrong Dump of Study".
This commit is contained in:
parent
88ffbe62e8
commit
8de0df2005
@ -615,11 +615,8 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
|
|||||||
|
|
||||||
if(useStudy){
|
if(useStudy){
|
||||||
aPropMap = aStudy->getObjectPropMap(aMgrId,anEntry);
|
aPropMap = aStudy->getObjectPropMap(aMgrId,anEntry);
|
||||||
aDefPropMap = getDefaultPropepryMap(SOCC_Viewer::Type());
|
aDefPropMap = getDefaultPropertyMap(SOCC_Viewer::Type());
|
||||||
bool isDiff = MergePropertyMaps(aPropMap, aDefPropMap);
|
MergePropertyMaps(aPropMap, aDefPropMap);
|
||||||
|
|
||||||
if(isDiff)
|
|
||||||
aStudy->setObjectPropMap(aMgrId,anEntry,aPropMap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Handle(GEOM_AISShape) AISShape = new GEOM_AISShape( myShape, "" );
|
//Handle(GEOM_AISShape) AISShape = new GEOM_AISShape( myShape, "" );
|
||||||
@ -984,7 +981,7 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
|
|||||||
theActors->AddItem( aTrh );
|
theActors->AddItem( aTrh );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PropMap aDefPropMap = getDefaultPropepryMap(SVTK_Viewer::Type());
|
PropMap aDefPropMap = getDefaultPropertyMap(SVTK_Viewer::Type());
|
||||||
|
|
||||||
QString anEntry;
|
QString anEntry;
|
||||||
if(!myIO.IsNull()) {
|
if(!myIO.IsNull()) {
|
||||||
@ -1002,9 +999,7 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
|
|||||||
|
|
||||||
if(useStudy) {
|
if(useStudy) {
|
||||||
aPropMap = aStudy->getObjectPropMap(aMgrId,anEntry);
|
aPropMap = aStudy->getObjectPropMap(aMgrId,anEntry);
|
||||||
bool isDiff = MergePropertyMaps(aPropMap, aDefPropMap);
|
MergePropertyMaps(aPropMap, aDefPropMap);
|
||||||
if(isDiff)
|
|
||||||
aStudy->setObjectPropMap(aMgrId,anEntry,aPropMap);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1689,7 +1684,7 @@ SALOMEDS::Color GEOM_Displayer::getUniqueColor( const QList<SALOMEDS::Color>& th
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
PropMap GEOM_Displayer::getDefaultPropepryMap(const QString& viewer_type){
|
PropMap GEOM_Displayer::getDefaultPropertyMap(const QString& viewer_type) {
|
||||||
PropMap aDefaultMap;
|
PropMap aDefaultMap;
|
||||||
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
|
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
|
||||||
//1. Visibility
|
//1. Visibility
|
||||||
|
@ -160,7 +160,7 @@ public:
|
|||||||
|
|
||||||
static SALOMEDS::Color getUniqueColor( const QList<SALOMEDS::Color>& );
|
static SALOMEDS::Color getUniqueColor( const QList<SALOMEDS::Color>& );
|
||||||
|
|
||||||
static PropMap getDefaultPropepryMap(const QString& viewer_type);
|
static PropMap getDefaultPropertyMap(const QString& viewer_type);
|
||||||
|
|
||||||
static bool MergePropertyMaps(PropMap& theOrigin, PropMap& theDefault);
|
static bool MergePropertyMaps(PropMap& theOrigin, PropMap& theDefault);
|
||||||
|
|
||||||
|
@ -1739,7 +1739,7 @@ void GeometryGUI::storeVisualParameters (int savePoint)
|
|||||||
|
|
||||||
//Check that object exists in the study
|
//Check that object exists in the study
|
||||||
_PTR(SObject) obj( studyDS->FindObjectID( o_it.key().toLatin1().data() ) );
|
_PTR(SObject) obj( studyDS->FindObjectID( o_it.key().toLatin1().data() ) );
|
||||||
if ( !obj )
|
if ( !obj || !(aProps.count() > 0))
|
||||||
continue;
|
continue;
|
||||||
// entry is "encoded" = it does NOT contain component adress, since it is a
|
// entry is "encoded" = it does NOT contain component adress, since it is a
|
||||||
// subject to change on next component loading
|
// subject to change on next component loading
|
||||||
@ -1755,47 +1755,62 @@ void GeometryGUI::storeVisualParameters (int savePoint)
|
|||||||
occParam += QString::number(aMgrId).toLatin1().data();
|
occParam += QString::number(aMgrId).toLatin1().data();
|
||||||
occParam += NAME_SEPARATOR;
|
occParam += NAME_SEPARATOR;
|
||||||
|
|
||||||
|
if(aProps.contains(VISIBILITY_PROP)) {
|
||||||
param = occParam + VISIBILITY_PROP;
|
param = occParam + VISIBILITY_PROP;
|
||||||
ip->setParameter(entry, param, aProps.value(VISIBILITY_PROP).toInt() == 1 ? "On" : "Off");
|
ip->setParameter(entry, param, aProps.value(VISIBILITY_PROP).toInt() == 1 ? "On" : "Off");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(aProps.contains(DISPLAY_MODE_PROP)) {
|
||||||
param = occParam + DISPLAY_MODE_PROP;
|
param = occParam + DISPLAY_MODE_PROP;
|
||||||
|
|
||||||
ip->setParameter(entry, param, QString::number(aProps.value(DISPLAY_MODE_PROP).toInt()).toLatin1().data());
|
ip->setParameter(entry, param, QString::number(aProps.value(DISPLAY_MODE_PROP).toInt()).toLatin1().data());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(aProps.contains(COLOR_PROP)) {
|
||||||
QColor c = aProps.value(COLOR_PROP).value<QColor>();
|
QColor c = aProps.value(COLOR_PROP).value<QColor>();
|
||||||
QString colorStr = QString::number(c.red()/255.);
|
QString colorStr = QString::number(c.red()/255.);
|
||||||
colorStr += DIGIT_SEPARATOR; colorStr += QString::number(c.green()/255.);
|
colorStr += DIGIT_SEPARATOR; colorStr += QString::number(c.green()/255.);
|
||||||
colorStr += DIGIT_SEPARATOR; colorStr += QString::number(c.blue()/255.);
|
colorStr += DIGIT_SEPARATOR; colorStr += QString::number(c.blue()/255.);
|
||||||
param = occParam + COLOR_PROP;
|
param = occParam + COLOR_PROP;
|
||||||
ip->setParameter(entry, param, colorStr.toLatin1().data());
|
ip->setParameter(entry, param, colorStr.toLatin1().data());
|
||||||
|
}
|
||||||
|
|
||||||
if(vType == SVTK_Viewer::Type()) {
|
if(vType == SVTK_Viewer::Type()) {
|
||||||
|
if(aProps.contains(OPACITY_PROP)) {
|
||||||
param = occParam + OPACITY_PROP;
|
param = occParam + OPACITY_PROP;
|
||||||
ip->setParameter(entry, param, QString::number(1. - aProps.value(TRANSPARENCY_PROP).toDouble()).toLatin1().data());
|
ip->setParameter(entry, param, QString::number(1. - aProps.value(TRANSPARENCY_PROP).toDouble()).toLatin1().data());
|
||||||
|
}
|
||||||
} else if (vType == SOCC_Viewer::Type()) {
|
} else if (vType == SOCC_Viewer::Type()) {
|
||||||
|
if(aProps.contains(TRANSPARENCY_PROP)) {
|
||||||
param = occParam + TRANSPARENCY_PROP;
|
param = occParam + TRANSPARENCY_PROP;
|
||||||
ip->setParameter(entry, param, QString::number(aProps.value(TRANSPARENCY_PROP).toDouble()).toLatin1().data());
|
ip->setParameter(entry, param, QString::number(aProps.value(TRANSPARENCY_PROP).toDouble()).toLatin1().data());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(aProps.contains(ISOS_PROP)) {
|
||||||
param = occParam + ISOS_PROP;
|
param = occParam + ISOS_PROP;
|
||||||
ip->setParameter(entry, param, aProps.value(ISOS_PROP).toString().toLatin1().data());
|
ip->setParameter(entry, param, aProps.value(ISOS_PROP).toString().toLatin1().data());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(aProps.contains(VECTOR_MODE_PROP)) {
|
||||||
param = occParam + VECTOR_MODE_PROP;
|
param = occParam + VECTOR_MODE_PROP;
|
||||||
ip->setParameter(entry, param, QString::number(aProps.value(VECTOR_MODE_PROP).toInt()).toLatin1().data());
|
ip->setParameter(entry, param, QString::number(aProps.value(VECTOR_MODE_PROP).toInt()).toLatin1().data());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(aProps.contains(DEFLECTION_COEFF_PROP)) {
|
||||||
param = occParam + DEFLECTION_COEFF_PROP;
|
param = occParam + DEFLECTION_COEFF_PROP;
|
||||||
ip->setParameter(entry, param, QString::number(aProps.value(DEFLECTION_COEFF_PROP).toDouble()).toLatin1().data());
|
ip->setParameter(entry, param, QString::number(aProps.value(DEFLECTION_COEFF_PROP).toDouble()).toLatin1().data());
|
||||||
|
}
|
||||||
|
|
||||||
//Marker type of the vertex - ONLY for the "Vertex" and "Compound of the Vertex"
|
//Marker type of the vertex - ONLY for the "Vertex" and "Compound of the Vertex"
|
||||||
if(aProps.contains(MARKER_TYPE_PROP)) {
|
if(aProps.contains(MARKER_TYPE_PROP)) {
|
||||||
param = occParam + MARKER_TYPE_PROP;
|
param = occParam + MARKER_TYPE_PROP;
|
||||||
ip->setParameter(entry, param, aProps.value(MARKER_TYPE_PROP).toString().toLatin1().data());
|
ip->setParameter(entry, param, aProps.value(MARKER_TYPE_PROP).toString().toLatin1().data());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // object iterator
|
} // object iterator
|
||||||
} // for (views)
|
} // for (views)
|
||||||
} // for (viewManagers)
|
} // for (viewManagers)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Restore visual parameters
|
* \brief Restore visual parameters
|
||||||
*
|
*
|
||||||
|
@ -132,6 +132,34 @@ Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
|
|||||||
|
|
||||||
if (isPublished)
|
if (isPublished)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
SALOMEDS::AttributeParameter_var ap = aStudy->GetModuleParameters("Interface Applicative",
|
||||||
|
ComponentDataType(),
|
||||||
|
-1);
|
||||||
|
if(!CORBA::is_nil(ap)) {
|
||||||
|
//Add the id parameter of the object
|
||||||
|
std::vector<TObjectData>::iterator it = objectDataVec.begin();
|
||||||
|
for( ;it != objectDataVec.end(); it++ ) {
|
||||||
|
|
||||||
|
//1. Encode entry
|
||||||
|
std::string tail( (*it)._studyEntry.ToCString(), 6, (*it)._studyEntry.Length()-1 );
|
||||||
|
std::string newEntry(ComponentDataType());
|
||||||
|
newEntry+=("_"+tail);
|
||||||
|
|
||||||
|
CORBA::String_var anEntry = CORBA::string_dup(newEntry.c_str());
|
||||||
|
|
||||||
|
if( ap->IsSet(anEntry, 6) ) { //6 Means string array, see SALOMEDS_Attributes.idl AttributeParameter interface
|
||||||
|
std::string idCommand = std::string("geompy.getObjectID(") + GetDumpName((*it)._studyEntry.ToCString()) + std::string(")");
|
||||||
|
SALOMEDS::StringSeq_var aSeq= ap->GetStrArray(anEntry);
|
||||||
|
int oldLenght = aSeq->length();
|
||||||
|
aSeq->length(oldLenght+2);
|
||||||
|
aSeq[oldLenght] = CORBA::string_dup("_PT_OBJECT_ID_");
|
||||||
|
aSeq[oldLenght + 1] = CORBA::string_dup(idCommand.c_str());
|
||||||
|
ap->SetStrArray( anEntry, aSeq );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Output the script that sets up the visual parameters.
|
//Output the script that sets up the visual parameters.
|
||||||
char* script = aStudy->GetDefaultScript(ComponentDataType(), "\t");
|
char* script = aStudy->GetDefaultScript(ComponentDataType(), "\t");
|
||||||
if (script && strlen(script) > 0) {
|
if (script && strlen(script) > 0) {
|
||||||
|
@ -4694,6 +4694,22 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
|||||||
RaiseIfFailed("LoadTexture", self.InsertOp)
|
RaiseIfFailed("LoadTexture", self.InsertOp)
|
||||||
return ID
|
return ID
|
||||||
|
|
||||||
|
## Get entry of the object
|
||||||
|
# @param obj geometry object
|
||||||
|
# @return unique object identifier
|
||||||
|
# @ingroup l1_geompy_auxiliary
|
||||||
|
def getObjectID(self, obj):
|
||||||
|
ID = ""
|
||||||
|
entry = salome.ObjectToID(obj)
|
||||||
|
if entry is not None:
|
||||||
|
lst = entry.split(":")
|
||||||
|
if len(lst) > 0:
|
||||||
|
ID = lst[-1] # -1 means last item in the list
|
||||||
|
return "GEOM_" + ID
|
||||||
|
return ID
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Add marker texture. @a Width and @a Height parameters
|
## Add marker texture. @a Width and @a Height parameters
|
||||||
# specify width and height of the texture in pixels.
|
# specify width and height of the texture in pixels.
|
||||||
# If @a RowData is @c True, @a Texture parameter should represent texture data
|
# If @a RowData is @c True, @a Texture parameter should represent texture data
|
||||||
|
Loading…
Reference in New Issue
Block a user