From d6538e024032e6748af2a50cd99c515322a600de Mon Sep 17 00:00:00 2001 From: azv Date: Wed, 23 May 2018 08:16:02 +0300 Subject: [PATCH] Task 2.3. Fix compilation errors --- src/SketchAPI/SketchAPI_IntersectionPoint.cpp | 6 ++--- src/SketchAPI/SketchAPI_IntersectionPoint.h | 10 ++++--- src/SketchPlugin/CMakeLists.txt | 2 -- .../SketchPlugin_IntersectionPoint.cpp | 11 +++++--- .../SketchPlugin_IntersectionPoint.h | 17 +++++++++--- src/SketchPlugin/SketchPlugin_Plugin.cpp | 3 --- src/SketchPlugin/plugin-Sketch.xml | 26 +++---------------- 7 files changed, 35 insertions(+), 40 deletions(-) diff --git a/src/SketchAPI/SketchAPI_IntersectionPoint.cpp b/src/SketchAPI/SketchAPI_IntersectionPoint.cpp index 39f5b2726..aa5e3c0a5 100644 --- a/src/SketchAPI/SketchAPI_IntersectionPoint.cpp +++ b/src/SketchAPI/SketchAPI_IntersectionPoint.cpp @@ -61,14 +61,14 @@ SketchAPI_IntersectionPoint::~SketchAPI_IntersectionPoint() //-------------------------------------------------------------------------------------- void SketchAPI_IntersectionPoint::setByExternalLine(const ModelHighAPI_Selection & theExternalLine) { - fillAttribute(theExternalLine, externalLine()); + fillAttribute(theExternalLine, externalFeature()); execute(); } void SketchAPI_IntersectionPoint::setByExternalLineName(const std::string & theExternalLineName) { - fillAttribute(ModelHighAPI_Selection("EDGE", theExternalLineName), externalLine()); + fillAttribute(ModelHighAPI_Selection("EDGE", theExternalLineName), externalFeature()); execute(); } @@ -80,7 +80,7 @@ void SketchAPI_IntersectionPoint::dump(ModelHighAPI_Dumper& theDumper) const FeaturePtr aBase = feature(); const std::string& aSketchName = theDumper.parentName(aBase); - AttributeSelectionPtr aLine = externalLine(); + AttributeSelectionPtr aLine = externalFeature(); theDumper << aBase << " = " << aSketchName << ".addIntersectionPoint(" << aLine << ")" << std::endl; // dump "auxiliary" flag if necessary diff --git a/src/SketchAPI/SketchAPI_IntersectionPoint.h b/src/SketchAPI/SketchAPI_IntersectionPoint.h index 325d522bf..ba0ef3825 100644 --- a/src/SketchAPI/SketchAPI_IntersectionPoint.h +++ b/src/SketchAPI/SketchAPI_IntersectionPoint.h @@ -52,11 +52,15 @@ public: SKETCHAPI_EXPORT virtual ~SketchAPI_IntersectionPoint(); - INTERFACE_2(SketchPlugin_IntersectionPoint::ID(), + INTERFACE_4(SketchPlugin_IntersectionPoint::ID(), coordinates, SketchPlugin_IntersectionPoint::COORD_ID(), GeomDataAPI_Point2D, /** IntersectionPoint coordinates */, - externalLine, SketchPlugin_IntersectionPoint::EXTERNAL_LINE_ID(), - ModelAPI_AttributeSelection, /** External line */ + externalFeature, SketchPlugin_IntersectionPoint::EXTERNAL_FEATURE_ID(), + ModelAPI_AttributeSelection, /** External edge */, + external, SketchPlugin_IntersectionPoint::EXTERNAL_ID(), + ModelAPI_AttributeSelection, /** External */, + includeToResult, SketchPlugin_IntersectionPoint::INCLUDE_INTO_RESULT(), + ModelAPI_AttributeBoolean, /** Include into result */ ) /// Set by external diff --git a/src/SketchPlugin/CMakeLists.txt b/src/SketchPlugin/CMakeLists.txt index 519741bec..4fa4f8c0f 100644 --- a/src/SketchPlugin/CMakeLists.txt +++ b/src/SketchPlugin/CMakeLists.txt @@ -66,7 +66,6 @@ SET(PROJECT_HEADERS SketchPlugin_Tools.h SketchPlugin_Trim.h SketchPlugin_Validators.h - SketchPlugin_Intersection.h ) SET(PROJECT_SOURCES @@ -112,7 +111,6 @@ SET(PROJECT_SOURCES SketchPlugin_Tools.cpp SketchPlugin_Trim.cpp SketchPlugin_Validators.cpp - SketchPlugin_Intersection.cpp ) SET(PROJECT_LIBRARIES diff --git a/src/SketchPlugin/SketchPlugin_IntersectionPoint.cpp b/src/SketchPlugin/SketchPlugin_IntersectionPoint.cpp index a391b22e6..ceb800a58 100644 --- a/src/SketchPlugin/SketchPlugin_IntersectionPoint.cpp +++ b/src/SketchPlugin/SketchPlugin_IntersectionPoint.cpp @@ -29,15 +29,18 @@ #include SketchPlugin_IntersectionPoint::SketchPlugin_IntersectionPoint() - : SketchPlugin_Point() + : SketchPlugin_Point() { } void SketchPlugin_IntersectionPoint::initDerivedClassAttributes() { - data()->addAttribute(EXTERNAL_LINE_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(EXTERNAL_FEATURE_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(INCLUDE_INTO_RESULT(), ModelAPI_AttributeBoolean::typeId()); SketchPlugin_Point::initDerivedClassAttributes(); + + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), AUXILIARY_ID()); } void SketchPlugin_IntersectionPoint::execute() @@ -54,7 +57,7 @@ void SketchPlugin_IntersectionPoint::execute() void SketchPlugin_IntersectionPoint::attributeChanged(const std::string& theID) { - if (theID == EXTERNAL_LINE_ID()) { + if (theID == EXTERNAL_FEATURE_ID()) { // compute intersection between line and sketch plane computePoint(); } @@ -63,7 +66,7 @@ void SketchPlugin_IntersectionPoint::attributeChanged(const std::string& theID) void SketchPlugin_IntersectionPoint::computePoint() { AttributeSelectionPtr aLineAttr = - std::dynamic_pointer_cast(attribute(EXTERNAL_LINE_ID())); + std::dynamic_pointer_cast(attribute(EXTERNAL_FEATURE_ID())); std::shared_ptr anEdge; if(aLineAttr && aLineAttr->value() && aLineAttr->value()->isEdge()) { diff --git a/src/SketchPlugin/SketchPlugin_IntersectionPoint.h b/src/SketchPlugin/SketchPlugin_IntersectionPoint.h index a25f1be36..ab0dcd6fc 100644 --- a/src/SketchPlugin/SketchPlugin_IntersectionPoint.h +++ b/src/SketchPlugin/SketchPlugin_IntersectionPoint.h @@ -44,16 +44,27 @@ public: return MY_KIND; } - static const std::string& EXTERNAL_LINE_ID() + static const std::string& EXTERNAL_FEATURE_ID() { - static std::string MY_LINE_ID("ExternalLine"); - return MY_LINE_ID; + static std::string MY_FEATURE_ID("ExternalFeature"); + return MY_FEATURE_ID; + } + + static const std::string& INCLUDE_INTO_RESULT() + { + static std::string MY_INCLUDE("IncludeToResult"); + return MY_INCLUDE; } /// Returns true because intersection point is always external virtual bool isFixed() { return true; } + /// Returns true if the feature and the feature results can be displayed. + /// \return false + virtual bool canBeDisplayed() const + { return false; } + /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); diff --git a/src/SketchPlugin/SketchPlugin_Plugin.cpp b/src/SketchPlugin/SketchPlugin_Plugin.cpp index 4ea4a6a18..a392b6ef7 100644 --- a/src/SketchPlugin/SketchPlugin_Plugin.cpp +++ b/src/SketchPlugin/SketchPlugin_Plugin.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -209,8 +208,6 @@ FeaturePtr SketchPlugin_Plugin::createFeature(std::string theFeatureID) return FeaturePtr(new SketchPlugin_Arc); } else if (theFeatureID == SketchPlugin_Projection::ID()) { return FeaturePtr(new SketchPlugin_Projection); - } else if (theFeatureID == SketchPlugin_Intersection::ID()) { - return FeaturePtr(new SketchPlugin_Intersection); } else if (theFeatureID == SketchPlugin_ConstraintCoincidence::ID()) { return FeaturePtr(new SketchPlugin_ConstraintCoincidence); } else if (theFeatureID == SketchPlugin_ConstraintCollinear::ID()) { diff --git a/src/SketchPlugin/plugin-Sketch.xml b/src/SketchPlugin/plugin-Sketch.xml index 89a471f41..9f28795bc 100644 --- a/src/SketchPlugin/plugin-Sketch.xml +++ b/src/SketchPlugin/plugin-Sketch.xml @@ -27,7 +27,7 @@ email : webmaster.salome@opencascade.com - - - - + @@ -503,7 +485,7 @@ email : webmaster.salome@opencascade.com - + -- 2.39.2