X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FConstructionAPI%2FConstructionAPI_Point.cpp;h=8d045791f3404bb4e4032f16246322e8e93dc3cf;hb=dc26a49174c150bb0fbb63a44ce562c17288d3ff;hp=48222cfc4e3c5384f6452d83744718b1778d0e0e;hpb=5e0fdd82190d9afb274cb2449edb76f6b6664700;p=modules%2Fshaper.git diff --git a/src/ConstructionAPI/ConstructionAPI_Point.cpp b/src/ConstructionAPI/ConstructionAPI_Point.cpp index 48222cfc4..8d045791f 100644 --- a/src/ConstructionAPI/ConstructionAPI_Point.cpp +++ b/src/ConstructionAPI/ConstructionAPI_Point.cpp @@ -45,18 +45,18 @@ ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr& theFeature, const ModelHighAPI_Selection& theEdge, - const ModelHighAPI_Double& theDistanceValue, - const bool theDistancePercent, + const ModelHighAPI_Double& theOffset, + const bool theUseRatio, const bool theReverse) : ModelHighAPI_Interface(theFeature) { if(initialize()) { - setByDistanceOnEdge(theEdge, theDistanceValue, theDistancePercent, theReverse); + setByOffsetOnEdge(theEdge, theOffset, theUseRatio, theReverse); } -}*/ +} //================================================================================================== ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr& theFeature, @@ -101,21 +101,28 @@ void ConstructionAPI_Point::setByXYZ(const ModelHighAPI_Double& theX, execute(false); } -/*//================================================================================================== -void ConstructionAPI_Point::setByDistanceOnEdge(const ModelHighAPI_Selection& theEdge, - const ModelHighAPI_Double& theDistanceValue, - const bool theDistancePercent, - const bool theReverse) +//================================================================================================== +void ConstructionAPI_Point::setByOffsetOnEdge(const ModelHighAPI_Selection& theEdge, + const ModelHighAPI_Double& theOffset, + const bool theUseRatio, + const bool theReverse) { fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_DISTANCE_ON_EDGE(), mycreationMethod); fillAttribute(theEdge, myedge); - fillAttribute(theDistanceValue, mydistanceValue); - fillAttribute(theDistancePercent, mydistancePercent); + if (theUseRatio) { + fillAttribute(ConstructionPlugin_Point::OFFSET_TYPE_BY_RATIO(), myoffsetType); + fillAttribute(theOffset, myratio); + } + else { + fillAttribute(ConstructionPlugin_Point::OFFSET_TYPE_BY_DISTANCE(), myoffsetType); + fillAttribute(theOffset, mydistance); + } fillAttribute(theReverse, myreverse); execute(); } +/* //================================================================================================== void ConstructionAPI_Point::setByProjection(const ModelHighAPI_Selection& theVertex, const ModelHighAPI_Selection& theFace) @@ -136,7 +143,8 @@ void ConstructionAPI_Point::setByLinesIntersection(const ModelHighAPI_Selection& fillAttribute(theEdge2, mysecondLine); execute(); -}*/ +} +*/ //================================================================================================== void ConstructionAPI_Point::setByLineAndPlaneIntersection(const ModelHighAPI_Selection& theEdge, @@ -170,6 +178,16 @@ void ConstructionAPI_Point::dump(ModelHighAPI_Dumper& theDumper) const } theDumper << ")" << std::endl; } + else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_DISTANCE_ON_EDGE()) { + theDumper << edge() << ", "; + if (offsetType()->value() == ConstructionPlugin_Point::OFFSET_TYPE_BY_DISTANCE()) { + theDumper << distance() << ", " << false; + } + else { + theDumper << ratio() << ", " << true; + } + theDumper << ", " << reverse()->value() << ")" << std::endl; + } } //================================================================================================== @@ -182,16 +200,16 @@ PointPtr addPoint(const std::shared_ptr& thePart, return PointPtr(new ConstructionAPI_Point(aFeature, theX, theY, theZ)); } -/*//================================================================================================== +//================================================================================================== PointPtr addPoint(const std::shared_ptr & thePart, const ModelHighAPI_Selection& theEdge, - const ModelHighAPI_Double& theDistanceValue, - const bool theDistancePercent, + const ModelHighAPI_Double& theOffset, + const bool theUseRatio, const bool theReverse) { std::shared_ptr aFeature = thePart->addFeature(ConstructionAPI_Point::ID()); - return PointPtr(new ConstructionAPI_Point(aFeature, theEdge, theDistanceValue, theDistancePercent, theReverse)); -}*/ + return PointPtr(new ConstructionAPI_Point(aFeature, theEdge, theOffset, theUseRatio, theReverse)); +} //================================================================================================== PointPtr addPoint(const std::shared_ptr & thePart,