]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'master' of newgeom:newgeom
authornds <natalia.donis@opencascade.com>
Tue, 24 Jun 2014 15:39:37 +0000 (19:39 +0400)
committernds <natalia.donis@opencascade.com>
Tue, 24 Jun 2014 15:39:37 +0000 (19:39 +0400)
Conflicts:
src/PartSet/PartSet_OperationFeatureCreate.cpp

1  2 
src/PartSet/PartSet_OperationFeatureCreate.cpp
src/SketchPlugin/SketchPlugin_ConstraintLength.cpp
src/SketchPlugin/SketchPlugin_ConstraintLength.h

index 5da96ccb9dd0fc0538a045e30a2ecf39be67d3b3,2e864b576de077897f54c6085983b1a69970d974..43b841bca025fa713af1808b25ae09b703927615
@@@ -59,11 -59,11 +59,11 @@@ PartSet_OperationFeatureCreate::~PartSe
  bool PartSet_OperationFeatureCreate::canProcessKind(const std::string& theId)
  {
    return theId == SKETCH_LINE_KIND || theId == SKETCH_POINT_KIND ||
-          theId == SKETCH_CIRCLE_KIND /*||
-          theId == SKETCH_ARC_KIND*/ ||
+          theId == SKETCH_CIRCLE_KIND ||
+          theId == SKETCH_ARC_KIND ||
 -         theId == SKETCH_CONSTRAINT_DISTANCE_KIND /*||
 +         theId == SKETCH_CONSTRAINT_DISTANCE_KIND ||
           theId == SKETCH_CONSTRAINT_LENGTH_KIND ||
 -         theId == SKETCH_CONSTRAINT_RADIUS_KIND ||
 +         theId == SKETCH_CONSTRAINT_RADIUS_KIND /*||
           theId == SKETCH_CONSTRAINT_PARALLEL_KIND ||
           theId == SKETCH_CONSTRAINT_PERPENDICULAR_KIND*/;
  }
index 7f54f794778dd8b8d7fc235a31e97d662ca396ae,6e48926c662b7f26eeedfd4cedab1b415ce5d7b6..b911ea9a424deac698808b85a683d87e34a47572
@@@ -26,7 -23,7 +26,6 @@@ SketchPlugin_ConstraintLength::SketchPl
  void SketchPlugin_ConstraintLength::initAttributes()
  {
    data()->addAttribute(CONSTRAINT_ATTR_VALUE,    ModelAPI_AttributeDouble::type());
-   //data()->addAttribute(CONSTRAINT_ATTR_FLYOUT_VALUE, ModelAPI_AttributeDouble::type());
 -  data()->addAttribute(CONSTRAINT_ATTR_FLYOUT_VALUE, ModelAPI_AttributeDouble::type());
    data()->addAttribute(CONSTRAINT_ATTR_FLYOUT_VALUE_PNT, GeomDataAPI_Point2D::type());
    data()->addAttribute(CONSTRAINT_ATTR_ENTITY_A, ModelAPI_AttributeRefAttr::type());
  }
@@@ -71,29 -48,10 +70,26 @@@ Handle(AIS_InteractiveObject) SketchPlu
    if (!aFeature || aFeature->getKind() != SKETCH_LINE_KIND)
      return thePrevious;
  
-   //boost::shared_ptr<ModelAPI_AttributeDouble> aFlyoutAttr = 
-   //  boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(data()->attribute(CONSTRAINT_ATTR_FLYOUT_VALUE));
-   //double aFlyout = aFlyoutAttr->value();
 -  boost::shared_ptr<ModelAPI_AttributeDouble> aFlyoutAttr = 
 -    boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(data()->attribute(CONSTRAINT_ATTR_FLYOUT_VALUE));
 -  double aFlyout = aFlyoutAttr->value();
 -
 +  // fly out calculation
 +  boost::shared_ptr<GeomDataAPI_Point2D> aFlyOutAttr = 
 +    boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(CONSTRAINT_ATTR_FLYOUT_VALUE_PNT));
 +  boost::shared_ptr<GeomAPI_Pnt2d> aFlyOutPnt = aFlyOutAttr->pnt();
 +
 +  boost::shared_ptr<GeomDataAPI_Point2D> aStartPoint =
 +    boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aFeature->data()->attribute(LINE_ATTR_START));
 +  boost::shared_ptr<GeomDataAPI_Point2D> anEndPoint =
 +     boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aFeature->data()->attribute(LINE_ATTR_END));
 +
 +  boost::shared_ptr<GeomAPI_Lin2d> aFeatureLin = boost::shared_ptr<GeomAPI_Lin2d>
 +                                             (new GeomAPI_Lin2d(aStartPoint->x(), aStartPoint->y(),
 +                                                                anEndPoint->x(), anEndPoint->y()));
 +  boost::shared_ptr<GeomAPI_Pnt2d> aProjectedPoint = aFeatureLin->project(aFlyOutPnt);
 +  double aDistance = aFlyOutPnt->distance(aProjectedPoint);
 +  if (!aFeatureLin->isRight(aFlyOutPnt))
 +    aDistance = -aDistance;
 +  double aFlyout = aDistance;
 +
 +  // value
    boost::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = 
      boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(data()->attribute(CONSTRAINT_ATTR_VALUE));
    double aValue = aValueAttr->value();
index 52012c4194eb8a87983cf8a89549d4e59bf6e8f4,52012c4194eb8a87983cf8a89549d4e59bf6e8f4..85675da3b88c22cccce3945fa6eec1c5ccc9aa72
@@@ -19,7 -19,7 +19,7 @@@ const std::string SKETCH_CONSTRAINT_LEN
   *
   *  These constraint has two attributes:
   *  CONSTRAINT_ATTR_VALUE (length) and CONSTRAINT_ATTR_ENTITY_A (segment),
-- *  CONSTRAINT_ATTR_FLYOUT_VALUE (distance of a constraints handle)
++ *  CONSTRAINT_ATTR_FLYOUT_VALUE_PNT (distance of a constraints handle)
   */
  class SketchPlugin_ConstraintLength: public SketchPlugin_Constraint
  {