]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Task 2.3. Fix compilation errors
authorazv <azv@opencascade.com>
Wed, 23 May 2018 05:16:02 +0000 (08:16 +0300)
committerazv <azv@opencascade.com>
Wed, 23 May 2018 05:16:02 +0000 (08:16 +0300)
src/SketchAPI/SketchAPI_IntersectionPoint.cpp
src/SketchAPI/SketchAPI_IntersectionPoint.h
src/SketchPlugin/CMakeLists.txt
src/SketchPlugin/SketchPlugin_IntersectionPoint.cpp
src/SketchPlugin/SketchPlugin_IntersectionPoint.h
src/SketchPlugin/SketchPlugin_Plugin.cpp
src/SketchPlugin/plugin-Sketch.xml

index 39f5b27266535699f200f1b6eb65c4e2fad51d22..aa5e3c0a5bb10671f2a935ef930e82782700644b 100644 (file)
@@ -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
index 325d522bf42c0892aa05023024b1eeedf2fb3b7b..ba0ef3825e7b6104689210716cfd1184f52143f8 100644 (file)
@@ -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
index 519741bec563ecd201847cb82cd0a945f70a7218..4fa4f8c0fa0f068aa86d00609488ba6aabafce61 100644 (file)
@@ -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
index a391b22e6a31f49d5c9a9a373575db2833dd75bd..ceb800a58a6957d3d08f53dcc799979ba601a1e1 100644 (file)
 #include <GeomDataAPI_Point2D.h>
 
 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<ModelAPI_AttributeSelection>(attribute(EXTERNAL_LINE_ID()));
+      std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(attribute(EXTERNAL_FEATURE_ID()));
 
   std::shared_ptr<GeomAPI_Edge> anEdge;
   if(aLineAttr && aLineAttr->value() && aLineAttr->value()->isEdge()) {
index a25f1be363dbcfe3c63bcac0c01cefa31b66e2b0..ab0dcd6fc5d6b0075930d49c92592138c08b330d 100644 (file)
@@ -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();
 
index 4ea4a6a1838cee8d93283ec991f033b511797551..a392b6ef74c1536958545b24cd07f46460f5fbce 100644 (file)
@@ -26,7 +26,6 @@
 #include <SketchPlugin_Circle.h>
 #include <SketchPlugin_Arc.h>
 #include <SketchPlugin_Projection.h>
-#include <SketchPlugin_Intersection.h>
 #include <SketchPlugin_ConstraintAngle.h>
 #include <SketchPlugin_ConstraintCoincidence.h>
 #include <SketchPlugin_ConstraintCollinear.h>
@@ -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()) {
index 89a471f414ae0c9641d21a4f7bb03f11dc6d7353..9f28795bcd5bec0ed718a2effb20e081cbd30895 100644 (file)
@@ -27,7 +27,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
         nested="SketchPoint SketchIntersectionPoint SketchLine
                 SketchCircle SketchMacroCircle SketchArc SketchMacroArc
                 SketchRectangle
-                SketchProjection SketchIntersection
+                SketchProjection
                 SketchConstraintLength SketchConstraintRadius SketchConstraintDistance SketchConstraintDistanceHorizontal SketchConstraintDistanceVertical
                 SketchConstraintParallel SketchConstraintPerpendicular
                 SketchConstraintRigid SketchConstraintHorizontal SketchConstraintVertical
@@ -451,24 +451,6 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
 </excluded>
 
     <group id="Projection">
-      <!-- Intersection Point -->
-      <!-- feature
-        id="SketchIntersectionPoint"
-        title="Intersection Point"
-        tooltip="Create intersection point"
-        icon="icons/Sketch/intersection_point.png">
-        <sketch_shape_selector
-              id="ExternalLine"
-              label="Edge"
-              tooltip="Select external line."
-              shape_types="edge"
-              use_external="false"
-              use_sketch_plane="false">
-          <validator id="GeomValidators_ShapeType" parameters="line"/>
-          <validator id="SketchPlugin_IntersectionValidator"/>
-        </sketch_shape_selector>
-      </feature -->
-
       <!-- Projected feature -->
       <feature
         id="SketchProjection"
@@ -489,9 +471,9 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
         <validator id="PartSet_ProjectionSelection"/>
       </feature>
 
-      <!-- Intersection feature -->
+      <!-- Intersection Point -->
       <feature
-        id="SketchIntersection"
+        id="SketchIntersectionPoint"
         title="Intersection"
         tooltip="Intersect edge with sketch plane"
         icon="icons/Sketch/intersection.png">
@@ -503,7 +485,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
               use_external="true"
               can_create_external="false"
               use_sketch_plane="false">
-          <validator id="SketchPlugin_ProjectionValidator"/>
+          <validator id="SketchPlugin_IntersectionValidator"/>
         </sketch_shape_selector>
         <boolvalue id="IncludeToResult" label="Include into the sketch result" default="true" tooltip="Include projected feature into the sketch result"/>
         <validator id="PartSet_IntersectionSelection"/>