From: nds Date: Tue, 24 Jun 2014 11:44:52 +0000 (+0400) Subject: refs #80 - Sketch base GUI: create/draw point, circle and arc X-Git-Tag: V_0.4.4~260 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=975c481c4d5b3c2def28b6674b9c58e47f25ee95;p=modules%2Fshaper.git refs #80 - Sketch base GUI: create/draw point, circle and arc Parallel, perpendicular features. --- diff --git a/src/ModuleBase/ModuleBase_WidgetFeature.cpp b/src/ModuleBase/ModuleBase_WidgetFeature.cpp index 37ed734c0..6007743f5 100644 --- a/src/ModuleBase/ModuleBase_WidgetFeature.cpp +++ b/src/ModuleBase/ModuleBase_WidgetFeature.cpp @@ -31,7 +31,7 @@ ModuleBase_WidgetFeature::~ModuleBase_WidgetFeature() bool ModuleBase_WidgetFeature::setFeature(const FeaturePtr& theFeature) { - if (!theFeature && myFeatureKinds.contains(theFeature->getKind().c_str())) + if (!theFeature || !myFeatureKinds.contains(theFeature->getKind().c_str())) return false; //bool isBlocked = this->blockSignals(true); diff --git a/src/PartSet/PartSet_OperationFeatureCreate.cpp b/src/PartSet/PartSet_OperationFeatureCreate.cpp index 516a308d4..fb36405b0 100644 --- a/src/PartSet/PartSet_OperationFeatureCreate.cpp +++ b/src/PartSet/PartSet_OperationFeatureCreate.cpp @@ -17,6 +17,10 @@ #include #include #include +#include +#include +#include +#include #include @@ -55,8 +59,13 @@ PartSet_OperationFeatureCreate::~PartSet_OperationFeatureCreate() bool PartSet_OperationFeatureCreate::canProcessKind(const std::string& theId) { return theId == SKETCH_LINE_KIND || theId == SKETCH_POINT_KIND || - theId == SKETCH_CONSTRAINT_DISTANCE_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 || + theId == SKETCH_CONSTRAINT_PARALLEL_KIND || + theId == SKETCH_CONSTRAINT_PERPENDICULAR_KIND; } bool PartSet_OperationFeatureCreate::canBeCommitted() const diff --git a/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp b/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp index b5fe8fca3..7218a5341 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintLength.cpp @@ -4,6 +4,8 @@ #include "SketchPlugin_ConstraintLength.h" +#include + #include #include @@ -15,6 +17,7 @@ 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()); } diff --git a/src/SketchPlugin/plugin-Sketch.xml b/src/SketchPlugin/plugin-Sketch.xml index c741ab09c..b184363a3 100644 --- a/src/SketchPlugin/plugin-Sketch.xml +++ b/src/SketchPlugin/plugin-Sketch.xml @@ -1,7 +1,7 @@ - + @@ -26,17 +26,29 @@ + + + + + + + - - diff --git a/src/SketchSolver/SketchSolver_Constraint.cpp b/src/SketchSolver/SketchSolver_Constraint.cpp index 1b92bf947..67a177038 100644 --- a/src/SketchSolver/SketchSolver_Constraint.cpp +++ b/src/SketchSolver/SketchSolver_Constraint.cpp @@ -183,7 +183,7 @@ const int& SketchSolver_Constraint::getType(boost::shared_ptr( theConstraint->data()->attribute(CONSTRAINT_ATTRIBUTES[indAttr]) ); - if (!anAttr || !anAttr->isFeature()) continue; + if (!anAttr || !anAttr->isFeature() || !anAttr->feature()) continue; const std::string& aKind = anAttr->feature()->getKind(); if (aKind.compare(SKETCH_LINE_KIND) == 0) {