const ModelHighAPI_Double& theY,
const ModelHighAPI_Double& theZ)
{
- //fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_XYZ(), mycreationMethod);
-
- // TODO: Fill point attribute
- //fillAttribute(theX, myx);
- //fillAttribute(theY, myy);
- //fillAttribute(theZ, myz);
-
fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_XYZ(), mycreationMethod);
fillAttribute(theX, theY, theZ, mypoint);
fillAttribute(ConstructionPlugin_Point::GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_GRAVITY(),
mygeometricalPropertyType);
fillAttribute(theObject, myobjectForCenterOfGravity);
+
+ execute();
}
//==================================================================================================
fillAttribute(ConstructionPlugin_Point::GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_CIRCLE(),
mygeometricalPropertyType);
fillAttribute(theObject, myobjectForCenterOfCircle);
+
+ execute();
}
//==================================================================================================
}
myChangedInCode = true;
+ if (theID == BASE_SHAPE_ID() || theID == SUBSHAPES_TO_KEEP_ID() ||
+ theID == SUBSHAPES_TO_REMOVE_ID()) {
+ std::list<ResultPtr> anAllSubs;
+ ModelAPI_Tools::allSubs(aResultBody, anAllSubs);
- if(theID == BASE_SHAPE_ID()) {
- aSubShapesToKeepAttrList->clear();
- aSubShapesToRemoveAttrList->clear();
+ if(theID == BASE_SHAPE_ID()) {
+ aSubShapesToKeepAttrList->clear();
+ aSubShapesToRemoveAttrList->clear();
- if (!aBaseShape.get()) {
- return;
- }
+ if (!aBaseShape.get()) {
+ return;
+ }
- std::list<GeomShapePtr> aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape);
- for (ListOfShape::const_iterator anIt = aSubShapes.cbegin(); anIt != aSubShapes.cend(); ++anIt)
- {
- GeomShapePtr aSubShape = *anIt;
- if(!isHasSubs) {
- aSubShapesToKeepAttrList->append(aContext, aSubShape);
- } else {
- std::list<ResultPtr> anAllSubs;
- ModelAPI_Tools::allSubs(aResultBody, anAllSubs);
- std::list<ResultPtr>::iterator aSubsIt = anAllSubs.begin();
- for(; aSubsIt != anAllSubs.end(); aSubsIt++) {
- ResultBodyPtr aSub = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aSubsIt);
- if (aSub && aSub->shape().get() && aSub->shape()->isSubShape(aSubShape)) {
- aSubShapesToKeepAttrList->append(aSub, aSubShape);
- break;
+ std::list<GeomShapePtr> aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape);
+ ListOfShape::const_iterator anIt = aSubShapes.cbegin();
+ for (; anIt != aSubShapes.cend(); ++anIt)
+ {
+ GeomShapePtr aSubShape = *anIt;
+ if(!isHasSubs) {
+ aSubShapesToKeepAttrList->append(aContext, aSubShape);
+ } else {
+ std::list<ResultPtr>::iterator aSubsIt = anAllSubs.begin();
+ for(; aSubsIt != anAllSubs.end(); aSubsIt++) {
+ ResultBodyPtr aSub = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aSubsIt);
+ if (aSub && aSub->shape().get() && aSub->shape()->isSubShape(aSubShape)) {
+ aSubShapesToKeepAttrList->append(aSub, aSubShape);
+ break;
+ }
}
}
}
}
- }
- else if (theID == SUBSHAPES_TO_KEEP_ID())
- {
- aSubShapesToRemoveAttrList->clear();
+ else if (theID == SUBSHAPES_TO_KEEP_ID())
+ {
+ aSubShapesToRemoveAttrList->clear();
- if (!aBaseShape.get()) {
- return;
- }
+ if (!aBaseShape.get()) {
+ return;
+ }
- int anIndex;
- const int aSubsToKeepNb = aSubShapesToKeepAttrList->size();
- std::list<GeomShapePtr> aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape);
- for (ListOfShape::const_iterator anIt = aSubShapes.cbegin(); anIt != aSubShapes.cend(); ++anIt)
- {
- GeomShapePtr aSubShape = *anIt;
+ int anIndex;
+ // optimization: collect selection attribute values into a map
+ const int aSubsToKeepNb = aSubShapesToKeepAttrList->size();
+ GeomAPI_DataMapOfShapeShape aSubShapesToKeep;
for(anIndex = 0; anIndex < aSubsToKeepNb; ++anIndex) {
AttributeSelectionPtr anAttrSelectionInList = aSubShapesToKeepAttrList->value(anIndex);
GeomShapePtr aSubShapeToKeep = anAttrSelectionInList->value();
- if (aSubShapeToKeep.get() && aSubShapeToKeep->isEqual(aSubShape)) {
- break;
- }
+ if (aSubShapeToKeep.get())
+ aSubShapesToKeep.bind(aSubShapeToKeep, aSubShapeToKeep);
}
- if (anIndex == aSubsToKeepNb) {
+ std::list<GeomShapePtr> aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape);
+ ListOfShape::const_iterator anIt = aSubShapes.cbegin();
+ for (; anIt != aSubShapes.cend(); ++anIt)
+ {
+ GeomShapePtr aSubShape = *anIt;
+ if (aSubShapesToKeep.isBound(aSubShape))
+ continue;
+
if(!isHasSubs) {
aSubShapesToRemoveAttrList->append(aContext, aSubShape);
- } else {
- std::list<ResultPtr> anAllSubs;
- ModelAPI_Tools::allSubs(aResultBody, anAllSubs);
+ }
+ else {
std::list<ResultPtr>::iterator aSubsIt = anAllSubs.begin();
- for(; aSubsIt != anAllSubs.end(); aSubsIt++) {
+ for (; aSubsIt != anAllSubs.end(); aSubsIt++) {
ResultBodyPtr aSub = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aSubsIt);
if (aSub && aSub->shape().get() && aSub->shape()->isSubShape(aSubShape)) {
aSubShapesToRemoveAttrList->append(aSub, aSubShape);
}
}
}
- }
- else if (theID == SUBSHAPES_TO_REMOVE_ID())
- {
- aSubShapesToKeepAttrList->clear();
+ else if (theID == SUBSHAPES_TO_REMOVE_ID())
+ {
+ aSubShapesToKeepAttrList->clear();
- if (!aBaseShape.get()) {
- return;
- }
+ if (!aBaseShape.get()) {
+ return;
+ }
- int anIndex;
- const int aSubsToRemoveNb = aSubShapesToRemoveAttrList->size();
- std::list<GeomShapePtr> aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape);
- for (ListOfShape::const_iterator anIt = aSubShapes.cbegin(); anIt != aSubShapes.cend(); ++anIt)
- {
- GeomShapePtr aSubShape = *anIt;
+ int anIndex;
+ const int aSubsToRemoveNb = aSubShapesToRemoveAttrList->size();
+ GeomAPI_DataMapOfShapeShape aSubShapesToRemove;
for(anIndex = 0; anIndex < aSubsToRemoveNb; ++anIndex) {
AttributeSelectionPtr anAttrSelectionInList = aSubShapesToRemoveAttrList->value(anIndex);
GeomShapePtr aSubShapeToRemove = anAttrSelectionInList->value();
- if (aSubShapeToRemove.get() && aSubShapeToRemove->isEqual(aSubShape)) {
- break;
- }
+ if (aSubShapeToRemove.get())
+ aSubShapesToRemove.bind(aSubShapeToRemove, aSubShapeToRemove);
}
- if (anIndex == aSubsToRemoveNb) {
- if(!isHasSubs) {
+
+ std::list<GeomShapePtr> aSubShapes = GeomAlgoAPI_ShapeTools::getLowLevelSubShapes(aBaseShape);
+ ListOfShape::const_iterator anIt = aSubShapes.cbegin();
+ for (; anIt != aSubShapes.cend(); ++anIt)
+ {
+ GeomShapePtr aSubShape = *anIt;
+ if (aSubShapesToRemove.isBound(aSubShape))
+ continue;
+
+ if (!isHasSubs) {
aSubShapesToKeepAttrList->append(aContext, aSubShape);
- } else {
- std::list<ResultPtr> anAllSubs;
- ModelAPI_Tools::allSubs(aResultBody, anAllSubs);
+ }
+ else {
std::list<ResultPtr>::iterator aSubsIt = anAllSubs.begin();
- for(; aSubsIt != anAllSubs.end(); aSubsIt++) {
+ for (; aSubsIt != anAllSubs.end(); aSubsIt++) {
ResultBodyPtr aSub = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aSubsIt);
if (aSub && aSub->shape().get() && aSub->shape()->isSubShape(aSubShape)) {
aSubShapesToKeepAttrList->append(aSub, aSubShape);
ModelAPI_Session::get()->finishOperation();
if (QFile::exists(aFileName.c_str())) {
- if (isMultiFile) {
QFile aInFile(aFileName.c_str());
- if (!aInFile.open(QIODevice::ReadOnly | QIODevice::Text))
- return false;
- QTextStream aText(&aInFile);
- QString aTrace(aText.readAll());
- aInFile.close();
+ if (!aInFile.open(QIODevice::ReadOnly | QIODevice::Text))
+ return false;
+ QTextStream aText(&aInFile);
+ QString aTrace(aText.readAll());
+ aInFile.close();
+ if (isMultiFile) {
QStringList aBuffer;
- aBuffer.push_back(QString("def RebuildData( theStudy ):"));
+ aBuffer.push_back(QString("def RebuildData():"));
QStringList aList(aTrace.split("\n"));
foreach(QString aStr, aList) {
QString s = " " + aStr;
aBuffer.push_back(s);
}
aTrace = aBuffer.join("\n");
+ }
- QFile aOutFile(aFileName.c_str());
- if (!aOutFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate))
- return false;
+ QFile aOutFile(aFileName.c_str());
+ // binary for SALOME, issue 16931
+ if (!aOutFile.open(QIODevice::WriteOnly | QIODevice::Truncate))
+ return false;
+
+ QTextStream aOut(&aOutFile);
+ aOut << aTrace.toStdString().c_str() << "\n";
+ aOut.flush();
+ aOutFile.close();
- QTextStream aOut(&aOutFile);
- aOut << aTrace.toStdString().c_str() << "\n";
- aOut.flush();
- aOutFile.close();
- }
theListOfFiles.append(aTmpDir.c_str());
theListOfFiles.append(DUMP_NAME);
return true;