X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_Tools.cpp;h=b488201750a4866ff82aa1ff3d150af14b2a2223;hb=6f31859c9897eacec13d3912e76f28b8b824ecf4;hp=f7c4ab57f0c6fde0261324b1410766d0acf8a20b;hpb=57cf6e2ea021fe95dcc0caa5d19bffd2cde4223f;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_Tools.cpp b/src/PartSet/PartSet_Tools.cpp index f7c4ab57f..b48820175 100644 --- a/src/PartSet/PartSet_Tools.cpp +++ b/src/PartSet/PartSet_Tools.cpp @@ -222,7 +222,7 @@ std::shared_ptr PartSet_Tools::getFeaturePoint(FeaturePtr t std::shared_ptr aClickedPoint = std::shared_ptr( new GeomAPI_Pnt2d(theX, theY)); std::list > anAttiributes = - theFeature->data()->attributes(GeomDataAPI_Point2D::type()); + theFeature->data()->attributes(GeomDataAPI_Point2D::typeId()); std::list >::const_iterator anIt = anAttiributes.begin(), aLast = anAttiributes.end(); std::shared_ptr aFPoint; @@ -321,7 +321,7 @@ std::shared_ptr PartSet_Tools:: for (int i = 0; i < theSketch->numberOfSubs(); i++) { FeaturePtr aFeature = theSketch->subFeature(i); if (!theIgnore.contains(aFeature)) { - anAttiributes = aFeature->data()->attributes(GeomDataAPI_Point2D::type()); + anAttiributes = aFeature->data()->attributes(GeomDataAPI_Point2D::typeId()); std::list >::const_iterator anIt; for (anIt = anAttiributes.cbegin(); anIt != anAttiributes.cend(); ++anIt) { @@ -366,7 +366,7 @@ void PartSet_Tools::setConstraints(CompositeFeaturePtr theSketch, FeaturePtr the if (theFeature == aFeature) continue; // find the given point in the feature attributes - anAttiributes = aFeature->data()->attributes(GeomDataAPI_Point2D::type()); + anAttiributes = aFeature->data()->attributes(GeomDataAPI_Point2D::typeId()); std::list >::const_iterator anIt = anAttiributes.begin(), aLast = anAttiributes.end(); std::shared_ptr aFPoint; @@ -431,19 +431,30 @@ std::shared_ptr PartSet_Tools::point3D(std::shared_ptrto3D(aC->pnt(), aX->dir(), aY); } -ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShape, - const ObjectPtr& theObject, - CompositeFeaturePtr theSketch) +ResultPtr PartSet_Tools::findFixedObjectByExternal(const TopoDS_Shape& theShape, + const ObjectPtr& theObject, + CompositeFeaturePtr theSketch) { + ResultPtr aResult; if (theShape.ShapeType() == TopAbs_EDGE) { // Check that we already have such external edge std::shared_ptr aInEdge = std::shared_ptr(new GeomAPI_Edge()); aInEdge->setImpl(new TopoDS_Shape(theShape)); - ResultPtr aResult = findExternalEdge(theSketch, aInEdge); - if (aResult) - return aResult; + aResult = findExternalEdge(theSketch, aInEdge); + } + if (theShape.ShapeType() == TopAbs_VERTEX) { + std::shared_ptr aInVert = std::shared_ptr(new GeomAPI_Vertex()); + aInVert->setImpl(new TopoDS_Shape(theShape)); + aResult = findExternalVertex(theSketch, aInVert); + } + return aResult; +} - // If not found then we have to create new +ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShape, + const ObjectPtr& theObject, + CompositeFeaturePtr theSketch) +{ + if (theShape.ShapeType() == TopAbs_EDGE) { Standard_Real aStart, aEnd; Handle(V3d_View) aNullView; FeaturePtr aMyFeature; @@ -454,13 +465,16 @@ ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShap // Create line aMyFeature = theSketch->addFeature(SketchPlugin_Line::ID()); } else if (aAdaptor.GetType() == GeomAbs_Circle) { - if (aAdaptor.IsClosed()) { - // Create circle - aMyFeature = theSketch->addFeature(SketchPlugin_Circle::ID()); - } else { + std::shared_ptr anEdge = std::shared_ptr(new GeomAPI_Edge); + anEdge->setImpl(new TopoDS_Shape(theShape)); + if (anEdge->isArc()) { // Create arc aMyFeature = theSketch->addFeature(SketchPlugin_Arc::ID()); } + else { + // Create circle + aMyFeature = theSketch->addFeature(SketchPlugin_Circle::ID()); + } } if (aMyFeature) { DataPtr aData = aMyFeature->data(); @@ -487,12 +501,6 @@ ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShap } } if (theShape.ShapeType() == TopAbs_VERTEX) { - std::shared_ptr aInVert = std::shared_ptr(new GeomAPI_Vertex()); - aInVert->setImpl(new TopoDS_Shape(theShape)); - ResultPtr aResult = findExternalVertex(theSketch, aInVert); - if (aResult) - return aResult; - FeaturePtr aMyFeature = theSketch->addFeature(SketchPlugin_Point::ID()); if (aMyFeature) { @@ -624,7 +632,7 @@ AttributePtr PartSet_Tools::findAttributeBy2dPoint(ObjectPtr theObj, // find the given point in the feature attributes std::list anAttiributes = - aFeature->data()->attributes(GeomDataAPI_Point2D::type()); + aFeature->data()->attributes(GeomDataAPI_Point2D::typeId()); std::list::const_iterator anIt = anAttiributes.begin(), aLast = anAttiributes.end(); for (; anIt != aLast && !anAttribute; anIt++) {