if(useStudy){
aPropMap = aStudy->getObjectPropMap(aMgrId,anEntry);
- aDefPropMap = getDefaultPropepryMap(SOCC_Viewer::Type());
- bool isDiff = MergePropertyMaps(aPropMap, aDefPropMap);
-
- if(isDiff)
- aStudy->setObjectPropMap(aMgrId,anEntry,aPropMap);
+ aDefPropMap = getDefaultPropertyMap(SOCC_Viewer::Type());
+ MergePropertyMaps(aPropMap, aDefPropMap);
}
//Handle(GEOM_AISShape) AISShape = new GEOM_AISShape( myShape, "" );
theActors->AddItem( aTrh );
}
else {
- PropMap aDefPropMap = getDefaultPropepryMap(SVTK_Viewer::Type());
+ PropMap aDefPropMap = getDefaultPropertyMap(SVTK_Viewer::Type());
QString anEntry;
if(!myIO.IsNull()) {
theActors->AddItem(aGeomActor);
aGeomActor->Delete();
- if(useStudy){
+ if(useStudy) {
aPropMap = aStudy->getObjectPropMap(aMgrId,anEntry);
- bool isDiff = MergePropertyMaps(aPropMap, aDefPropMap);
- if(isDiff)
- aStudy->setObjectPropMap(aMgrId,anEntry,aPropMap);
+ MergePropertyMaps(aPropMap, aDefPropMap);
}
}
-PropMap GEOM_Displayer::getDefaultPropepryMap(const QString& viewer_type){
+PropMap GEOM_Displayer::getDefaultPropertyMap(const QString& viewer_type) {
PropMap aDefaultMap;
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
//1. Visibility
void GeometryGUI::storeVisualParameters (int savePoint)
{
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy());
- if (!appStudy || !appStudy->studyDS())
+ if ( !appStudy || !appStudy->studyDS() )
return;
_PTR(Study) studyDS = appStudy->studyDS();
//Check that object exists in the study
_PTR(SObject) obj( studyDS->FindObjectID( o_it.key().toLatin1().data() ) );
- if ( !obj )
+ if ( !obj || !(aProps.count() > 0))
continue;
// entry is "encoded" = it does NOT contain component adress, since it is a
// subject to change on next component loading
if( !obj->FindAttribute(anAttr, "AttributeIOR"))
continue;
- std::string param, occParam = vType.toLatin1().data();
+ std::string param,occParam = vType.toLatin1().data();
occParam += NAME_SEPARATOR;
occParam += QString::number(aMgrId).toLatin1().data();
occParam += NAME_SEPARATOR;
- param = occParam + VISIBILITY_PROP;
- ip->setParameter(entry, param, aProps.value(VISIBILITY_PROP).toInt() == 1 ? "On" : "Off");
-
- param = occParam + DISPLAY_MODE_PROP;
-
- ip->setParameter(entry, param, QString::number(aProps.value(DISPLAY_MODE_PROP).toInt()).toLatin1().data());
-
- QColor c = aProps.value(COLOR_PROP).value<QColor>();
- QString colorStr = QString::number(c.red()/255.);
- colorStr += DIGIT_SEPARATOR; colorStr += QString::number(c.green()/255.);
- colorStr += DIGIT_SEPARATOR; colorStr += QString::number(c.blue()/255.);
- param = occParam + COLOR_PROP;
- ip->setParameter(entry, param, colorStr.toLatin1().data());
+ if(aProps.contains(VISIBILITY_PROP)) {
+ param = occParam + VISIBILITY_PROP;
+ ip->setParameter(entry, param, aProps.value(VISIBILITY_PROP).toInt() == 1 ? "On" : "Off");
+ }
+
+ if(aProps.contains(DISPLAY_MODE_PROP)) {
+ param = occParam + DISPLAY_MODE_PROP;
+ 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>();
+ QString colorStr = QString::number(c.red()/255.);
+ colorStr += DIGIT_SEPARATOR; colorStr += QString::number(c.green()/255.);
+ colorStr += DIGIT_SEPARATOR; colorStr += QString::number(c.blue()/255.);
+ param = occParam + COLOR_PROP;
+ ip->setParameter(entry, param, colorStr.toLatin1().data());
+ }
if(vType == SVTK_Viewer::Type()) {
- param = occParam + OPACITY_PROP;
- ip->setParameter(entry, param, QString::number(1. - aProps.value(TRANSPARENCY_PROP).toDouble()).toLatin1().data());
+ if(aProps.contains(OPACITY_PROP)) {
+ param = occParam + OPACITY_PROP;
+ ip->setParameter(entry, param, QString::number(1. - aProps.value(TRANSPARENCY_PROP).toDouble()).toLatin1().data());
+ }
} else if (vType == SOCC_Viewer::Type()) {
- param = occParam + TRANSPARENCY_PROP;
- ip->setParameter(entry, param, QString::number(aProps.value(TRANSPARENCY_PROP).toDouble()).toLatin1().data());
+ if(aProps.contains(TRANSPARENCY_PROP)) {
+ param = occParam + TRANSPARENCY_PROP;
+ ip->setParameter(entry, param, QString::number(aProps.value(TRANSPARENCY_PROP).toDouble()).toLatin1().data());
+ }
}
- param = occParam + ISOS_PROP;
- ip->setParameter(entry, param, aProps.value(ISOS_PROP).toString().toLatin1().data());
-
- param = occParam + VECTOR_MODE_PROP;
- ip->setParameter(entry, param, QString::number(aProps.value(VECTOR_MODE_PROP).toInt()).toLatin1().data());
-
- param = occParam + DEFLECTION_COEFF_PROP;
- ip->setParameter(entry, param, QString::number(aProps.value(DEFLECTION_COEFF_PROP).toDouble()).toLatin1().data());
-
+ if(aProps.contains(ISOS_PROP)) {
+ param = occParam + ISOS_PROP;
+ ip->setParameter(entry, param, aProps.value(ISOS_PROP).toString().toLatin1().data());
+ }
+
+ if(aProps.contains(VECTOR_MODE_PROP)) {
+ param = occParam + VECTOR_MODE_PROP;
+ 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;
+ 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"
if(aProps.contains(MARKER_TYPE_PROP)) {
param = occParam + MARKER_TYPE_PROP;
ip->setParameter(entry, param, aProps.value(MARKER_TYPE_PROP).toString().toLatin1().data());
- }
-
+ }
} // object iterator
} // for (views)
} // for (viewManagers)
}
+
/*!
* \brief Restore visual parameters
*
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.
char* script = aStudy->GetDefaultScript(ComponentDataType(), "\t");
if (script && strlen(script) > 0) {