]> 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

src/ModuleBase/ModuleBase_WidgetFactory.cpp
src/PartSet/PartSet_OperationFeatureCreate.cpp
src/SketchPlugin/SketchPlugin_Arc.cpp
src/SketchPlugin/SketchPlugin_ConstraintLength.cpp
src/SketchPlugin/SketchPlugin_ConstraintLength.h

index e122c52504b6633feb7e573e8ed2d885b91899ed..a88a3086063388ad47af60ad03e314a8f52d1f54 100644 (file)
@@ -100,6 +100,7 @@ QWidget* ModuleBase_WidgetFactory::labelControl(QWidget* theParent)
   QWidget* result = new QWidget(theParent);
   QVBoxLayout* aLabelLay = new QVBoxLayout(result);
   QLabel* aLabel = new QLabel(result);
+  aLabel->setWordWrap(true);
   aLabel->setText(qs(myWidgetApi->getProperty(INFO_WDG_TEXT)));
   aLabel->setToolTip(qs(myWidgetApi->getProperty(INFO_WDG_TOOLTIP)));
   aLabelLay->addWidget(aLabel);
index 5da96ccb9dd0fc0538a045e30a2ecf39be67d3b3..43b841bca025fa713af1808b25ae09b703927615 100644 (file)
@@ -59,8 +59,8 @@ PartSet_OperationFeatureCreate::~PartSet_OperationFeatureCreate()
 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_LENGTH_KIND ||
          theId == SKETCH_CONSTRAINT_RADIUS_KIND /*||
@@ -113,7 +113,7 @@ void PartSet_OperationFeatureCreate::mouseReleased(QMouseEvent* theEvent, Handle
     return;
   }
 
-  double aX, anY;
+  double aX = 0, anY = 0;
 
   gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theView);
   if (theSelected.empty()) {
index 5bb8fa0d242862e16f24e07455d1647a0deae0c2..ed8d3be222a4874f54694d3ac2d7884ffe04347a 100644 (file)
@@ -6,6 +6,7 @@
 #include "SketchPlugin_Sketch.h"
 #include <ModelAPI_Data.h>
 
+#include <GeomAPI_Circ2d.h>
 #include <GeomAPI_Pnt2d.h>
 
 #include <GeomDataAPI_Point2D.h>
@@ -15,6 +16,8 @@
 #include <GeomAlgoAPI_EdgeBuilder.h>
 #include <GeomAlgoAPI_CompoundBuilder.h>
 
+#include <Precision.hxx>
+
 SketchPlugin_Arc::SketchPlugin_Arc()
   : SketchPlugin_Feature()
 {
@@ -50,15 +53,23 @@ const boost::shared_ptr<GeomAPI_Shape>& SketchPlugin_Arc::preview()
       boost::dynamic_pointer_cast<GeomDataAPI_Dir>(aSketch->data()->attribute(SKETCH_ATTR_NORM));
     bool aHasPlane = aNDir && !(aNDir->x() == 0 && aNDir->y() == 0 && aNDir->z() == 0);
     if (aHasPlane) {
-      boost::shared_ptr<GeomAPI_Dir> aNormal(new GeomAPI_Dir(aNDir->x(), aNDir->y(), aNDir->z()));
+      boost::shared_ptr<GeomAPI_Dir> aNormal = aNDir->dir();
       // compute the arc start point
       boost::shared_ptr<GeomDataAPI_Point2D> aStartAttr = 
         boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(ARC_ATTR_START));
       boost::shared_ptr<GeomAPI_Pnt> aStartPoint(aSketch->to3D(aStartAttr->x(), aStartAttr->y()));
 
-      // compute the arc end point
+      // compute and change the arc end point
       boost::shared_ptr<GeomDataAPI_Point2D> anEndAttr = 
         boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(ARC_ATTR_END));
+      if (anEndAttr->isInitialized())
+      {
+        boost::shared_ptr<GeomAPI_Circ2d> aCircleForArc(
+          new GeomAPI_Circ2d(aCenterAttr->pnt(), aStartAttr->pnt()));
+        boost::shared_ptr<GeomAPI_Pnt2d> aProjection = aCircleForArc->project(anEndAttr->pnt());
+        if (aProjection && anEndAttr->pnt()->distance(aProjection) > Precision::Confusion())
+          anEndAttr->setValue(aProjection);
+      }
       boost::shared_ptr<GeomAPI_Pnt> aEndPoint(aSketch->to3D(anEndAttr->x(), anEndAttr->y()));
 
       boost::shared_ptr<GeomAPI_Shape> aCircleShape = 
index 7f54f794778dd8b8d7fc235a31e97d662ca396ae..b911ea9a424deac698808b85a683d87e34a47572 100644 (file)
@@ -26,7 +26,6 @@ SketchPlugin_ConstraintLength::SketchPlugin_ConstraintLength()
 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_PNT, GeomDataAPI_Point2D::type());
   data()->addAttribute(CONSTRAINT_ATTR_ENTITY_A, ModelAPI_AttributeRefAttr::type());
 }
@@ -71,9 +70,6 @@ Handle(AIS_InteractiveObject) SketchPlugin_ConstraintLength::getAISShape(
   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();
   // fly out calculation
   boost::shared_ptr<GeomDataAPI_Point2D> aFlyOutAttr = 
     boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(CONSTRAINT_ATTR_FLYOUT_VALUE_PNT));
index 52012c4194eb8a87983cf8a89549d4e59bf6e8f4..85675da3b88c22cccce3945fa6eec1c5ccc9aa72 100644 (file)
@@ -19,7 +19,7 @@ const std::string SKETCH_CONSTRAINT_LENGTH_KIND("SketchConstraintLength");
  *
  *  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
 {