Salome HOME
5c3bbc088637187d5ee63c0cd3d746e27c89196f
[modules/shaper.git] / src / SketchSolver / SketchSolver_ConstraintLength.cpp
1 #include <SketchSolver_ConstraintLength.h>
2 #include <SketchSolver_Error.h>
3
4
5 void SketchSolver_ConstraintLength::getAttributes(
6     double& theValue,
7     std::vector<EntityWrapperPtr>& theAttributes)
8 {
9   SketchSolver_Constraint::getAttributes(theValue, theAttributes);
10   if (!myErrorMsg.empty() || !theAttributes[2] || 
11       theAttributes[2]->type() != ENTITY_LINE) {
12     theAttributes.clear();
13     return;
14   }
15
16   // Get boundary points of line segment and create point-point distance constraint
17   std::list<EntityWrapperPtr> aSubs = theAttributes[2]->subEntities();
18   theAttributes.assign(theAttributes.size(), EntityWrapperPtr());
19   std::vector<EntityWrapperPtr>::iterator anAttrIt = theAttributes.begin();
20   std::list<EntityWrapperPtr>::const_iterator aSubIt = aSubs.begin();
21   for (; aSubIt != aSubs.end(); ++aSubIt, ++anAttrIt)
22     *anAttrIt = *aSubIt;
23
24   myType = CONSTRAINT_PT_PT_DISTANCE;
25 }
26