#include <SketchPlugin_ConstraintDistance.h>
#include <SketchPlugin_ConstraintLength.h>
#include <SketchPlugin_ConstraintRadius.h>
+#include <SketchPlugin_ConstraintRigid.h>
#include <SketchPlugin_Constraint.h>
#include <ModuleBase_ViewerPrs.h>
FeaturePtr PartSet_Tools::nearestFeature(QPoint thePoint, Handle_V3d_View theView,
FeaturePtr theSketch,
- const std::list<ModuleBase_ViewerPrs>& theFeatures)
+ const QList<ModuleBase_ViewerPrs>& theFeatures)
{
double aX, anY;
gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(thePoint, theView);
PartSet_Tools::convertTo2D(aPoint, theSketch, theView, aX, anY);
FeaturePtr aFeature;
- std::list<ModuleBase_ViewerPrs>::const_iterator anIt = theFeatures.begin(), aLast = theFeatures
- .end();
-
FeaturePtr aDeltaFeature;
double aMinDelta = -1;
ModuleBase_ViewerPrs aPrs;
- for (; anIt != aLast; anIt++) {
- aPrs = *anIt;
+ foreach (ModuleBase_ViewerPrs aPrs, theFeatures) {
if (!aPrs.object())
continue;
boost::shared_ptr<SketchPlugin_Feature> aSketchFeature = boost::dynamic_pointer_cast<
boost::shared_ptr<ModelAPI_Document> PartSet_Tools::document()
{
- return ModelAPI_Session::get()->rootDocument();
+ return ModelAPI_Session::get()->moduleDocument();
}
void PartSet_Tools::setFeaturePoint(FeaturePtr theFeature, double theX, double theY,
return aFeature;
}
-void PartSet_Tools::createConstraint(FeaturePtr theSketch,
+void PartSet_Tools::createConstraint(CompositeFeaturePtr theSketch,
boost::shared_ptr<GeomDataAPI_Point2D> thePoint1,
boost::shared_ptr<GeomDataAPI_Point2D> thePoint2)
{
- boost::shared_ptr<ModelAPI_Document> aDoc = document();
- FeaturePtr aFeature = aDoc->addFeature(SketchPlugin_ConstraintCoincidence::ID());
-
+ FeaturePtr aFeature;
if (theSketch) {
- boost::shared_ptr<SketchPlugin_Feature> aSketch = boost::dynamic_pointer_cast<
- SketchPlugin_Feature>(theSketch);
- aSketch->addSub(aFeature);
+ aFeature = theSketch->addFeature(SketchPlugin_ConstraintCoincidence::ID());
+ } else {
+ boost::shared_ptr<ModelAPI_Document> aDoc = document();
+ aFeature = aDoc->addFeature(SketchPlugin_ConstraintCoincidence::ID());
}
boost::shared_ptr<ModelAPI_Data> aData = aFeature->data();
aFeature->execute();
}
-void PartSet_Tools::setConstraints(FeaturePtr theSketch, FeaturePtr theFeature,
+void PartSet_Tools::setConstraints(CompositeFeaturePtr theSketch, FeaturePtr theFeature,
const std::string& theAttribute, double theClickedX,
double theClickedY)
{
}
}
-boost::shared_ptr<GeomAPI_Pln> PartSet_Tools::sketchPlane(FeaturePtr theSketch)
+boost::shared_ptr<GeomAPI_Pln> PartSet_Tools::sketchPlane(CompositeFeaturePtr theSketch)
{
boost::shared_ptr<GeomAPI_Pln> aPlane;
double aA, aB, aC, aD;
}
boost::shared_ptr<GeomAPI_Pnt> PartSet_Tools::point3D(boost::shared_ptr<GeomAPI_Pnt2d> thePoint2D,
- FeaturePtr theSketch)
+ CompositeFeaturePtr theSketch)
{
boost::shared_ptr<GeomAPI_Pnt> aPoint;
if (!theSketch || !thePoint2D)
{
return theKind == SketchPlugin_ConstraintDistance::ID()
|| theKind == SketchPlugin_ConstraintLength::ID()
- || theKind == SketchPlugin_ConstraintRadius::ID();
+ || theKind == SketchPlugin_ConstraintRadius::ID()
+ || theKind == SketchPlugin_ConstraintRigid::ID();
}