PartSet_OperationConstraint::PartSet_OperationConstraint(const QString& theId,
QObject* theParent,
- boost::shared_ptr<ModelAPI_Feature> theFeature)
+ FeaturePtr theFeature)
: PartSet_OperationSketchBase(theId, theParent), mySketch(theFeature)
{
}
return theOperation->getDescription()->operationId().toStdString() == PartSet_OperationSketch::Type();
}
-void PartSet_OperationConstraint::init(boost::shared_ptr<ModelAPI_Feature> theFeature,
+void PartSet_OperationConstraint::init(FeaturePtr theFeature,
const std::list<XGUI_ViewerPrs>& /*theSelected*/,
const std::list<XGUI_ViewerPrs>& /*theHighlighted*/)
{
- //if (!theFeature || theFeature->getKind() != "SketchLine")
+ //if (!theFeature || theFeature->getKind() != SKETCH_LINE_KIND)
// return;
// use the last point of the previous feature as the first of the new one
//boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
//myInitPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(LINE_ATTR_END));
}
-boost::shared_ptr<ModelAPI_Feature> PartSet_OperationConstraint::sketch() const
+FeaturePtr PartSet_OperationConstraint::sketch() const
{
return mySketch;
}
}
else {
XGUI_ViewerPrs aPrs = theSelected.front();
- boost::shared_ptr<ModelAPI_Feature> aFeature = aPrs.feature();
+ FeaturePtr aFeature = aPrs.feature();
setFeature(aFeature);
setValue(120);
}
else if (aShape.ShapeType() == TopAbs_EDGE) // the line is selected
{
- boost::shared_ptr<ModelAPI_Feature> aFeature = aPrs.feature();
+ FeaturePtr aFeature = aPrs.feature();
if (aFeature) {
double X0, X1, X2, X3;
double Y0, Y1, Y2, Y3;
- getLinePoint(aFeature, LINE_ATTR_START, X2, Y2);
- getLinePoint(aFeature, LINE_ATTR_END, X3, Y3);
+ PartSet_Tools::getLinePoint(aFeature, LINE_ATTR_START, X2, Y2);
+ PartSet_Tools::getLinePoint(aFeature, LINE_ATTR_END, X3, Y3);
PartSet_Tools::convertTo2D(aPoint, sketch(), theView, X1, Y1);
switch (myPointSelectionMode) {
PartSet_Tools::projectPointOnLine(X2, Y2, X3, Y3, X1, Y1, aX, anY);
break;
case SM_SecondPoint: {
- getLinePoint(feature(), LINE_ATTR_START, X0, Y0);
+ PartSet_Tools::getLinePoint(feature(), LINE_ATTR_START, X0, Y0);
PartSet_Tools::intersectLines(X0, Y0, X1, Y1, X2, Y2, X3, Y3, aX, anY);
}
break;
emit featureConstructed(feature(), FM_Deactivation);
}
-boost::shared_ptr<ModelAPI_Feature> PartSet_OperationConstraint::createFeature(const bool theFlushMessage)
+FeaturePtr PartSet_OperationConstraint::createFeature(const bool theFlushMessage)
{
- boost::shared_ptr<ModelAPI_Feature> aNewFeature = ModuleBase_Operation::createFeature(false);
+ FeaturePtr aNewFeature = ModuleBase_Operation::createFeature(false);
if (sketch()) {
boost::shared_ptr<SketchPlugin_Feature> aFeature =
boost::dynamic_pointer_cast<SketchPlugin_Feature>(sketch());
boost::shared_ptr<ModelAPI_Data> aData = aNewFeature->data();
boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>
(aData->attribute(LINE_ATTR_START));
- createConstraint(myInitPoint, aPoint);
+ PartSet_Tools::createConstraint(myInitPoint, aPoint);
}*/
emit featureConstructed(aNewFeature, FM_Activation);
return aNewFeature;
}
-void PartSet_OperationConstraint::setFeature(boost::shared_ptr<ModelAPI_Feature> theFeature)
+void PartSet_OperationConstraint::setFeature(FeaturePtr theFeature)
{
- if (!theFeature || theFeature->getKind() != "SketchLine")
+ if (!theFeature || theFeature->getKind() != SKETCH_LINE_KIND)
return;
boost::shared_ptr<ModelAPI_Data> aData = feature()->data();