//--------------------------------------------------------------------------------------
#include <GeomAPI_Pnt2d.h>
//--------------------------------------------------------------------------------------
+#include <ModelHighAPI_Dumper.h>
#include <ModelHighAPI_Selection.h>
#include <ModelHighAPI_Tools.h>
//--------------------------------------------------------------------------------------
SketchAPI_Line::SketchAPI_Line(
const std::shared_ptr<ModelAPI_Feature> & theFeature)
-: ModelHighAPI_Interface(theFeature)
+: SketchAPI_SketchEntity(theFeature)
{
initialize();
}
SketchAPI_Line::SketchAPI_Line(
const std::shared_ptr<ModelAPI_Feature> & theFeature,
double theX1, double theY1, double theX2, double theY2)
-: ModelHighAPI_Interface(theFeature)
+: SketchAPI_SketchEntity(theFeature)
{
if (initialize()) {
setByCoordinates(theX1, theY1, theX2, theY2);
const std::shared_ptr<ModelAPI_Feature> & theFeature,
const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint)
-: ModelHighAPI_Interface(theFeature)
+: SketchAPI_SketchEntity(theFeature)
{
if (initialize()) {
setByPoints(theStartPoint, theEndPoint);
SketchAPI_Line::SketchAPI_Line(
const std::shared_ptr<ModelAPI_Feature> & theFeature,
const ModelHighAPI_Selection & theExternal )
-: ModelHighAPI_Interface(theFeature)
+: SketchAPI_SketchEntity(theFeature)
{
if (initialize()) {
setByExternal(theExternal);
SketchAPI_Line::SketchAPI_Line(
const std::shared_ptr<ModelAPI_Feature> & theFeature,
const std::string & theExternalName )
-: ModelHighAPI_Interface(theFeature)
+: SketchAPI_SketchEntity(theFeature)
{
if (initialize()) {
setByExternalName(theExternalName);
//--------------------------------------------------------------------------------------
+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);
+}