]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2208: Development in progress
authorvsv <vsv@opencascade.com>
Fri, 21 Jul 2017 12:58:22 +0000 (15:58 +0300)
committervsv <vsv@opencascade.com>
Fri, 21 Jul 2017 12:58:22 +0000 (15:58 +0300)
37 files changed:
src/SketchPlugin/SketchPlugin_ConstraintCollinear.cpp
src/SketchPlugin/SketchPlugin_ConstraintEqual.cpp
src/SketchPlugin/SketchPlugin_ConstraintHorizontal.cpp
src/SketchPlugin/SketchPlugin_ConstraintMiddle.cpp
src/SketchPlugin/SketchPlugin_ConstraintMirror.cpp
src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp
src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.cpp
src/SketchPlugin/SketchPlugin_ConstraintRigid.cpp
src/SketchPlugin/SketchPlugin_ConstraintTangent.cpp
src/SketchPlugin/SketchPlugin_ConstraintVertical.cpp
src/SketchPlugin/SketchPlugin_MultiRotation.cpp
src/SketchPlugin/SketchPlugin_MultiTranslation.cpp
src/SketcherPrs/SketcherPrs_Collinear.cpp
src/SketcherPrs/SketcherPrs_Collinear.h
src/SketcherPrs/SketcherPrs_Equal.cpp
src/SketcherPrs/SketcherPrs_Equal.h
src/SketcherPrs/SketcherPrs_Factory.cpp
src/SketcherPrs/SketcherPrs_Factory.h
src/SketcherPrs/SketcherPrs_HVDirection.cpp
src/SketcherPrs/SketcherPrs_HVDirection.h
src/SketcherPrs/SketcherPrs_Middle.cpp
src/SketcherPrs/SketcherPrs_Middle.h
src/SketcherPrs/SketcherPrs_Mirror.cpp
src/SketcherPrs/SketcherPrs_Mirror.h
src/SketcherPrs/SketcherPrs_Parallel.cpp
src/SketcherPrs/SketcherPrs_Parallel.h
src/SketcherPrs/SketcherPrs_Perpendicular.cpp
src/SketcherPrs/SketcherPrs_Perpendicular.h
src/SketcherPrs/SketcherPrs_PositionMgr.cpp
src/SketcherPrs/SketcherPrs_Rigid.cpp
src/SketcherPrs/SketcherPrs_Rigid.h
src/SketcherPrs/SketcherPrs_SymbolPrs.cpp
src/SketcherPrs/SketcherPrs_SymbolPrs.h
src/SketcherPrs/SketcherPrs_Tangent.cpp
src/SketcherPrs/SketcherPrs_Tangent.h
src/SketcherPrs/SketcherPrs_Transformation.cpp
src/SketcherPrs/SketcherPrs_Transformation.h

index ef3a7a5687197860d02fe3244e45c29ab4835508..484692fbaeeaf2451d1ec9133cc9f6d2b2ca9c71 100644 (file)
@@ -41,7 +41,7 @@ AISObjectPtr SketchPlugin_ConstraintCollinear::getAISObject(AISObjectPtr thePrev
   if (!sketch())
     return thePrevious;
 
-  AISObjectPtr anAIS = SketcherPrs_Factory::collinearConstraint(this, sketch()->coordinatePlane(),
+  AISObjectPtr anAIS = SketcherPrs_Factory::collinearConstraint(this, sketch(), sketch()->coordinatePlane(),
                                                                 thePrevious);
   return anAIS;
 }
index 3605f1af5788437fa6bff1f4dea10e4281b30b56..7be8935aa2d9b52aff0d55ae7691c788e5c16834 100644 (file)
@@ -50,7 +50,8 @@ AISObjectPtr SketchPlugin_ConstraintEqual::getAISObject(AISObjectPtr thePrevious
   if (!sketch())
     return thePrevious;
 
-  AISObjectPtr anAIS = SketcherPrs_Factory::equalConstraint(this, sketch()->coordinatePlane(),
+  AISObjectPtr anAIS = SketcherPrs_Factory::equalConstraint(this, sketch(),
+                                                            sketch()->coordinatePlane(),
                                                             thePrevious);
   return anAIS;
 }
index 81612bc20f04e1dde79d94068520e9de35ba40b8..6ebf472e8f8157c0cc1fb38e15d9b9ba1f2f555d 100644 (file)
@@ -50,7 +50,8 @@ AISObjectPtr SketchPlugin_ConstraintHorizontal::getAISObject(AISObjectPtr thePre
   if (!sketch())
     return thePrevious;
 
-  AISObjectPtr anAIS = SketcherPrs_Factory::horisontalConstraint(this, sketch()->coordinatePlane(),
+  AISObjectPtr anAIS = SketcherPrs_Factory::horisontalConstraint(this, sketch(),
+                                                                 sketch()->coordinatePlane(),
                                                                  thePrevious);
   return anAIS;
 }
index 06d01f8edc09ae904e49d0d35ccc547c30d1e588..620b0691ab8533023c7a11127cf1a8d7fcc8ec27 100644 (file)
@@ -41,7 +41,8 @@ AISObjectPtr SketchPlugin_ConstraintMiddle::getAISObject(AISObjectPtr thePreviou
   if (!sketch())
     return thePrevious;
 
-  AISObjectPtr anAIS = SketcherPrs_Factory::middleConstraint(this, sketch()->coordinatePlane(),
+  AISObjectPtr anAIS = SketcherPrs_Factory::middleConstraint(this, sketch(),
+                                                             sketch()->coordinatePlane(),
                                                              thePrevious);
   return anAIS;
 }
index e4c6ed4ed3d2d63d20034317429e28b1cec86beb..ec7be3a799ce2bffabe5a2e6bbea54f9d4434445 100755 (executable)
@@ -209,7 +209,8 @@ AISObjectPtr SketchPlugin_ConstraintMirror::getAISObject(AISObjectPtr thePreviou
   if (!sketch())
     return thePrevious;
 
-  AISObjectPtr anAIS = SketcherPrs_Factory::mirrorConstraint(this, sketch()->coordinatePlane(),
+  AISObjectPtr anAIS = SketcherPrs_Factory::mirrorConstraint(this, sketch(),
+                                                             sketch()->coordinatePlane(),
                                                              thePrevious);
   return anAIS;
 }
index 68f041749b9c5f9096621c652d107a4ceb45795d..9ddda85aa439c0873fa1bf99c1e9a23b1e205b8a 100644 (file)
@@ -56,7 +56,8 @@ AISObjectPtr SketchPlugin_ConstraintParallel::getAISObject(AISObjectPtr thePrevi
   if (!sketch())
     return thePrevious;
 
-  AISObjectPtr anAIS = SketcherPrs_Factory::parallelConstraint(this, sketch()->coordinatePlane(),
+  AISObjectPtr anAIS = SketcherPrs_Factory::parallelConstraint(this, sketch(),
+                                                               sketch()->coordinatePlane(),
                                                                thePrevious);
   return anAIS;
 }
index f60e3492e791584addf9fb507687bb774f0be39a..258e30dc0b5b6dbeb91652362159c968ac5faef4 100644 (file)
@@ -55,7 +55,7 @@ AISObjectPtr SketchPlugin_ConstraintPerpendicular::getAISObject(AISObjectPtr the
   if (!sketch())
     return thePrevious;
 
-  AISObjectPtr anAIS = SketcherPrs_Factory::perpendicularConstraint(this,
+  AISObjectPtr anAIS = SketcherPrs_Factory::perpendicularConstraint(this, sketch(),
     sketch()->coordinatePlane(), thePrevious);
   return anAIS;
 }
index 042b2df1aaffedee30438534821bb8d847d0e9ad..67eba8044c0a570e7e5345aea324fed89a17b612 100644 (file)
@@ -47,5 +47,6 @@ AISObjectPtr SketchPlugin_ConstraintRigid::getAISObject(AISObjectPtr thePrevious
 {
   if (!sketch())
     return thePrevious;
-  return SketcherPrs_Factory::rigidConstraint(this, sketch()->coordinatePlane(), thePrevious);
+  return SketcherPrs_Factory::rigidConstraint(this, sketch(),
+                                              sketch()->coordinatePlane(), thePrevious);
 }
\ No newline at end of file
index 2dc22943e7bdba2c159562a1031569a1ee1f2f3f..37fa4e0de354499265d75c4340a794105954740e 100644 (file)
@@ -50,7 +50,8 @@ AISObjectPtr SketchPlugin_ConstraintTangent::getAISObject(AISObjectPtr thePrevio
   if (!sketch())
     return thePrevious;
 
-  AISObjectPtr anAIS = SketcherPrs_Factory::tangentConstraint(this, sketch()->coordinatePlane(),
+  AISObjectPtr anAIS = SketcherPrs_Factory::tangentConstraint(this, sketch(),
+                                                              sketch()->coordinatePlane(),
                                                               thePrevious);
   return anAIS;
 }
index 8a03d77ef76e1deb29012e60d5a42e8d359cc381..3debcfd378d08e9b225e5081e48f7af479ef2448 100644 (file)
@@ -49,7 +49,8 @@ AISObjectPtr SketchPlugin_ConstraintVertical::getAISObject(AISObjectPtr thePrevi
   if (!sketch())
     return thePrevious;
 
-  AISObjectPtr anAIS = SketcherPrs_Factory::verticalConstraint(this, sketch()->coordinatePlane(),
+  AISObjectPtr anAIS = SketcherPrs_Factory::verticalConstraint(this, sketch(),
+                                                               sketch()->coordinatePlane(),
                                                                thePrevious);
   return anAIS;
 }
index 8743a3c3629531d1d5a1c23f2a9dfda56dac5ab4..3fd19dc330fb75afab595294c0da47b59bb78326 100755 (executable)
@@ -226,7 +226,8 @@ AISObjectPtr SketchPlugin_MultiRotation::getAISObject(AISObjectPtr thePrevious)
   if (!sketch())
     return thePrevious;
 
-  AISObjectPtr anAIS = SketcherPrs_Factory::rotateConstraint(this, sketch()->coordinatePlane(),
+  AISObjectPtr anAIS = SketcherPrs_Factory::rotateConstraint(this, sketch(),
+                                                             sketch()->coordinatePlane(),
                                                              thePrevious);
   return anAIS;
 }
index 5fc05fc1e63fb607aa484a9d4ebf45eb2f0ad25f..b927739d1c65c12dc7d52c21d2b7eb48996fabce 100755 (executable)
@@ -212,7 +212,8 @@ AISObjectPtr SketchPlugin_MultiTranslation::getAISObject(AISObjectPtr thePreviou
   if (!sketch())
     return thePrevious;
 
-  AISObjectPtr anAIS = SketcherPrs_Factory::translateConstraint(this, sketch()->coordinatePlane(),
+  AISObjectPtr anAIS = SketcherPrs_Factory::translateConstraint(this, sketch(),
+                                                                sketch()->coordinatePlane(),
                                                                 thePrevious);
   return anAIS;
 }
index 1d8a8134ceefe9c544d14075411534513b51caeb..fba498a281e8f0f930ca1a140e4f5ca3170a1872 100755 (executable)
@@ -33,8 +33,9 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Collinear, SketcherPrs_SymbolPrs);
 static Handle(Image_AlienPixMap) MyPixMap;
 
 SketcherPrs_Collinear::SketcherPrs_Collinear(ModelAPI_Feature* theConstraint,
+                                      ModelAPI_CompositeFeature* theSketcher,
                                      const std::shared_ptr<GeomAPI_Ax3>& thePlane)
- : SketcherPrs_SymbolPrs(theConstraint, thePlane)
+ : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane)
 {
 }
 
index 86f8837aa2c9b4164350eff25392fc29535c3ec6..dfa4d853ef1afc7106ff4271bb9816bf6549f34a 100755 (executable)
@@ -36,8 +36,10 @@ class SketcherPrs_Collinear: public SketcherPrs_SymbolPrs
 public:
   /// Constructor
   /// \param theConstraint a constraint feature
+  /// \param theSketcher a sketcher object
   /// \param thePlane a coordinate plane of current sketch
   Standard_EXPORT SketcherPrs_Collinear(ModelAPI_Feature* theConstraint,
+                                        ModelAPI_CompositeFeature* theSketcher,
                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane);
   DEFINE_STANDARD_RTTIEXT(SketcherPrs_Collinear, SketcherPrs_SymbolPrs)
 
index f534e27c93e7b64310934cb31c5ffbcf56897a50..7077e1a7ae14de4262105cd49101bd6d44686eaf 100644 (file)
@@ -33,8 +33,9 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Equal, SketcherPrs_SymbolPrs);
 static Handle(Image_AlienPixMap) MyPixMap;
 
 SketcherPrs_Equal::SketcherPrs_Equal(ModelAPI_Feature* theConstraint,
+                                      ModelAPI_CompositeFeature* theSketcher,
                                      const std::shared_ptr<GeomAPI_Ax3>& thePlane)
- : SketcherPrs_SymbolPrs(theConstraint, thePlane)
+ : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane)
 {
 }
 
index 8285b814566be12c8f182dd30d7b58dd0015ccea..0b2066d38e7e4f6162a997ee3ca69de913200c6b 100644 (file)
@@ -36,9 +36,11 @@ class SketcherPrs_Equal: public SketcherPrs_SymbolPrs
 public:
   /// Constructor
   /// \param theConstraint a constraint feature
+  /// \param theSketcher a sketcher object
   /// \param thePlane a coordinate plane of current sketch
   Standard_EXPORT SketcherPrs_Equal(ModelAPI_Feature* theConstraint,
-                                       const std::shared_ptr<GeomAPI_Ax3>& thePlane);
+                                    ModelAPI_CompositeFeature* theSketcher,
+                                    const std::shared_ptr<GeomAPI_Ax3>& thePlane);
   DEFINE_STANDARD_RTTIEXT(SketcherPrs_Equal, SketcherPrs_SymbolPrs)
 
   /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation
index ab8e6378c9861b9bc407700ac1cf485ab022fec3..6059e0ce0dd643132de9fe999d79c2b8defc24c0 100644 (file)
@@ -38,6 +38,7 @@
 // Macros for constraint presentation definition
 #define CONSTRAINT_PRS_IMPL(NAME, CLASS) \
 AISObjectPtr SketcherPrs_Factory::NAME(ModelAPI_Feature* theConstraint, \
+                                       ModelAPI_CompositeFeature* theSketcher, \
                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane, \
                                        AISObjectPtr thePrevious) \
 { \
@@ -47,28 +48,52 @@ AISObjectPtr SketcherPrs_Factory::NAME(ModelAPI_Feature* theConstraint, \
       anAISObj = thePrevious; \
     else { \
       anAISObj = AISObjectPtr(new GeomAPI_AISObject()); \
-      Handle(CLASS) aPrs = new CLASS(theConstraint, thePlane); \
+      Handle(CLASS) aPrs = new CLASS(theConstraint, theSketcher, thePlane); \
       anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); \
     } \
   } \
   return anAISObj; \
 }
 
-CONSTRAINT_PRS_IMPL(coincidentConstraint, SketcherPrs_Coincident);
+
 CONSTRAINT_PRS_IMPL(collinearConstraint, SketcherPrs_Collinear);
 CONSTRAINT_PRS_IMPL(parallelConstraint, SketcherPrs_Parallel);
 CONSTRAINT_PRS_IMPL(perpendicularConstraint, SketcherPrs_Perpendicular);
 CONSTRAINT_PRS_IMPL(rigidConstraint, SketcherPrs_Rigid);
 CONSTRAINT_PRS_IMPL(equalConstraint, SketcherPrs_Equal);
 CONSTRAINT_PRS_IMPL(tangentConstraint, SketcherPrs_Tangent);
-CONSTRAINT_PRS_IMPL(radiusConstraint, SketcherPrs_Radius);
-CONSTRAINT_PRS_IMPL(lengthDimensionConstraint, SketcherPrs_LengthDimension);
 CONSTRAINT_PRS_IMPL(middleConstraint, SketcherPrs_Middle);
 CONSTRAINT_PRS_IMPL(mirrorConstraint, SketcherPrs_Mirror);
-CONSTRAINT_PRS_IMPL(angleConstraint, SketcherPrs_Angle);
+
+
+
+#define CONSTRAINT2_PRS_IMPL(NAME, CLASS) \
+AISObjectPtr SketcherPrs_Factory::NAME(ModelAPI_Feature* theConstraint, \
+                                       const std::shared_ptr<GeomAPI_Ax3>& thePlane, \
+                                       AISObjectPtr thePrevious) \
+{ \
+  std::shared_ptr<GeomAPI_AISObject> anAISObj; \
+  if (CLASS::IsReadyToDisplay(theConstraint, thePlane)) { \
+    if (thePrevious.get()) \
+      anAISObj = thePrevious; \
+    else { \
+      anAISObj = AISObjectPtr(new GeomAPI_AISObject()); \
+      Handle(CLASS) aPrs = new CLASS(theConstraint, thePlane); \
+      anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); \
+    } \
+  } \
+  return anAISObj; \
+}
+
+
+CONSTRAINT2_PRS_IMPL(coincidentConstraint, SketcherPrs_Coincident);
+CONSTRAINT2_PRS_IMPL(angleConstraint, SketcherPrs_Angle);
+CONSTRAINT2_PRS_IMPL(radiusConstraint, SketcherPrs_Radius);
+CONSTRAINT2_PRS_IMPL(lengthDimensionConstraint, SketcherPrs_LengthDimension);
 
 // Non-standard constraints definition
 AISObjectPtr SketcherPrs_Factory::horisontalConstraint(ModelAPI_Feature* theConstraint,
+                                        ModelAPI_CompositeFeature* theSketcher,
                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane,
                                        AISObjectPtr thePrevious)
 {
@@ -79,7 +104,7 @@ AISObjectPtr SketcherPrs_Factory::horisontalConstraint(ModelAPI_Feature* theCons
     else {
       anAISObj = AISObjectPtr(new GeomAPI_AISObject());
       Handle(SketcherPrs_HVDirection) aPrs =
-        new SketcherPrs_HVDirection(theConstraint, thePlane, true);
+        new SketcherPrs_HVDirection(theConstraint, theSketcher, thePlane, true);
       anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs));
     }
   }
@@ -87,6 +112,7 @@ AISObjectPtr SketcherPrs_Factory::horisontalConstraint(ModelAPI_Feature* theCons
 }
 
 AISObjectPtr SketcherPrs_Factory::verticalConstraint(ModelAPI_Feature* theConstraint,
+                                        ModelAPI_CompositeFeature* theSketcher,
                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane,
                                        AISObjectPtr thePrevious)
 {
@@ -97,7 +123,7 @@ AISObjectPtr SketcherPrs_Factory::verticalConstraint(ModelAPI_Feature* theConstr
     else {
       anAISObj = AISObjectPtr(new GeomAPI_AISObject());
       Handle(SketcherPrs_HVDirection) aPrs =
-        new SketcherPrs_HVDirection(theConstraint, thePlane, false);
+        new SketcherPrs_HVDirection(theConstraint, theSketcher, thePlane, false);
       anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs));
     }
   }
@@ -105,6 +131,7 @@ AISObjectPtr SketcherPrs_Factory::verticalConstraint(ModelAPI_Feature* theConstr
 }
 
 AISObjectPtr SketcherPrs_Factory::translateConstraint(ModelAPI_Feature* theConstraint,
+                                        ModelAPI_CompositeFeature* theSketcher,
                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane,
                                        AISObjectPtr thePrevious)
 {
@@ -115,7 +142,7 @@ AISObjectPtr SketcherPrs_Factory::translateConstraint(ModelAPI_Feature* theConst
     else {
       anAISObj = AISObjectPtr(new GeomAPI_AISObject());
       Handle(SketcherPrs_Transformation) aPrs =
-        new SketcherPrs_Transformation(theConstraint, thePlane, true);
+        new SketcherPrs_Transformation(theConstraint, theSketcher, thePlane, true);
       anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs));
     }
   }
@@ -123,6 +150,7 @@ AISObjectPtr SketcherPrs_Factory::translateConstraint(ModelAPI_Feature* theConst
 }
 
 AISObjectPtr SketcherPrs_Factory::rotateConstraint(ModelAPI_Feature* theConstraint,
+                                        ModelAPI_CompositeFeature* theSketcher,
                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane,
                                        AISObjectPtr thePrevious)
 {
@@ -133,7 +161,7 @@ AISObjectPtr SketcherPrs_Factory::rotateConstraint(ModelAPI_Feature* theConstrai
     else {
       anAISObj = AISObjectPtr(new GeomAPI_AISObject());
       Handle(SketcherPrs_Transformation) aPrs =
-        new SketcherPrs_Transformation(theConstraint, thePlane, false);
+        new SketcherPrs_Transformation(theConstraint, theSketcher, thePlane, false);
       anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs));
     }
   }
index ba4123cfb3451964d07c2282b32ee013db52080e..f59bd0d6173d7dfc316f02ead0e7262558c1d4aa 100644 (file)
 #include "SketcherPrs.h"
 
 #include <ModelAPI_Feature.h>
+#include <ModelAPI_CompositeFeature.h>
 
 #include <GeomAPI_Ax3.h>
 #include <GeomAPI_AISObject.h>
 
 #define GET_CONSTRAINT_PRS(NAME) \
   static AISObjectPtr NAME(ModelAPI_Feature* theConstraint, \
+                           ModelAPI_CompositeFeature* theSketcher, \
                            const std::shared_ptr<GeomAPI_Ax3>& thePlane, \
                            AISObjectPtr thePrevious);
 
 class SKETCHERPRS_EXPORT SketcherPrs_Factory
 {
 public:
-  /// Creates coincedent constraint presentation
-  /// \param theConstraint the constraint
-  /// \param thePlane the current sketch plane
-  /// \param thePrevious the previous presentation
-  GET_CONSTRAINT_PRS(coincidentConstraint)
-
   /// Creates collinear constraint presentation
   /// \param theConstraint the constraint
   /// \param thePlane the current sketch plane
@@ -93,18 +89,6 @@ public:
   /// \param thePrevious the previous presentation
   GET_CONSTRAINT_PRS(tangentConstraint)
 
-  /// Creates radius dimension presentation
-  /// \param theConstraint the constraint
-  /// \param thePlane the current sketch plane
-  /// \param thePrevious the previous presentation
-  GET_CONSTRAINT_PRS(radiusConstraint)
-
-  /// Creates length dimension presentation
-  /// \param theConstraint the constraint
-  /// \param thePlane the current sketch plane
-  /// \param thePrevious the previous presentation
-  GET_CONSTRAINT_PRS(lengthDimensionConstraint)
-
   /// Creates middle constraint presentation
   /// \param theConstraint the constraint
   /// \param thePlane the current sketch plane
@@ -129,11 +113,34 @@ public:
   /// \param thePrevious the previous presentation
   GET_CONSTRAINT_PRS(rotateConstraint)
 
+#define GET_CONSTRAINT2_PRS(NAME) \
+  static AISObjectPtr NAME(ModelAPI_Feature* theConstraint, \
+                           const std::shared_ptr<GeomAPI_Ax3>& thePlane, \
+                           AISObjectPtr thePrevious);
+
+  /// Creates coincedent constraint presentation
+  /// \param theConstraint the constraint
+  /// \param thePlane the current sketch plane
+  /// \param thePrevious the previous presentation
+  GET_CONSTRAINT2_PRS(coincidentConstraint)
+
   /// Creates angle constraint presentation
   /// \param theConstraint the constraint
   /// \param thePlane the current sketch plane
   /// \param thePrevious the previous presentation
-  GET_CONSTRAINT_PRS(angleConstraint)
+  GET_CONSTRAINT2_PRS(angleConstraint)
+
+  /// Creates length dimension presentation
+  /// \param theConstraint the constraint
+  /// \param thePlane the current sketch plane
+  /// \param thePrevious the previous presentation
+  GET_CONSTRAINT2_PRS(lengthDimensionConstraint)
+
+  /// Creates radius dimension presentation
+  /// \param theConstraint the constraint
+  /// \param thePlane the current sketch plane
+  /// \param thePrevious the previous presentation
+  GET_CONSTRAINT2_PRS(radiusConstraint)
 };
 
 #endif
index a53bd64aaf3b3093040c9cb3914ccc539aacd30a..d599d492cc1e16b0c78aa97b14367e73b0967d53 100644 (file)
@@ -33,9 +33,11 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_HVDirection, SketcherPrs_SymbolPrs);
 static Handle(Image_AlienPixMap) MyPixMap;
 
 SketcherPrs_HVDirection::SketcherPrs_HVDirection(ModelAPI_Feature* theConstraint,
+                                           ModelAPI_CompositeFeature* theSketcher,
                                            const std::shared_ptr<GeomAPI_Ax3>& thePlane,
                                            bool isHorisontal)
- : SketcherPrs_SymbolPrs(theConstraint, thePlane), myIsHorisontal(isHorisontal)
+ : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane),
+ myIsHorisontal(isHorisontal)
 {
 }
 
index ea50c41d55ea9262f89e46e94b6837d628af305c..07ffa9a07b6846d661e8b7ec7a0fd130386997bd 100644 (file)
@@ -37,9 +37,11 @@ class SketcherPrs_HVDirection: public SketcherPrs_SymbolPrs
 public:
   /// Constructor
   /// \param theConstraint a constraint feature
+  /// \param theSketcher a sketcher object
   /// \param thePlane a coordinate plane of current sketch
   /// \param isHorisontal a flag horizontal or vertical presentation
   Standard_EXPORT SketcherPrs_HVDirection(ModelAPI_Feature* theConstraint,
+                                          ModelAPI_CompositeFeature* theSketcher,
                                          const std::shared_ptr<GeomAPI_Ax3>& thePlane,
                                          bool isHorisontal);
 
index bfe35b8e5532d96bacb60d2f83c4ead29c7b75ab..ef272b49d898d73129fef0ee812b7f7d8cbc1fb2 100755 (executable)
@@ -33,8 +33,9 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Middle, SketcherPrs_SymbolPrs);
 static Handle(Image_AlienPixMap) MyPixMap;
 
 SketcherPrs_Middle::SketcherPrs_Middle(ModelAPI_Feature* theConstraint,
+                                      ModelAPI_CompositeFeature* theSketcher,
                                      const std::shared_ptr<GeomAPI_Ax3>& thePlane)
- : SketcherPrs_SymbolPrs(theConstraint, thePlane)
+ : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane)
 {
 }
 
index 64871852e174f435233b719312e2f4d8c8b7f064..e5fbda622193d8586cfddccc30e8f7a10b579d28 100755 (executable)
@@ -36,9 +36,11 @@ class SketcherPrs_Middle: public SketcherPrs_SymbolPrs
 public:
   /// Constructor
   /// \param theConstraint a constraint feature
+  /// \param theSketcher a sketcher object
   /// \param thePlane a coordinate plane of current sketch
   Standard_EXPORT SketcherPrs_Middle(ModelAPI_Feature* theConstraint,
-                                       const std::shared_ptr<GeomAPI_Ax3>& thePlane);
+                                     ModelAPI_CompositeFeature* theSketcher,
+                                     const std::shared_ptr<GeomAPI_Ax3>& thePlane);
   DEFINE_STANDARD_RTTIEXT(SketcherPrs_Middle, SketcherPrs_SymbolPrs)
 
   /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation
index 82f61923b2860f0a6835f2d577a9eec6d2839a56..33a650116deaed59f480758d9db6355352847e6b 100644 (file)
@@ -35,8 +35,9 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Mirror, SketcherPrs_SymbolPrs);
 static Handle(Image_AlienPixMap) MyPixMap;
 
 SketcherPrs_Mirror::SketcherPrs_Mirror(ModelAPI_Feature* theConstraint,
+                                      ModelAPI_CompositeFeature* theSketcher,
                                            const std::shared_ptr<GeomAPI_Ax3>& thePlane)
- : SketcherPrs_SymbolPrs(theConstraint, thePlane)
+ : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane)
 {
 }
 
index 758c2ba098e06176f02529e8a8b5ea53e0aa7293..7857e711884eb736630f99236d1f98610ab5c2c3 100644 (file)
@@ -36,8 +36,10 @@ class SketcherPrs_Mirror: public SketcherPrs_SymbolPrs
 public:
   /// Constructor
   /// \param theConstraint a constraint feature
+  /// \param theSketcher a sketcher object
   /// \param thePlane a coordinate plane of current sketch
   Standard_EXPORT SketcherPrs_Mirror(ModelAPI_Feature* theConstraint,
+                                     ModelAPI_CompositeFeature* theSketcher,
                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane);
   DEFINE_STANDARD_RTTIEXT(SketcherPrs_Mirror, SketcherPrs_SymbolPrs)
 
index cfdad6de9bd196631590aa5fcaed0281bc652487..90cdfd1299de6bf9e86b99570675c3fcf4798afb 100644 (file)
@@ -34,8 +34,9 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Parallel, SketcherPrs_SymbolPrs);
 static Handle(Image_AlienPixMap) MyPixMap;
 
 SketcherPrs_Parallel::SketcherPrs_Parallel(ModelAPI_Feature* theConstraint,
+                                          ModelAPI_CompositeFeature* theSketcher,
                                            const std::shared_ptr<GeomAPI_Ax3>& thePlane)
- : SketcherPrs_SymbolPrs(theConstraint, thePlane)
+ : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane)
 {
 }
 
index 0ce747818487c4f84afe0e023cd049d10aabd0a8..d963fcc8b45fbc05a3216134a7672b4ac23fe814 100644 (file)
@@ -36,8 +36,10 @@ class SketcherPrs_Parallel: public SketcherPrs_SymbolPrs
 public:
   /// Constructor
   /// \param theConstraint a constraint feature
+  /// \param theSketcher a sketcher object
   /// \param thePlane a coordinate plane of current sketch
   Standard_EXPORT SketcherPrs_Parallel(ModelAPI_Feature* theConstraint,
+                                       ModelAPI_CompositeFeature* theSketcher,
                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane);
   DEFINE_STANDARD_RTTIEXT(SketcherPrs_Parallel, SketcherPrs_SymbolPrs)
 
index 0dcb01edf49a21bac46993bfad0c282e3a6b7d7d..16b5531009417c484c53acbc634e8aa005d68e2c 100644 (file)
@@ -37,8 +37,9 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Perpendicular, SketcherPrs_SymbolPrs);
 static Handle(Image_AlienPixMap) MyPixMap;
 
 SketcherPrs_Perpendicular::SketcherPrs_Perpendicular(ModelAPI_Feature* theConstraint,
+                                                     ModelAPI_CompositeFeature* theSketcher,
                                                      const std::shared_ptr<GeomAPI_Ax3>& thePlane)
- : SketcherPrs_SymbolPrs(theConstraint, thePlane)
+ : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane)
 {
 }
 
index 5b33377f0c33401caad518aa26aa237ee68cea41..b075d4aa4855dea6ba192953c970ea38dd02b3d5 100644 (file)
@@ -38,8 +38,10 @@ class SketcherPrs_Perpendicular: public SketcherPrs_SymbolPrs
 public:
   /// Constructor
   /// \param theConstraint a constraint feature
+  /// \param theSketcher a sketcher object
   /// \param thePlane a coordinate plane of current sketch
   Standard_EXPORT SketcherPrs_Perpendicular(ModelAPI_Feature* theConstraint,
+                                            ModelAPI_CompositeFeature* theSketcher,
                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane);
 
   DEFINE_STANDARD_RTTIEXT(SketcherPrs_Perpendicular, SketcherPrs_SymbolPrs)
index 8897fa16e1566da48e06ea8e27fb2c23c5bf0e81..c92f1a0abdf521a25719da908401f20a90774c99 100644 (file)
@@ -26,6 +26,9 @@
 #include <GeomAPI_Vertex.h>
 #include <GeomAPI_Dir.h>
 #include <GeomAPI_Ax3.h>
+#include <GeomAPI_Circ.h>
+
+#include <GeomDataAPI_Point2D.h>
 
 #include <SketchPlugin_Line.h>
 #include <SketchPlugin_Circle.h>
@@ -35,6 +38,7 @@
 #include <TopoDS_Vertex.hxx>
 #include <Geom_Curve.hxx>
 #include <TColGeom_SequenceOfCurve.hxx>
+#include <gp_Dir.hxx>
 
 static SketcherPrs_PositionMgr* MyPosMgr = NULL;
 
@@ -185,32 +189,54 @@ gp_Pnt SketcherPrs_PositionMgr::getPosition(ObjectPtr theShape,
 
 //*****************************************************************
 //! Returns curves connected to the given point
-TColGeom_SequenceOfCurve getCurves(const GeomPointPtr& thePnt, const SketcherPrs_SymbolPrs* thePrs)
+std::list<ObjectPtr> getCurves(const GeomPointPtr& thePnt, const SketcherPrs_SymbolPrs* thePrs)
 {
-  TColGeom_SequenceOfCurve aList;
-  //GeomAx3Ptr aAx3 = thePrs->plane();
-  //CompositeFeaturePtr aOwner = thePrs->sketcher();
-  //GeomPnt2dPtr aPnt2d = thePnt->to2D(aAx3->origin(), aAx3->dirX(), aAx3->dirY());
+  std::list<ObjectPtr> aList;
+  GeomAx3Ptr aAx3 = thePrs->plane();
+  ModelAPI_CompositeFeature* aOwner = thePrs->sketcher();
+  GeomPnt2dPtr aPnt2d = thePnt->to2D(aAx3->origin(), aAx3->dirX(), aAx3->dirY());
+
+  int aNbSubs = aOwner->numberOfSubs();
+  for (int i = 0; i < aNbSubs; i++) {
+    FeaturePtr aFeature = aOwner->subFeature(i);
+    if (aFeature->getKind() == SketchPlugin_Line::ID()) {
+      AttributePoint2DPtr aSPnt1 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+        aFeature->data()->attribute(SketchPlugin_Line::START_ID()));
+      AttributePoint2DPtr aSPnt2 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+        aFeature->data()->attribute(SketchPlugin_Line::END_ID()));
 
-  //int aNbSubs = aOwner->numberOfSubs();
-  //for (int i = 0; i < aNbSubs; i++) {
-  //  FeaturePtr aFeature = aOwner->subFeature(i);
-  //  if (aFeature->getKind() == SketchPlugin_Line::ID()) {
-  //    GeomPnt2dPtr aPnt1 =
-  //      SketcherPrs_Tools::getPoint(aFeature.get(), SketchPlugin_Line::START_ID());
-  //    GeomPnt2dPtr aPnt2 =
-  //      SketcherPrs_Tools::getPoint(aFeature.get(), SketchPlugin_Line::END_ID());
-  //    if (aPnt1->isEqual(aPnt2d) || aPnt2->isEqual(aPnt2d)) {
-  //      GeomShapePtr aShp = SketcherPrs_Tools::getShape(aFeature->firstResult());
-  //      GeomCurvePtr aCurv = std::shared_ptr<GeomAPI_Curve>(new GeomAPI_Curve(aShp));
-  //      aList.Append(aCurv->impl<Handle(Geom_Curve)>());
-  //    }
-  //  } else if ((aFeature->getKind() == SketchPlugin_Circle::ID()) ||
-  //            (aFeature->getKind() == SketchPlugin_Arc::ID())) {
-  //    GeomShapePtr aShp = SketcherPrs_Tools::getShape(aFeature->firstResult());
-  //    GeomCurvePtr aCurv = std::shared_ptr<GeomAPI_Curve>(new GeomAPI_Curve(aShp));
-  //  }
-  //}
+      GeomPnt2dPtr aPnt1 = aSPnt1->pnt();
+      GeomPnt2dPtr aPnt2 = aSPnt2->pnt();
+
+      if (aPnt1->isEqual(aPnt2d) || aPnt2->isEqual(aPnt2d)) {
+        GeomShapePtr aShp = SketcherPrs_Tools::getShape(aFeature->firstResult());
+        GeomCurvePtr aCurv = std::shared_ptr<GeomAPI_Curve>(new GeomAPI_Curve(aShp));
+        aList.push_back(aFeature->firstResult());
+      }
+    } else if ((aFeature->getKind() == SketchPlugin_Circle::ID()) ||
+              (aFeature->getKind() == SketchPlugin_Arc::ID())) {
+      GeomCurvePtr aCurve;
+      ObjectPtr aResObj;
+      std::list<ResultPtr> aResults = aFeature->results();
+      std::list<ResultPtr>::const_iterator aIt;
+      for (aIt = aResults.cbegin(); aIt != aResults.cend(); aIt++) {
+        GeomShapePtr aShp = SketcherPrs_Tools::getShape((*aIt));
+        if (aShp->isEdge()) {
+          aResObj = (*aIt);
+          aCurve = std::shared_ptr<GeomAPI_Curve>(new GeomAPI_Curve(aShp));
+          break;
+        }
+      }
+      if (aCurve.get()) {
+        double aStart = aCurve->startParam();
+        double aEnd = aCurve->endParam();
+        GeomCirclePtr  aCircle = GeomCirclePtr(new GeomAPI_Circ(aCurve));
+        double aParam;
+        if (aCircle->parameter(thePnt, 1.e-4, aParam) && (aParam >= aStart) && (aParam <= aEnd))
+          aList.push_back(aResObj);
+      }
+    }
+  }
   return aList;
 }
 
@@ -219,16 +245,31 @@ gp_Pnt SketcherPrs_PositionMgr::getPointPosition(
   ObjectPtr theLine, const SketcherPrs_SymbolPrs* thePrs,
   double theStep, GeomPointPtr thePnt)
 {
-  TColGeom_SequenceOfCurve aCurves = getCurves(thePnt, thePrs);
+  std::list<ObjectPtr> aCurves = getCurves(thePnt, thePrs);
 
   gp_Pnt aP = thePnt->impl<gp_Pnt>();
-  gp_Vec aVec1 = getVector(theLine, thePrs->plane()->dirX(), aP);
+  //gp_Vec aVec1 = getVector(theLine, thePrs->plane()->dirX(), aP);
+  std::list<gp_Vec> aVectors;
+  std::list<ObjectPtr>::const_iterator aItCurv;
+  for (aItCurv = aCurves.cbegin(); aItCurv != aCurves.cend(); aItCurv++) {
+    ObjectPtr aObject = (*aItCurv);
+    gp_Vec aVec = getVector(aObject, thePrs->plane()->dirX(), aP);
+    aVectors.push_back(aVec);
+  }
 
+  gp_Vec aBase = getVector(theLine, thePrs->plane()->dirX(), aP);
+  std::list<double> aAngles;
+  std::list<gp_Vec>::const_iterator aItVec;
+  for (aItVec = aVectors.cbegin(); aItVec != aVectors.cend(); aItVec++) {
+    gp_Vec aVec = (*aItVec);
+    double aAngle = aBase.Angle(aVec);
+    aAngles.push_back(aAngle);
+  }
   // Compute shifting vector for a one symbol
-  gp_Vec aShift = aVec1.Crossed(thePrs->plane()->normal()->impl<gp_Dir>());
-  aShift.Normalize();
-  aShift.Multiply(theStep * 1.5);
-  aP.Translate(aShift);
+  //gp_Vec aShift = aVec1.Crossed(thePrs->plane()->normal()->impl<gp_Dir>());
+  //aShift.Normalize();
+  //aShift.Multiply(theStep * 1.5);
+  //aP.Translate(aShift);
   return aP;
 }
 
index 3ce84501c3bafacab19feeb6831e6112c9b9d1ae..88ad963b7fe5c20090ee0f113023e7994e0d2e19 100644 (file)
@@ -51,8 +51,9 @@ static Handle(Image_AlienPixMap) MyPixMap;
 
 
 SketcherPrs_Rigid::SketcherPrs_Rigid(ModelAPI_Feature* theConstraint,
+                                      ModelAPI_CompositeFeature* theSketcher,
                                            const std::shared_ptr<GeomAPI_Ax3>& thePlane)
- : SketcherPrs_SymbolPrs(theConstraint, thePlane)
+ : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane)
 {
 }
 
index c1aaf2fe0a7ad65f18b291e330121cf7eb944a84..e35045ab7874095632c7c788e110e8e45cceba69 100644 (file)
@@ -38,8 +38,10 @@ class SketcherPrs_Rigid: public SketcherPrs_SymbolPrs
 public:
   /// Constructor
   /// \param theConstraint a constraint feature
+  /// \param theSketcher a sketcher object
   /// \param thePlane a coordinate plane of current sketch
   Standard_EXPORT SketcherPrs_Rigid(ModelAPI_Feature* theConstraint,
+                                    ModelAPI_CompositeFeature* theSketcher,
                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane);
 
 
index 2f75d85191941b669f27c53da05f8b1252bc0b3b..9e91f3ff4e2214738025091df3793a5ce1e19f6f 100644 (file)
@@ -119,8 +119,11 @@ std::map<const char*, Handle(Image_AlienPixMap)> SketcherPrs_SymbolPrs::myIconsM
 
 
 SketcherPrs_SymbolPrs::SketcherPrs_SymbolPrs(ModelAPI_Feature* theConstraint,
+                                             ModelAPI_CompositeFeature* theSketcher,
                                              const std::shared_ptr<GeomAPI_Ax3>& thePlane)
- : AIS_InteractiveObject(), myConstraint(theConstraint), myPlane(thePlane), myIsCustomColor(false)
+ : AIS_InteractiveObject(), myConstraint(theConstraint),
+   myPlane(thePlane), myIsCustomColor(false),
+   mySketcher(theSketcher)
 {
   SetAutoHilight(Standard_False);
 }
@@ -414,9 +417,3 @@ void SketcherPrs_SymbolPrs::BoundingBox(Bnd_Box& theBndBox)
   theBndBox.Update (aTmpBox.CornerMin().x(), aTmpBox.CornerMin().y(), aTmpBox.CornerMin().z(),
                     aTmpBox.CornerMax().x(), aTmpBox.CornerMax().y(), aTmpBox.CornerMax().z());
 }
-
-//*********************************************************************************
-CompositeFeaturePtr SketcherPrs_SymbolPrs::sketcher() const
-{
-  return ModelAPI_Tools::compositeOwner(FeaturePtr(myConstraint));
-}
\ No newline at end of file
index c1cf2b55477f6484125f61f95a70fc8ee7d4cf0d..5d28c1dd1a408e7ca059954a817ce4d30ab9753c 100644 (file)
@@ -56,6 +56,7 @@ public:
   /// \param theConstraint a constraint feature
   /// \param thePlane a coordinate plane of current sketch
   Standard_EXPORT SketcherPrs_SymbolPrs(ModelAPI_Feature* theConstraint,
+                        ModelAPI_CompositeFeature* theSketcher,
                         const std::shared_ptr<GeomAPI_Ax3>& thePlane);
 
   virtual ~SketcherPrs_SymbolPrs();
@@ -78,7 +79,7 @@ public:
   Standard_EXPORT ModelAPI_Feature* feature() const { return myConstraint; }
 
   /// Returns Sketcher object (owner of the constraint)
-  Standard_EXPORT CompositeFeaturePtr sketcher() const;
+  Standard_EXPORT ModelAPI_CompositeFeature* sketcher() const { return mySketcher; }
 
   /// Return array of points where symbols will be placed
   const Handle(Graphic3d_ArrayOfPoints)& pointsArray() const { return myPntArray; }
@@ -147,6 +148,9 @@ protected:
   /// Constraint feature
   ModelAPI_Feature* myConstraint;
 
+  /// Sketcher feature
+  ModelAPI_CompositeFeature* mySketcher;
+
   /// Plane of the current sketcher
   std::shared_ptr<GeomAPI_Ax3> myPlane;
 
index 017e5fc64d621a31bd4fb9352de62f33c934e780..8e10430b39393a5a2e71957bf5840cc0d11bbb6b 100644 (file)
@@ -39,8 +39,9 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Tangent, SketcherPrs_SymbolPrs);
 static Handle(Image_AlienPixMap) MyPixMap;
 
 SketcherPrs_Tangent::SketcherPrs_Tangent(ModelAPI_Feature* theConstraint,
+                                         ModelAPI_CompositeFeature* theSketcher,
                                            const std::shared_ptr<GeomAPI_Ax3>& thePlane)
- : SketcherPrs_SymbolPrs(theConstraint, thePlane)
+ : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane)
 {
 }
 
index be320a54df98c420bfa0af980229684e6ab1dd7f..6da05ce52b96fa70e1451808ef1f47a61524b170 100644 (file)
@@ -37,8 +37,10 @@ class SketcherPrs_Tangent: public SketcherPrs_SymbolPrs
 public:
   /// Constructor
   /// \param theConstraint a constraint feature
+  /// \param theSketcher a sketcher object
   /// \param thePlane a coordinate plane of current sketch
   Standard_EXPORT SketcherPrs_Tangent(ModelAPI_Feature* theConstraint,
+                                      ModelAPI_CompositeFeature* theSketcher,
                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane);
 
   DEFINE_STANDARD_RTTIEXT(SketcherPrs_Tangent, SketcherPrs_SymbolPrs)
index a409bcc94c770dfae15d8f4c1a4e211cf2db7a33..ed54c12582773a634fd0d83483bef1657238d25d 100644 (file)
@@ -42,9 +42,10 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Transformation, SketcherPrs_SymbolPrs);
 static Handle(Image_AlienPixMap) MyPixMap;
 
 SketcherPrs_Transformation::SketcherPrs_Transformation(ModelAPI_Feature* theConstraint,
+                                           ModelAPI_CompositeFeature* theSketcher,
                                            const std::shared_ptr<GeomAPI_Ax3>& thePlane,
                                            bool isTranslation)
- : SketcherPrs_SymbolPrs(theConstraint, thePlane), myIsTranslation(isTranslation)
+ : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane), myIsTranslation(isTranslation)
 {
 }
 
index ed733b0bee37dd0d5b5f4cc2cf2bba0326ba80d6..e68397ff443dbfc2747ee873d1507f67168725b2 100644 (file)
@@ -37,9 +37,11 @@ class SketcherPrs_Transformation: public SketcherPrs_SymbolPrs
 public:
   /// Constructor
   /// \param theConstraint a constraint feature
+  /// \param theSketcher a sketcher object
   /// \param thePlane a coordinate plane of current sketch
   /// \param isTranslation a flag is it translation or rotation
   Standard_EXPORT SketcherPrs_Transformation(ModelAPI_Feature* theConstraint,
+                                            ModelAPI_CompositeFeature* theSketcher,
                                          const std::shared_ptr<GeomAPI_Ax3>& thePlane,
                                          bool isTranslation);