X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchAPI%2FSketchAPI_Line.cpp;h=1e5a2da04fc01a250631b6940ea62338ae6df9c1;hb=b9e0bc62b8d67c3f82e4feb583e4e3b9f7249202;hp=f36c91c88268dea56f0577bbba4c5855394c1ae9;hpb=421e05a30e1122e497be417f55cfcaaece238394;p=modules%2Fshaper.git diff --git a/src/SketchAPI/SketchAPI_Line.cpp b/src/SketchAPI/SketchAPI_Line.cpp index f36c91c88..1e5a2da04 100644 --- a/src/SketchAPI/SketchAPI_Line.cpp +++ b/src/SketchAPI/SketchAPI_Line.cpp @@ -9,12 +9,13 @@ //-------------------------------------------------------------------------------------- #include //-------------------------------------------------------------------------------------- +#include #include #include //-------------------------------------------------------------------------------------- SketchAPI_Line::SketchAPI_Line( const std::shared_ptr & theFeature) -: ModelHighAPI_Interface(theFeature) +: SketchAPI_SketchEntity(theFeature) { initialize(); } @@ -22,7 +23,7 @@ SketchAPI_Line::SketchAPI_Line( SketchAPI_Line::SketchAPI_Line( const std::shared_ptr & theFeature, double theX1, double theY1, double theX2, double theY2) -: ModelHighAPI_Interface(theFeature) +: SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByCoordinates(theX1, theY1, theX2, theY2); @@ -33,7 +34,7 @@ SketchAPI_Line::SketchAPI_Line( const std::shared_ptr & theFeature, const std::shared_ptr & theStartPoint, const std::shared_ptr & theEndPoint) -: ModelHighAPI_Interface(theFeature) +: SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByPoints(theStartPoint, theEndPoint); @@ -43,7 +44,7 @@ SketchAPI_Line::SketchAPI_Line( SketchAPI_Line::SketchAPI_Line( const std::shared_ptr & theFeature, const ModelHighAPI_Selection & theExternal ) -: ModelHighAPI_Interface(theFeature) +: SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByExternal(theExternal); @@ -53,7 +54,7 @@ SketchAPI_Line::SketchAPI_Line( SketchAPI_Line::SketchAPI_Line( const std::shared_ptr & theFeature, const std::string & theExternalName ) -: ModelHighAPI_Interface(theFeature) +: SketchAPI_SketchEntity(theFeature) { if (initialize()) { setByExternalName(theExternalName); @@ -127,3 +128,23 @@ void SketchAPI_Line::setEndPoint(const std::shared_ptr & thePoint //-------------------------------------------------------------------------------------- +void SketchAPI_Line::dump(ModelHighAPI_Dumper& theDumper) const +{ + if (isCopy()) + return; // no need to dump copied feature + + FeaturePtr aBase = feature(); + const std::string& aSketchName = theDumper.parentName(aBase); + + AttributeSelectionPtr anExternal = aBase->selection(SketchPlugin_SketchEntity::EXTERNAL_ID()); + if (anExternal->context()) { + // line is external + theDumper << aBase << " = " << aSketchName << ".addLine(" << anExternal << ")" << std::endl; + } else { + // segment given by its points + theDumper << aBase << " = " << aSketchName << ".addLine(" + << startPoint() << ", " << endPoint() << ")" << std::endl; + } + // dump "auxiliary" flag if necessary + SketchAPI_SketchEntity::dump(theDumper); +}