#include <GeomAPI_Dir.h>
#include <GeomAPI_Pnt2d.h>
-#include <SketchPlugin_Point.h>
-#include <SketchPlugin_Circle.h>
#include <SketchPlugin_Constraint.h>
#include <AIS_Drawer.hxx>
IMPLEMENT_STANDARD_HANDLE(SketcherPrs_Coincident, AIS_InteractiveObject);
IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Coincident, AIS_InteractiveObject);
-SketcherPrs_Coincident::SketcherPrs_Coincident(SketchPlugin_Constraint* theConstraint,
+SketcherPrs_Coincident::SketcherPrs_Coincident(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: AIS_InteractiveObject(), myConstraint(theConstraint), myPlane(thePlane)
{
#define SketcherPrs_Coincident_H
#include <GeomAPI_Ax3.h>
+#include <ModelAPI_Feature.h>
#include <AIS_InteractiveObject.hxx>
#include <Standard_DefineHandle.hxx>
-class SketchPlugin_Constraint;
-
DEFINE_STANDARD_HANDLE(SketcherPrs_Coincident, AIS_InteractiveObject)
public:
/// Constructor
/// \param theResult a result object
- Standard_EXPORT SketcherPrs_Coincident(SketchPlugin_Constraint* theConstraint,
+ Standard_EXPORT SketcherPrs_Coincident(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
Standard_EXPORT virtual void SetColor(const Quantity_Color& aColor);
const Standard_Integer aMode) ;
private:
- SketchPlugin_Constraint* myConstraint;
+ ModelAPI_Feature* myConstraint;
std::shared_ptr<GeomAPI_Ax3> myPlane;
};
static Handle(Image_AlienPixMap) MyPixMap;
-SketcherPrs_Equal::SketcherPrs_Equal(SketchPlugin_Constraint* theConstraint,
+SketcherPrs_Equal::SketcherPrs_Equal(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: SketcherPrs_SymbolPrs(theConstraint, thePlane)
{
#include "SketcherPrs_SymbolPrs.h"
-class SketchPlugin_Constraint;
-class SketchPlugin_Sketch;
-
DEFINE_STANDARD_HANDLE(SketcherPrs_Equal, SketcherPrs_SymbolPrs)
/// Constructor
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
- Standard_EXPORT SketcherPrs_Equal(SketchPlugin_Constraint* theConstraint,
+ Standard_EXPORT SketcherPrs_Equal(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
DEFINE_STANDARD_RTTI(SketcherPrs_Equal)
protected:
#include "SketcherPrs_LengthDimension.h"
#define CONSTRAINT_PRS_IMPL(NAME, CLASS) \
-AISObjectPtr SketcherPrs_Factory::NAME(SketchPlugin_Constraint* theConstraint, \
+AISObjectPtr SketcherPrs_Factory::NAME(ModelAPI_Feature* theConstraint, \
const std::shared_ptr<GeomAPI_Ax3>& thePlane) \
{ \
std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject()); \
CONSTRAINT_PRS_IMPL(lengthDimensionConstraint, SketcherPrs_LengthDimension);
-AISObjectPtr SketcherPrs_Factory::horisontalConstraint(SketchPlugin_Constraint* theConstraint,
+AISObjectPtr SketcherPrs_Factory::horisontalConstraint(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
{
std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject());
return aAISObj;
}
-AISObjectPtr SketcherPrs_Factory::verticalConstraint(SketchPlugin_Constraint* theConstraint,
+AISObjectPtr SketcherPrs_Factory::verticalConstraint(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
{
std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject());
#include "SketcherPrs.h"
+#include <ModelAPI_Feature.h>
+
#include <GeomAPI_Ax3.h>
#include <GeomAPI_AISObject.h>
-class SketchPlugin_Constraint;
-
#define GET_CONSTRAINT_PRS(NAME) \
- static AISObjectPtr NAME(SketchPlugin_Constraint* theConstraint, \
+ static AISObjectPtr NAME(ModelAPI_Feature* theConstraint, \
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
static Handle(Image_AlienPixMap) MyPixMap;
-SketcherPrs_HVDirection::SketcherPrs_HVDirection(SketchPlugin_Constraint* theConstraint,
+SketcherPrs_HVDirection::SketcherPrs_HVDirection(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane,
bool isHorisontal)
: SketcherPrs_SymbolPrs(theConstraint, thePlane), myIsHorisontal(isHorisontal)
#define SketcherPrs_HVDirection_H
#include "SketcherPrs_SymbolPrs.h"
-
-class SketchPlugin_Constraint;
-class SketchPlugin_Sketch;
+#include <ModelAPI_Feature.h>
DEFINE_STANDARD_HANDLE(SketcherPrs_HVDirection, SketcherPrs_SymbolPrs)
/// Constructor
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
- Standard_EXPORT SketcherPrs_HVDirection(SketchPlugin_Constraint* theConstraint,
+ Standard_EXPORT SketcherPrs_HVDirection(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane,
bool isHorisontal);
IMPLEMENT_STANDARD_HANDLE(SketcherPrs_LengthDimension, AIS_LengthDimension);
IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_LengthDimension, AIS_LengthDimension);
-SketcherPrs_LengthDimension::SketcherPrs_LengthDimension(SketchPlugin_Constraint* theConstraint,
+SketcherPrs_LengthDimension::SketcherPrs_LengthDimension(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: AIS_LengthDimension(MyDefStart, MyDefEnd, MyDefPln),
myConstraint(theConstraint), myPlane(thePlane)
aPnt_A = aPoint_A->pnt();
aPnt_B = aPoint_B->pnt();
} else if (!aPoint_A && aPoint_B) {
-// std::shared_ptr<SketchPlugin_Line> aLine = SketcherPrs_Tools::getFeatureLine(
-// aData, SketchPlugin_Constraint::ENTITY_A());
-// if (aLine) {
-// aPnt_B = aPoint_B->pnt();
-// aPnt_A = SketcherPrs_Tools::getProjectionPoint(aLine, aPnt_B);
-// }
+ FeaturePtr aLine = SketcherPrs_Tools::getFeatureLine(
+ aData, SketchPlugin_Constraint::ENTITY_A());
+ if (aLine) {
+ aPnt_B = aPoint_B->pnt();
+ aPnt_A = SketcherPrs_Tools::getProjectionPoint(aLine, aPnt_B);
+ }
} else if (aPoint_A && !aPoint_B) {
-// std::shared_ptr<SketchPlugin_Line> aLine = SketcherPrs_Tools::getFeatureLine(
-// aData, SketchPlugin_Constraint::ENTITY_B());
-// if (aLine) {
-// aPnt_A = aPoint_A->pnt();
-// aPnt_B = SketcherPrs_Tools::getProjectionPoint(aLine, aPnt_A);
-// }
+ FeaturePtr aLine = SketcherPrs_Tools::getFeatureLine(
+ aData, SketchPlugin_Constraint::ENTITY_B());
+ if (aLine) {
+ aPnt_A = aPoint_A->pnt();
+ aPnt_B = SketcherPrs_Tools::getProjectionPoint(aLine, aPnt_A);
+ }
}
if (!aPnt_A || !aPnt_B)
return false;
#define SketcherPrs_LinearDimension_H
#include <GeomAPI_Ax3.h>
+#include <ModelAPI_Feature.h>
#include <AIS_LengthDimension.hxx>
#include <Standard_DefineHandle.hxx>
-class SketchPlugin_Constraint;
-
DEFINE_STANDARD_HANDLE(SketcherPrs_LengthDimension, AIS_LengthDimension)
/**
/// Constructor
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
- Standard_EXPORT SketcherPrs_LengthDimension(SketchPlugin_Constraint* theConstraint,
+ Standard_EXPORT SketcherPrs_LengthDimension(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
std::string constraintType() const;
bool getPoints(gp_Pnt& thePnt1, gp_Pnt& thePnt2) const;
/// Constraint feature
- SketchPlugin_Constraint* myConstraint;
+ ModelAPI_Feature* myConstraint;
/// Plane of the current sketcher
std::shared_ptr<GeomAPI_Ax3> myPlane;
static Handle(Image_AlienPixMap) MyPixMap;
-SketcherPrs_Parallel::SketcherPrs_Parallel(SketchPlugin_Constraint* theConstraint,
+SketcherPrs_Parallel::SketcherPrs_Parallel(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: SketcherPrs_SymbolPrs(theConstraint, thePlane)
{
#include "SketcherPrs_SymbolPrs.h"
-class SketchPlugin_Constraint;
-class SketchPlugin_Sketch;
-
DEFINE_STANDARD_HANDLE(SketcherPrs_Parallel, SketcherPrs_SymbolPrs)
/// Constructor
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
- Standard_EXPORT SketcherPrs_Parallel(SketchPlugin_Constraint* theConstraint,
+ Standard_EXPORT SketcherPrs_Parallel(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
DEFINE_STANDARD_RTTI(SketcherPrs_Parallel)
protected:
static Handle(Image_AlienPixMap) MyPixMap;
-SketcherPrs_Perpendicular::SketcherPrs_Perpendicular(SketchPlugin_Constraint* theConstraint,
+SketcherPrs_Perpendicular::SketcherPrs_Perpendicular(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: SketcherPrs_SymbolPrs(theConstraint, thePlane)
{
/// Constructor
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
- Standard_EXPORT SketcherPrs_Perpendicular(SketchPlugin_Constraint* theConstraint,
+ Standard_EXPORT SketcherPrs_Perpendicular(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
DEFINE_STANDARD_RTTI(SketcherPrs_Perpendicular)
IMPLEMENT_STANDARD_HANDLE(SketcherPrs_Radius, AIS_RadiusDimension);
IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Radius, AIS_RadiusDimension);
-SketcherPrs_Radius::SketcherPrs_Radius(SketchPlugin_Constraint* theConstraint,
+SketcherPrs_Radius::SketcherPrs_Radius(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: AIS_RadiusDimension(MyDefCirc), myConstraint(theConstraint), myPlane(thePlane)
{
#define SketcherPrs_Radius_H
#include <GeomAPI_Ax3.h>
+#include <ModelAPI_Feature.h>
#include <AIS_RadiusDimension.hxx>
#include <Standard_DefineHandle.hxx>
-class SketchPlugin_Constraint;
-
DEFINE_STANDARD_HANDLE(SketcherPrs_Radius, AIS_RadiusDimension)
/**
/// Constructor
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
- Standard_EXPORT SketcherPrs_Radius(SketchPlugin_Constraint* theConstraint,
+ Standard_EXPORT SketcherPrs_Radius(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
DEFINE_STANDARD_RTTI(SketcherPrs_Radius)
private:
/// Constraint feature
- SketchPlugin_Constraint* myConstraint;
+ ModelAPI_Feature* myConstraint;
/// Plane of the current sketcher
std::shared_ptr<GeomAPI_Ax3> myPlane;
-SketcherPrs_Rigid::SketcherPrs_Rigid(SketchPlugin_Constraint* theConstraint,
+SketcherPrs_Rigid::SketcherPrs_Rigid(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: SketcherPrs_SymbolPrs(theConstraint, thePlane)
{
#include "SketcherPrs_SymbolPrs.h"
#include <ModelAPI_Object.h>
-
-class SketchPlugin_Constraint;
-class SketchPlugin_Sketch;
+#include <ModelAPI_Feature.h>
DEFINE_STANDARD_HANDLE(SketcherPrs_Rigid, SketcherPrs_SymbolPrs)
/// Constructor
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
- Standard_EXPORT SketcherPrs_Rigid(SketchPlugin_Constraint* theConstraint,
+ Standard_EXPORT SketcherPrs_Rigid(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
std::map<const char*, Handle(Image_AlienPixMap)> SketcherPrs_SymbolPrs::myIconsMap;
-SketcherPrs_SymbolPrs::SketcherPrs_SymbolPrs(SketchPlugin_Constraint* theConstraint,
+SketcherPrs_SymbolPrs::SketcherPrs_SymbolPrs(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: AIS_InteractiveObject(), myConstraint(theConstraint), myPlane(thePlane)
{
#define SketcherPrs_SymbolPrs_H
#include "SketcherPrs_SensitivePoint.h"
+#include <ModelAPI_Feature.h>
#include <AIS_InteractiveObject.hxx>
#include <GeomAPI_Ax3.h>
#include <OpenGl_Workspace.hxx>
-class SketchPlugin_Constraint;
class OpenGl_Context;
/// Constructor
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
- Standard_EXPORT SketcherPrs_SymbolPrs(SketchPlugin_Constraint* theConstraint,
+ Standard_EXPORT SketcherPrs_SymbolPrs(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
virtual ~SketcherPrs_SymbolPrs();
Standard_EXPORT std::shared_ptr<GeomAPI_Ax3> plane() const { return myPlane; }
- Standard_EXPORT SketchPlugin_Constraint* feature() const { return myConstraint; }
+ Standard_EXPORT ModelAPI_Feature* feature() const { return myConstraint; }
Handle(Graphic3d_ArrayOfPoints) pointsArray() const { return myPntArray; }
protected:
/// Constraint feature
- SketchPlugin_Constraint* myConstraint;
+ ModelAPI_Feature* myConstraint;
/// Plane of the current sketcher
std::shared_ptr<GeomAPI_Ax3> myPlane;
static Handle(Image_AlienPixMap) MyPixMap;
-SketcherPrs_Tangent::SketcherPrs_Tangent(SketchPlugin_Constraint* theConstraint,
+SketcherPrs_Tangent::SketcherPrs_Tangent(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
: SketcherPrs_SymbolPrs(theConstraint, thePlane)
{
#define SketcherPrs_Tangent_H
#include "SketcherPrs_SymbolPrs.h"
-
-class SketchPlugin_Constraint;
-class SketchPlugin_Sketch;
+#include <ModelAPI_Feature.h>
DEFINE_STANDARD_HANDLE(SketcherPrs_Tangent, SketcherPrs_SymbolPrs)
/// Constructor
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
- Standard_EXPORT SketcherPrs_Tangent(SketchPlugin_Constraint* theConstraint,
+ Standard_EXPORT SketcherPrs_Tangent(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
DEFINE_STANDARD_RTTI(SketcherPrs_Tangent)
namespace SketcherPrs_Tools {
-ObjectPtr getResult(SketchPlugin_Constraint* theFeature, const std::string& theAttrName)
+ObjectPtr getResult(ModelAPI_Feature* theFeature, const std::string& theAttrName)
{
std::shared_ptr<ModelAPI_Data> aData = theFeature->data();
std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr =
}
-std::shared_ptr<GeomAPI_Pnt2d> getPoint(SketchPlugin_Constraint* theFeature,
- const std::string& theAttribute)
+std::shared_ptr<GeomAPI_Pnt2d> getPoint(ModelAPI_Feature* theFeature,
+ const std::string& theAttribute)
{
std::shared_ptr<GeomDataAPI_Point2D> aPointAttr;
}
//*************************************************************************************
-//std::shared_ptr<SketchPlugin_Line> getFeatureLine(DataPtr theData,
-// const std::string& theAttribute)
-//{
-// std::shared_ptr<SketchPlugin_Line> aLine;
-// if (!theData)
-// return aLine;
-//
-// std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = std::dynamic_pointer_cast<
-// ModelAPI_AttributeRefAttr>(theData->attribute(theAttribute));
-// if (anAttr) {
-// FeaturePtr aFeature = ModelAPI_Feature::feature(anAttr->object());
-// if (aFeature && aFeature->getKind() == SketchPlugin_Line::ID()) {
-// aLine = std::dynamic_pointer_cast<SketchPlugin_Line>(aFeature);
-// }
-// }
-// return aLine;
-//}
+FeaturePtr getFeatureLine(DataPtr theData,
+ const std::string& theAttribute)
+{
+ FeaturePtr aLine;
+ if (!theData)
+ return aLine;
+
+ std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theData->attribute(theAttribute));
+ if (anAttr) {
+ FeaturePtr aFeature = ModelAPI_Feature::feature(anAttr->object());
+ if (aFeature && aFeature->getKind() == SketchPlugin_Line::ID()) {
+ return aFeature;
+ }
+ }
+ return aLine;
+}
//*************************************************************************************
-//std::shared_ptr<GeomAPI_Pnt2d> getProjectionPoint(
-// const std::shared_ptr<SketchPlugin_Line>& theLine,
-// const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
-//{
-// std::shared_ptr<ModelAPI_Data> aData = theLine->data();
-// std::shared_ptr<GeomDataAPI_Point2D> aPoint1 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-// aData->attribute(SketchPlugin_Line::START_ID()));
-// std::shared_ptr<GeomDataAPI_Point2D> aPoint2 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-// aData->attribute(SketchPlugin_Line::END_ID()));
-//
-// GeomAPI_Lin2d aLin2d(aPoint1->x(), aPoint1->y(), aPoint2->x(), aPoint2->y());
-// return aLin2d.project(thePoint);
-//}
+std::shared_ptr<GeomAPI_Pnt2d> getProjectionPoint(const FeaturePtr theLine,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
+{
+ DataPtr aData = theLine->data();
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint1 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ aData->attribute(SketchPlugin_Line::START_ID()));
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint2 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ aData->attribute(SketchPlugin_Line::END_ID()));
+
+ GeomAPI_Lin2d aLin2d(aPoint1->x(), aPoint1->y(), aPoint2->x(), aPoint2->y());
+ return aLin2d.project(thePoint);
+}
static double MyArrowSize = 30.;
#include <GeomAPI_Shape.h>
#include <GeomAPI_Pnt2d.h>
#include <ModelAPI_Object.h>
+#include <ModelAPI_Feature.h>
#include <string>
-class SketchPlugin_Constraint;
-class SketchPlugin_Line;
class GeomDataAPI_Point2D;
#define MyTextHeight 20
namespace SketcherPrs_Tools {
- SKETCHERPRS_EXPORT ObjectPtr getResult(SketchPlugin_Constraint* theFeature,
+ SKETCHERPRS_EXPORT ObjectPtr getResult(ModelAPI_Feature* theFeature,
const std::string& theAttrName);
SKETCHERPRS_EXPORT std::shared_ptr<GeomAPI_Shape> getShape(ObjectPtr theObject);
- SKETCHERPRS_EXPORT std::shared_ptr<GeomAPI_Pnt2d> getPoint(SketchPlugin_Constraint* theFeature,
+ SKETCHERPRS_EXPORT std::shared_ptr<GeomAPI_Pnt2d> getPoint(ModelAPI_Feature* theFeature,
const std::string& theAttrName);
-// SKETCHERPRS_EXPORT std::shared_ptr<GeomAPI_Pnt2d> getProjectionPoint(
-// const std::shared_ptr<SketchPlugin_Line>& theLine,
-// const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
+ SKETCHERPRS_EXPORT std::shared_ptr<GeomAPI_Pnt2d> getProjectionPoint(
+ const FeaturePtr theLine,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
-// SKETCHERPRS_EXPORT std::shared_ptr<SketchPlugin_Line> getFeatureLine(DataPtr theData,
-// const std::string& theAttribute);
+ SKETCHERPRS_EXPORT FeaturePtr getFeatureLine(DataPtr theData,
+ const std::string& theAttribute);
/// Obtain the point object from specified constraint parameter
SKETCHERPRS_EXPORT std::shared_ptr<GeomDataAPI_Point2D> getFeaturePoint(DataPtr theData,