1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: SketchPlugin_Validators.cpp
4 // Created: 01 Aug 2014
5 // Author: Vitaly SMETANNIKOV
7 #include "SketchPlugin_Validators.h"
9 #include "SketchPlugin_Arc.h"
10 #include "SketchPlugin_Circle.h"
11 #include "SketchPlugin_ConstraintCoincidence.h"
12 #include "SketchPlugin_ConstraintDistance.h"
13 #include "SketchPlugin_ConstraintRigid.h"
14 #include "SketchPlugin_Line.h"
15 #include "SketchPlugin_Point.h"
16 #include "SketchPlugin_Sketch.h"
17 #include "SketchPlugin_Tools.h"
19 #include "SketcherPrs_Tools.h"
21 #include <ModelAPI_Data.h>
22 #include <ModelAPI_Validator.h>
23 #include <ModelAPI_AttributeDouble.h>
24 #include <ModelAPI_AttributeRefAttr.h>
25 #include <ModelAPI_AttributeRefList.h>
26 #include <ModelAPI_AttributeSelectionList.h>
27 #include <ModelAPI_AttributeString.h>
28 #include <ModelAPI_Session.h>
30 #include <GeomDataAPI_Point2D.h>
32 const double tolerance = 1.e-7;
34 bool SketchPlugin_DistanceAttrValidator::isValid(const AttributePtr& theAttribute,
35 const std::list<std::string>& theArguments,
36 std::string& theError) const
38 if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) {
39 theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed";
43 // there is a check whether the feature contains a point and a linear edge or two point values
44 std::string aParamA = theArguments.front();
45 SessionPtr aMgr = ModelAPI_Session::get();
46 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
48 AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
49 bool isObject = aRefAttr->isObject();
51 // an attribute is a point. A point value is valid always for the distance
54 // 1. check whether the references object is a linear
55 ObjectPtr anObject = aRefAttr->object();
57 const ModelAPI_AttributeValidator* aShapeValidator =
58 dynamic_cast<const ModelAPI_AttributeValidator*>(aFactory->validator("GeomValidators_ShapeType"));
59 std::list<std::string> anArguments;
60 anArguments.push_back("circle");
61 std::string aCircleError;
62 bool aShapeValid = aShapeValidator->isValid(aRefAttr, anArguments, aCircleError);
63 // the circle line is not a valid case
65 theError = "Circle can not be used in distance constraint";
70 anArguments.push_back("line");
71 std::string aLineError;
72 aShapeValid = aShapeValidator->isValid(aRefAttr, anArguments, aLineError);
73 // if the attribute value is not a line, that means it is a vertex. A vertex is always valid
75 FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
76 // If it is a line then we have to check that first attribute id not a line
77 std::shared_ptr<SketchPlugin_Feature> aSFeature =
78 std::dynamic_pointer_cast<SketchPlugin_Feature>(theAttribute->owner());
79 SketchPlugin_Sketch* aSketch = aSFeature->sketch();
80 std::shared_ptr<GeomAPI_Ax3> aPlane = SketchPlugin_Sketch::plane(aSketch);
81 std::shared_ptr<GeomDataAPI_Point2D> aPoint = SketcherPrs_Tools::getFeaturePoint(
82 aFeature->data(), aParamA, aPlane);
84 theError = "One of parameters of distance constraint should be a point";
92 bool SketchPlugin_TangentAttrValidator::isValid(const AttributePtr& theAttribute,
93 const std::list<std::string>& theArguments,
94 std::string& theError) const
96 if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) {
97 theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed";
101 // there is a check whether the feature contains a point and a linear edge or two point values
102 std::string aParamA = theArguments.front();
103 SessionPtr aMgr = ModelAPI_Session::get();
104 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
106 FeaturePtr anAttributeFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
107 AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
109 bool isObject = aRefAttr->isObject();
110 ObjectPtr anObject = aRefAttr->object();
111 if (isObject && anObject.get()) {
112 FeaturePtr aRefFea = ModelAPI_Feature::feature(anObject);
114 AttributeRefAttrPtr aOtherAttr = anAttributeFeature->data()->refattr(aParamA);
115 ObjectPtr aOtherObject = aOtherAttr->object();
116 FeaturePtr aOtherFea = ModelAPI_Feature::feature(aOtherObject);
118 if (aRefFea->getKind() == SketchPlugin_Line::ID()) {
119 if (aOtherFea->getKind() != SketchPlugin_Arc::ID()) {
120 theError = "It refers to a " + SketchPlugin_Line::ID() + ", but " + aParamA + " is not an "
121 + SketchPlugin_Arc::ID();
125 else if (aRefFea->getKind() == SketchPlugin_Arc::ID()) {
126 if (aOtherFea->getKind() != SketchPlugin_Line::ID() &&
127 aOtherFea->getKind() != SketchPlugin_Arc::ID()) {
128 theError = "It refers to an " + SketchPlugin_Arc::ID() + ", but " + aParamA + " is not a "
129 + SketchPlugin_Line::ID() + " or an " + SketchPlugin_Arc::ID();
134 theError = "It refers to " + aRefFea->getKind() + "but should refer to " + SketchPlugin_Line::ID()
135 + " or " + SketchPlugin_Arc::ID();
141 theError = "It uses an empty object";
148 bool SketchPlugin_NotFixedValidator::isValid(const AttributePtr& theAttribute,
149 const std::list<std::string>& theArguments,
150 std::string& theError) const
152 if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) {
153 theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed";
157 std::shared_ptr<SketchPlugin_Feature> aFeature =
158 std::dynamic_pointer_cast<SketchPlugin_Feature>(theAttribute->owner());
162 AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
164 SketchPlugin_Sketch* aSketch = aFeature->sketch();
165 int aNbFeatures = aSketch->numberOfSubs();
166 for (int anInd = 0; anInd < aNbFeatures; anInd++) {
167 FeaturePtr aSubFeature = aSketch->subFeature(anInd);
168 if (aSubFeature->getKind() != SketchPlugin_ConstraintRigid::ID() || aSubFeature == aFeature)
170 AttributeRefAttrPtr aRAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
171 aSubFeature->attribute(SketchPlugin_ConstraintRigid::ENTITY_A()));
172 if (aRefAttr->isObject()) {
173 if (aRefAttr->object() == aRAttr->object()) {
174 ObjectPtr anObject = aRefAttr->object();
175 std::string aName = anObject.get() ? anObject->data()->name() : "";
176 theError = "The object " + aName + " has been already fixed.";
180 else if (aRefAttr->attr() == aRAttr->attr()) {
181 AttributePtr anAttribute = aRefAttr->attr();
182 std::string aName = anAttribute.get() ? anAttribute->id() : "";
183 theError = "The attribute " + aName + " has been already fixed.";
190 bool SketchPlugin_EqualAttrValidator::isValid(const AttributePtr& theAttribute,
191 const std::list<std::string>& theArguments,
192 std::string& theError) const
194 if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) {
195 theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed";
199 std::string aParamA = theArguments.front();
200 FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
201 AttributeRefAttrPtr aRefAttr[2];
202 aRefAttr[0] = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
203 aRefAttr[1] = aFeature->data()->refattr(aParamA);
205 if (!aRefAttr[0]->isObject() || !aRefAttr[1]->isObject()) {
206 theError = "Attributes can not be used in equal constraint";
210 int aType[2] = {0, 0}; // types of attributes: 0 - incorrect, 1 - line, 2 - circle, 3 - arc
211 std::list<std::string> anArguments;
212 for (int i = 0; i < 2; i++) {
213 ObjectPtr anObject = aRefAttr[i]->object();
214 if (!anObject.get()) {
215 theError = "An empty object is used.";
219 aFeature = ModelAPI_Feature::feature(anObject);
220 if (!aFeature.get()) {
221 theError = "An empty feature is used.";
225 if (aFeature->getKind() == SketchPlugin_Line::ID()) {
229 if (aFeature->getKind() == SketchPlugin_Circle::ID()) {
233 if (aFeature->getKind() == SketchPlugin_Arc::ID()) {
237 theError = "The " + aFeature->getKind() + " feature kind of attribute is wrong. It should be " +
238 SketchPlugin_Line::ID() + " or " + SketchPlugin_Circle::ID() + " or " +
239 SketchPlugin_Arc::ID();
240 // wrong type of attribute
244 if ((aType[0] == 1 && aType[1] == 2) ||
245 (aType[0] == 2 && aType[1] == 1)) {
246 theError = "Feature with kinds " + SketchPlugin_Line::ID() + " and " +
247 SketchPlugin_Circle::ID() + "can not be equal.";
253 bool SketchPlugin_MirrorAttrValidator::isValid(const AttributePtr& theAttribute,
254 const std::list<std::string>& theArguments,
255 std::string& theError) const
257 if (theAttribute->attributeType() != ModelAPI_AttributeRefList::typeId()) {
258 theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed";
262 FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
263 AttributeRefListPtr aSelAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(theAttribute);
265 AttributeRefListPtr aRefListOfMirrored = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(
266 aFeature->attribute(SketchPlugin_Constraint::ENTITY_C()));
267 std::list<ObjectPtr> aMirroredObjects = aRefListOfMirrored->list();
269 for(int anInd = 0; anInd < aSelAttr->size(); anInd++) {
270 ObjectPtr aSelObject = aSelAttr->object(anInd);
271 std::string aName = aSelObject.get() ? aSelObject->data()->name() : "";
272 std::list<ObjectPtr>::iterator aMirIter = aMirroredObjects.begin();
273 for (; aMirIter != aMirroredObjects.end(); aMirIter++)
274 if (aSelObject == *aMirIter) {
275 theError = "The object " + aName + " is a result of mirror";
283 bool SketchPlugin_CoincidenceAttrValidator::isValid(const AttributePtr& theAttribute,
284 const std::list<std::string>& theArguments,
285 std::string& theError) const
287 if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) {
288 theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed";
292 // there is a check whether the feature contains a point and a linear edge or two point values
293 std::string aParamA = theArguments.front();
294 SessionPtr aMgr = ModelAPI_Session::get();
295 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
297 FeaturePtr aConstraint = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
298 AttributeRefAttrPtr aRefAttrA = aConstraint->data()->refattr(aParamA);
300 theError = "The " + aParamA + " attribute " + " should be " + ModelAPI_AttributeRefAttr::typeId();
304 AttributeRefAttrPtr aRefAttrB = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
306 // first attribute is a point, it may coincide with any object
307 if (!aRefAttrA->isObject())
310 ObjectPtr anObject = aRefAttrA->object();
311 if (!anObject.get()) {
312 theError = aParamA + " attribute has an empty object";
315 FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttrA->object());
316 if (!aFeature.get()) {
317 theError = aParamA + " attribute has an empty feature";
321 if (aFeature->getKind() == SketchPlugin_Point::ID())
325 // second attribute is a point, it may coincide with any object
326 if (!aRefAttrB->isObject())
329 FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttrB->object());
331 theError = theAttribute->id() + " attribute has an empty object";
334 if (aFeature->getKind() == SketchPlugin_Point::ID())
337 theError = "There is no an attribute filled by a point";
342 bool SketchPlugin_CopyValidator::isValid(const AttributePtr& theAttribute,
343 const std::list<std::string>& theArguments,
344 std::string& theError) const
346 if (theAttribute->attributeType() != ModelAPI_AttributeRefList::typeId()) {
347 theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed";
351 FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
352 AttributeRefListPtr aSelAttr =
353 std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(theAttribute);
355 AttributeRefListPtr aRefListOfInitial = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(
356 aFeature->attribute(SketchPlugin_Constraint::ENTITY_A()));
357 AttributeRefListPtr aRefListOfCopied = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(
358 aFeature->attribute(SketchPlugin_Constraint::ENTITY_B()));
359 std::list<ObjectPtr> anInitialObjects = aRefListOfInitial->list();
360 std::list<ObjectPtr> aCopiedObjects = aRefListOfCopied->list();
362 std::list<ObjectPtr>::iterator anObjIter;
363 for(int anInd = 0; anInd < aSelAttr->size(); anInd++) {
364 ObjectPtr aSelObject = aSelAttr->object(anInd);
365 anObjIter = anInitialObjects.begin();
366 for (; anObjIter != anInitialObjects.end(); anObjIter++)
367 if (aSelObject == *anObjIter)
369 if (anObjIter != anInitialObjects.end())
371 anObjIter = aCopiedObjects.begin();
372 for (; anObjIter != aCopiedObjects.end(); anObjIter++)
373 if (aSelObject == *anObjIter) {
374 std::string aName = aSelObject.get() ? aSelObject->data()->name() : "";
375 theError = "The object " + aName + " is a result of copy";
382 bool SketchPlugin_SolverErrorValidator::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
383 const std::list<std::string>& theArguments,
384 std::string& theError) const
386 AttributeStringPtr aAttributeString = theFeature->string(SketchPlugin_Sketch::SOLVER_ERROR());
388 if (!aAttributeString->value().empty()) {
389 theError = aAttributeString->value();
396 bool SketchPlugin_SolverErrorValidator::isNotObligatory(std::string theFeature, std::string theAttribute)
401 bool SketchPlugin_FilletVertexValidator::isValid(const AttributePtr& theAttribute,
402 const std::list<std::string>& theArguments,
403 std::string& theError) const
405 if(!theAttribute.get()) {
409 AttributeRefAttrPtr aBase = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
410 AttributePtr anAttrBase = aBase->attr();
411 if(aBase->isObject()) {
415 // If we alredy have some result then:
416 // - if it is the same point all ok
417 // - if it is point on the fillet arc then it is not valid
418 FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
419 AttributePtr aBaseLinesAttribute = aFeature->attribute(SketchPlugin_Constraint::ENTITY_C());
420 AttributeRefListPtr aRefListOfBaseLines = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(aBaseLinesAttribute);
421 std::list<ObjectPtr> anOldFeatList = aRefListOfBaseLines->list();
422 if(!aRefListOfBaseLines->list().empty()) {
423 FeaturePtr anOldFeatureA, anOldFeatureB;
424 std::list<ObjectPtr>::iterator aFeatIt = anOldFeatList.begin();
425 anOldFeatureA = ModelAPI_Feature::feature(*aFeatIt++);
426 anOldFeatureB = ModelAPI_Feature::feature(*aFeatIt);
428 AttributePtr anAttrStartA =
429 anOldFeatureA->attribute(anOldFeatureA->getKind() == SketchPlugin_Line::ID() ? SketchPlugin_Line::START_ID() : SketchPlugin_Arc::START_ID());
430 AttributePtr anAttrEndA =
431 anOldFeatureA->attribute(anOldFeatureA->getKind() == SketchPlugin_Line::ID() ? SketchPlugin_Line::END_ID() : SketchPlugin_Arc::END_ID());
432 AttributePtr anAttrStartB =
433 anOldFeatureB->attribute(anOldFeatureB->getKind() == SketchPlugin_Line::ID() ? SketchPlugin_Line::START_ID() : SketchPlugin_Arc::START_ID());
434 AttributePtr anAttrEndB =
435 anOldFeatureB->attribute(anOldFeatureB->getKind() == SketchPlugin_Line::ID() ? SketchPlugin_Line::END_ID() : SketchPlugin_Arc::END_ID());
437 std::shared_ptr<GeomAPI_Pnt2d> aBasePnt = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAttrBase)->pnt();
438 std::shared_ptr<GeomAPI_Pnt2d> aStartPntA = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAttrStartA)->pnt();
439 std::shared_ptr<GeomAPI_Pnt2d> anEndPntA = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAttrEndA)->pnt();
440 std::shared_ptr<GeomAPI_Pnt2d> aStartPntB = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAttrStartB)->pnt();
441 std::shared_ptr<GeomAPI_Pnt2d> anEndPntB = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAttrEndB)->pnt();
442 double aDistBaseStartA = aBasePnt->distance(aStartPntA);
443 double aDistBaseEndA = aBasePnt->distance(anEndPntA);
444 double aDistStartAStartB = aStartPntA->distance(aStartPntB);
445 double aDistStartAEndB = aStartPntA->distance(anEndPntB);
446 double aDistEndAStartB = anEndPntA->distance(aStartPntB);
447 double aDistEndAEndB = anEndPntA->distance(anEndPntB);
449 if((aDistBaseStartA < tolerance && (aDistStartAStartB < tolerance || aDistStartAEndB < tolerance)) ||
450 (aDistBaseEndA < tolerance && (aDistEndAStartB < tolerance || aDistEndAStartB < tolerance))) {
454 // Check that point not on fillet arc
455 AttributeRefListPtr aRefListOfFillet = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(
456 aFeature->attribute(SketchPlugin_Constraint::ENTITY_B()));
457 std::list<ObjectPtr> aNewFeatList = aRefListOfFillet->list();
458 if(!aNewFeatList.empty()) {
459 aFeatIt = aNewFeatList.begin();
461 //aNewFeatureA = ModelAPI_Feature::feature(*aFeatIt++);
462 //aNewFeatureB = ModelAPI_Feature::feature(*aFeatIt++);
463 aFeatIt++; aFeatIt++;
464 aNewArc = ModelAPI_Feature::feature(*aFeatIt);
465 AttributePtr anArcStart = aNewArc->attribute(SketchPlugin_Arc::START_ID());
466 AttributePtr anArcEnd = aNewArc->attribute(SketchPlugin_Arc::END_ID());
467 std::shared_ptr<GeomAPI_Pnt2d> anArcStartPnt = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anArcStart)->pnt();
468 std::shared_ptr<GeomAPI_Pnt2d> anArcEndPnt = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anArcEnd)->pnt();
469 double aDistBaseArcStart = aBasePnt->distance(anArcStartPnt);
470 double aDistBaseArcEnd = aBasePnt->distance(anArcEndPnt);
471 if(aDistBaseArcStart < tolerance || aDistBaseArcEnd < tolerance) {
477 const std::set<AttributePtr>& aRefsList = anAttrBase->owner()->data()->refsToMe();
478 std::set<AttributePtr>::const_iterator aIt;
479 FeaturePtr aCoincident;
480 for (aIt = aRefsList.cbegin(); aIt != aRefsList.cend(); ++aIt) {
481 std::shared_ptr<ModelAPI_Attribute> aAttr = (*aIt);
482 FeaturePtr aConstrFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aAttr->owner());
483 if (aConstrFeature->getKind() == SketchPlugin_ConstraintCoincidence::ID()) {
484 AttributeRefAttrPtr anAttrRefA = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
485 aConstrFeature->attribute(SketchPlugin_ConstraintCoincidence::ENTITY_A()));
486 AttributeRefAttrPtr anAttrRefB = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
487 aConstrFeature->attribute(SketchPlugin_ConstraintCoincidence::ENTITY_B()));
488 if(anAttrRefA.get() && !anAttrRefA->isObject()) {
489 AttributePtr anAttrA = anAttrRefA->attr();
490 if(anAttrBase == anAttrA) {
491 aCoincident = aConstrFeature;
495 if(anAttrRefA.get() && !anAttrRefB->isObject()) {
496 AttributePtr anAttrB = anAttrRefB->attr();
497 if(anAttrBase == anAttrB) {
498 aCoincident = aConstrFeature;
505 if(!aCoincident.get()) {
509 std::set<FeaturePtr> aCoinsides;
510 SketchPlugin_Tools::findCoincidences(aCoincident,
511 SketchPlugin_ConstraintCoincidence::ENTITY_A(),
513 SketchPlugin_Tools::findCoincidences(aCoincident,
514 SketchPlugin_ConstraintCoincidence::ENTITY_B(),
517 std::set<FeaturePtr> aNewLines;
518 for(std::set<FeaturePtr>::iterator anIt = aCoinsides.begin(); anIt != aCoinsides.end(); ++anIt) {
519 if((*anIt)->getKind() != SketchPlugin_Point::ID()) {
520 aNewLines.insert(*anIt);
523 aCoinsides = aNewLines;
525 // Remove auxilary lines
526 if(aCoinsides.size() > 2) {
528 for(std::set<FeaturePtr>::iterator anIt = aCoinsides.begin(); anIt != aCoinsides.end(); ++anIt) {
529 if(!(*anIt)->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value()) {
530 aNewLines.insert(*anIt);
533 aCoinsides = aNewLines;
536 if(aCoinsides.size() != 2) {
540 // Check that lines not collinear
541 std::set<FeaturePtr>::iterator anIt = aCoinsides.begin();
542 FeaturePtr aFirstFeature = *anIt++;
543 FeaturePtr aSecondFeature = *anIt;
544 if(aFirstFeature->getKind() == SketchPlugin_Line::ID() && aSecondFeature->getKind() == SketchPlugin_Line::ID()) {
545 std::string aStartAttr = SketchPlugin_Line::START_ID();
546 std::string anEndAttr = SketchPlugin_Line::END_ID();
547 std::shared_ptr<GeomAPI_Pnt2d> aFirstStartPnt, aFirstEndPnt, aSecondStartPnt, aSecondEndPnt;
548 aFirstStartPnt = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aFirstFeature->attribute(aStartAttr))->pnt();
549 aFirstEndPnt = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aFirstFeature->attribute(anEndAttr))->pnt();
550 aSecondStartPnt = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aSecondFeature->attribute(aStartAttr))->pnt();
551 aSecondEndPnt = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aSecondFeature->attribute(anEndAttr))->pnt();
552 double aCheck1 = abs((aFirstEndPnt->x() - aFirstStartPnt->x()) * (aSecondStartPnt->y() - aFirstStartPnt->y()) -
553 (aSecondStartPnt->x() - aFirstStartPnt->x()) * (aFirstEndPnt->y() - aFirstStartPnt->y()));
554 double aCheck2 = abs((aFirstEndPnt->x() - aFirstStartPnt->x()) * (aSecondEndPnt->y() - aFirstStartPnt->y()) -
555 (aSecondEndPnt->x() - aFirstStartPnt->x()) * (aFirstEndPnt->y() - aFirstStartPnt->y()));
556 if(aCheck1 < 1.e-7 && aCheck2 < 1.e-7) {