From: azv Date: Wed, 16 Dec 2015 05:18:01 +0000 (+0300) Subject: Add arc to solver if any its attribute is added X-Git-Tag: V_2.1.0~123 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0b5a982a51a44fd23b53772325922fd93ebb126e;p=modules%2Fshaper.git Add arc to solver if any its attribute is added --- diff --git a/src/SketchSolver/SketchSolver_Manager.cpp b/src/SketchSolver/SketchSolver_Manager.cpp index 34b2ea040..354a3d9d8 100644 --- a/src/SketchSolver/SketchSolver_Manager.cpp +++ b/src/SketchSolver/SketchSolver_Manager.cpp @@ -258,8 +258,11 @@ bool SketchSolver_Manager::changeFeature(std::shared_ptr t } if (aConstraint) - return (*aFirstGroupIter)->changeConstraint(aConstraint); - return (*aFirstGroupIter)->updateFeature(theFeature); + (*aFirstGroupIter)->changeConstraint(aConstraint); + else + (*aFirstGroupIter)->updateFeature(theFeature); + // groups are merged => need to resolve them + return true; } // Something goes wrong diff --git a/src/SketchSolver/SketchSolver_Storage.cpp b/src/SketchSolver/SketchSolver_Storage.cpp index 2e283a90f..e440a795b 100644 --- a/src/SketchSolver/SketchSolver_Storage.cpp +++ b/src/SketchSolver/SketchSolver_Storage.cpp @@ -132,6 +132,20 @@ bool SketchSolver_Storage::update(AttributePtr theAttribute, const GroupID& theG EntityWrapperPtr aRelated = entity(anAttribute); if (!aRelated) { // Attribute is not exist, create it + // verify the attribute is a point of arc and add whole arc + if (anAttribute->owner()) { + FeaturePtr aFeature = ModelAPI_Feature::feature(anAttribute->owner()); + if (aFeature->getKind() == SketchPlugin_Arc::ID() && + myFeatureMap.find(aFeature) == myFeatureMap.end()) { + // Additional checking that all attributes are initialized + if (aFeature->attribute(SketchPlugin_Arc::CENTER_ID())->isInitialized() && + aFeature->attribute(SketchPlugin_Arc::START_ID())->isInitialized() && + aFeature->attribute(SketchPlugin_Arc::END_ID())->isInitialized()) { +//// myFeatureMap[aFeature] = EntityWrapperPtr(); + return SketchSolver_Storage::update(aFeature); + } + } + } BuilderPtr aBuilder = SketchSolver_Manager::instance()->builder(); GroupID aGroup = theGroup != GID_UNKNOWN ? theGroup : myGroupID; aRelated = aBuilder->createAttribute(anAttribute, aGroup); diff --git a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp index d48730926..96b7ec077 100644 --- a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp +++ b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Storage.cpp @@ -184,21 +184,6 @@ bool SolveSpaceSolver_Storage::update(EntityWrapperPtr& theEntity) if (anEntity->type() == ENTITY_SKETCH) storeWorkplane(anEntity); - - // For the correct work with arcs we will add them if their parameter is added - if (theEntity->baseAttribute()) { - FeaturePtr aFeature = ModelAPI_Feature::feature(theEntity->baseAttribute()->owner()); - if (aFeature->getKind() == SketchPlugin_Arc::ID() && - myFeatureMap.find(aFeature) == myFeatureMap.end()) { - // Additional checking that all attributes are initialized - if (aFeature->attribute(SketchPlugin_Arc::CENTER_ID())->isInitialized() && - aFeature->attribute(SketchPlugin_Arc::START_ID())->isInitialized() && - aFeature->attribute(SketchPlugin_Arc::END_ID())->isInitialized()) { - myFeatureMap[aFeature] = EntityWrapperPtr(); - return SketchSolver_Storage::update(aFeature); - } - } - } } return isUpdated;