if (!sketch())
return thePrevious;
- AISObjectPtr anAIS = SketcherPrs_Factory::collinearConstraint(this, sketch()->coordinatePlane(),
+ AISObjectPtr anAIS = SketcherPrs_Factory::collinearConstraint(this, sketch(), sketch()->coordinatePlane(),
thePrevious);
return anAIS;
}
if (!sketch())
return thePrevious;
- AISObjectPtr anAIS = SketcherPrs_Factory::equalConstraint(this, sketch()->coordinatePlane(),
+ AISObjectPtr anAIS = SketcherPrs_Factory::equalConstraint(this, sketch(),
+ sketch()->coordinatePlane(),
thePrevious);
return anAIS;
}
if (!sketch())
return thePrevious;
- AISObjectPtr anAIS = SketcherPrs_Factory::horisontalConstraint(this, sketch()->coordinatePlane(),
+ AISObjectPtr anAIS = SketcherPrs_Factory::horisontalConstraint(this, sketch(),
+ sketch()->coordinatePlane(),
thePrevious);
return anAIS;
}
if (!sketch())
return thePrevious;
- AISObjectPtr anAIS = SketcherPrs_Factory::middleConstraint(this, sketch()->coordinatePlane(),
+ AISObjectPtr anAIS = SketcherPrs_Factory::middleConstraint(this, sketch(),
+ sketch()->coordinatePlane(),
thePrevious);
return anAIS;
}
if (!sketch())
return thePrevious;
- AISObjectPtr anAIS = SketcherPrs_Factory::mirrorConstraint(this, sketch()->coordinatePlane(),
+ AISObjectPtr anAIS = SketcherPrs_Factory::mirrorConstraint(this, sketch(),
+ sketch()->coordinatePlane(),
thePrevious);
return anAIS;
}
if (!sketch())
return thePrevious;
- AISObjectPtr anAIS = SketcherPrs_Factory::parallelConstraint(this, sketch()->coordinatePlane(),
+ AISObjectPtr anAIS = SketcherPrs_Factory::parallelConstraint(this, sketch(),
+ sketch()->coordinatePlane(),
thePrevious);
return anAIS;
}
if (!sketch())
return thePrevious;
- AISObjectPtr anAIS = SketcherPrs_Factory::perpendicularConstraint(this,
+ AISObjectPtr anAIS = SketcherPrs_Factory::perpendicularConstraint(this, sketch(),
sketch()->coordinatePlane(), thePrevious);
return anAIS;
}
{
if (!sketch())
return thePrevious;
- return SketcherPrs_Factory::rigidConstraint(this, sketch()->coordinatePlane(), thePrevious);
+ return SketcherPrs_Factory::rigidConstraint(this, sketch(),
+ sketch()->coordinatePlane(), thePrevious);
}
\ No newline at end of file
if (!sketch())
return thePrevious;
- AISObjectPtr anAIS = SketcherPrs_Factory::tangentConstraint(this, sketch()->coordinatePlane(),
+ AISObjectPtr anAIS = SketcherPrs_Factory::tangentConstraint(this, sketch(),
+ sketch()->coordinatePlane(),
thePrevious);
return anAIS;
}
if (!sketch())
return thePrevious;
- AISObjectPtr anAIS = SketcherPrs_Factory::verticalConstraint(this, sketch()->coordinatePlane(),
+ AISObjectPtr anAIS = SketcherPrs_Factory::verticalConstraint(this, sketch(),
+ sketch()->coordinatePlane(),
thePrevious);
return anAIS;
}
if (!sketch())
return thePrevious;
- AISObjectPtr anAIS = SketcherPrs_Factory::rotateConstraint(this, sketch()->coordinatePlane(),
+ AISObjectPtr anAIS = SketcherPrs_Factory::rotateConstraint(this, sketch(),
+ sketch()->coordinatePlane(),
thePrevious);
return anAIS;
}
if (!sketch())
return thePrevious;
- AISObjectPtr anAIS = SketcherPrs_Factory::translateConstraint(this, sketch()->coordinatePlane(),
+ AISObjectPtr anAIS = SketcherPrs_Factory::translateConstraint(this, sketch(),
+ sketch()->coordinatePlane(),
thePrevious);
return anAIS;
}
static Handle(Image_AlienPixMap) MyPixMap;
SketcherPrs_Collinear::SketcherPrs_Collinear(ModelAPI_Feature* theConstraint,
+ ModelAPI_CompositeFeature* theSketcher,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
- : SketcherPrs_SymbolPrs(theConstraint, thePlane)
+ : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane)
{
}
public:
/// Constructor
/// \param theConstraint a constraint feature
+ /// \param theSketcher a sketcher object
/// \param thePlane a coordinate plane of current sketch
Standard_EXPORT SketcherPrs_Collinear(ModelAPI_Feature* theConstraint,
+ ModelAPI_CompositeFeature* theSketcher,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
DEFINE_STANDARD_RTTIEXT(SketcherPrs_Collinear, SketcherPrs_SymbolPrs)
static Handle(Image_AlienPixMap) MyPixMap;
SketcherPrs_Equal::SketcherPrs_Equal(ModelAPI_Feature* theConstraint,
+ ModelAPI_CompositeFeature* theSketcher,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
- : SketcherPrs_SymbolPrs(theConstraint, thePlane)
+ : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane)
{
}
public:
/// Constructor
/// \param theConstraint a constraint feature
+ /// \param theSketcher a sketcher object
/// \param thePlane a coordinate plane of current sketch
Standard_EXPORT SketcherPrs_Equal(ModelAPI_Feature* theConstraint,
- const std::shared_ptr<GeomAPI_Ax3>& thePlane);
+ ModelAPI_CompositeFeature* theSketcher,
+ const std::shared_ptr<GeomAPI_Ax3>& thePlane);
DEFINE_STANDARD_RTTIEXT(SketcherPrs_Equal, SketcherPrs_SymbolPrs)
/// Returns true if the constraint feature arguments are correcly filled to build AIS presentation
// Macros for constraint presentation definition
#define CONSTRAINT_PRS_IMPL(NAME, CLASS) \
AISObjectPtr SketcherPrs_Factory::NAME(ModelAPI_Feature* theConstraint, \
+ ModelAPI_CompositeFeature* theSketcher, \
const std::shared_ptr<GeomAPI_Ax3>& thePlane, \
AISObjectPtr thePrevious) \
{ \
anAISObj = thePrevious; \
else { \
anAISObj = AISObjectPtr(new GeomAPI_AISObject()); \
- Handle(CLASS) aPrs = new CLASS(theConstraint, thePlane); \
+ Handle(CLASS) aPrs = new CLASS(theConstraint, theSketcher, thePlane); \
anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); \
} \
} \
return anAISObj; \
}
-CONSTRAINT_PRS_IMPL(coincidentConstraint, SketcherPrs_Coincident);
+
CONSTRAINT_PRS_IMPL(collinearConstraint, SketcherPrs_Collinear);
CONSTRAINT_PRS_IMPL(parallelConstraint, SketcherPrs_Parallel);
CONSTRAINT_PRS_IMPL(perpendicularConstraint, SketcherPrs_Perpendicular);
CONSTRAINT_PRS_IMPL(rigidConstraint, SketcherPrs_Rigid);
CONSTRAINT_PRS_IMPL(equalConstraint, SketcherPrs_Equal);
CONSTRAINT_PRS_IMPL(tangentConstraint, SketcherPrs_Tangent);
-CONSTRAINT_PRS_IMPL(radiusConstraint, SketcherPrs_Radius);
-CONSTRAINT_PRS_IMPL(lengthDimensionConstraint, SketcherPrs_LengthDimension);
CONSTRAINT_PRS_IMPL(middleConstraint, SketcherPrs_Middle);
CONSTRAINT_PRS_IMPL(mirrorConstraint, SketcherPrs_Mirror);
-CONSTRAINT_PRS_IMPL(angleConstraint, SketcherPrs_Angle);
+
+
+
+#define CONSTRAINT2_PRS_IMPL(NAME, CLASS) \
+AISObjectPtr SketcherPrs_Factory::NAME(ModelAPI_Feature* theConstraint, \
+ const std::shared_ptr<GeomAPI_Ax3>& thePlane, \
+ AISObjectPtr thePrevious) \
+{ \
+ std::shared_ptr<GeomAPI_AISObject> anAISObj; \
+ if (CLASS::IsReadyToDisplay(theConstraint, thePlane)) { \
+ if (thePrevious.get()) \
+ anAISObj = thePrevious; \
+ else { \
+ anAISObj = AISObjectPtr(new GeomAPI_AISObject()); \
+ Handle(CLASS) aPrs = new CLASS(theConstraint, thePlane); \
+ anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs)); \
+ } \
+ } \
+ return anAISObj; \
+}
+
+
+CONSTRAINT2_PRS_IMPL(coincidentConstraint, SketcherPrs_Coincident);
+CONSTRAINT2_PRS_IMPL(angleConstraint, SketcherPrs_Angle);
+CONSTRAINT2_PRS_IMPL(radiusConstraint, SketcherPrs_Radius);
+CONSTRAINT2_PRS_IMPL(lengthDimensionConstraint, SketcherPrs_LengthDimension);
// Non-standard constraints definition
AISObjectPtr SketcherPrs_Factory::horisontalConstraint(ModelAPI_Feature* theConstraint,
+ ModelAPI_CompositeFeature* theSketcher,
const std::shared_ptr<GeomAPI_Ax3>& thePlane,
AISObjectPtr thePrevious)
{
else {
anAISObj = AISObjectPtr(new GeomAPI_AISObject());
Handle(SketcherPrs_HVDirection) aPrs =
- new SketcherPrs_HVDirection(theConstraint, thePlane, true);
+ new SketcherPrs_HVDirection(theConstraint, theSketcher, thePlane, true);
anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs));
}
}
}
AISObjectPtr SketcherPrs_Factory::verticalConstraint(ModelAPI_Feature* theConstraint,
+ ModelAPI_CompositeFeature* theSketcher,
const std::shared_ptr<GeomAPI_Ax3>& thePlane,
AISObjectPtr thePrevious)
{
else {
anAISObj = AISObjectPtr(new GeomAPI_AISObject());
Handle(SketcherPrs_HVDirection) aPrs =
- new SketcherPrs_HVDirection(theConstraint, thePlane, false);
+ new SketcherPrs_HVDirection(theConstraint, theSketcher, thePlane, false);
anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs));
}
}
}
AISObjectPtr SketcherPrs_Factory::translateConstraint(ModelAPI_Feature* theConstraint,
+ ModelAPI_CompositeFeature* theSketcher,
const std::shared_ptr<GeomAPI_Ax3>& thePlane,
AISObjectPtr thePrevious)
{
else {
anAISObj = AISObjectPtr(new GeomAPI_AISObject());
Handle(SketcherPrs_Transformation) aPrs =
- new SketcherPrs_Transformation(theConstraint, thePlane, true);
+ new SketcherPrs_Transformation(theConstraint, theSketcher, thePlane, true);
anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs));
}
}
}
AISObjectPtr SketcherPrs_Factory::rotateConstraint(ModelAPI_Feature* theConstraint,
+ ModelAPI_CompositeFeature* theSketcher,
const std::shared_ptr<GeomAPI_Ax3>& thePlane,
AISObjectPtr thePrevious)
{
else {
anAISObj = AISObjectPtr(new GeomAPI_AISObject());
Handle(SketcherPrs_Transformation) aPrs =
- new SketcherPrs_Transformation(theConstraint, thePlane, false);
+ new SketcherPrs_Transformation(theConstraint, theSketcher, thePlane, false);
anAISObj->setImpl(new Handle(AIS_InteractiveObject)(aPrs));
}
}
#include "SketcherPrs.h"
#include <ModelAPI_Feature.h>
+#include <ModelAPI_CompositeFeature.h>
#include <GeomAPI_Ax3.h>
#include <GeomAPI_AISObject.h>
#define GET_CONSTRAINT_PRS(NAME) \
static AISObjectPtr NAME(ModelAPI_Feature* theConstraint, \
+ ModelAPI_CompositeFeature* theSketcher, \
const std::shared_ptr<GeomAPI_Ax3>& thePlane, \
AISObjectPtr thePrevious);
class SKETCHERPRS_EXPORT SketcherPrs_Factory
{
public:
- /// Creates coincedent constraint presentation
- /// \param theConstraint the constraint
- /// \param thePlane the current sketch plane
- /// \param thePrevious the previous presentation
- GET_CONSTRAINT_PRS(coincidentConstraint)
-
/// Creates collinear constraint presentation
/// \param theConstraint the constraint
/// \param thePlane the current sketch plane
/// \param thePrevious the previous presentation
GET_CONSTRAINT_PRS(tangentConstraint)
- /// Creates radius dimension presentation
- /// \param theConstraint the constraint
- /// \param thePlane the current sketch plane
- /// \param thePrevious the previous presentation
- GET_CONSTRAINT_PRS(radiusConstraint)
-
- /// Creates length dimension presentation
- /// \param theConstraint the constraint
- /// \param thePlane the current sketch plane
- /// \param thePrevious the previous presentation
- GET_CONSTRAINT_PRS(lengthDimensionConstraint)
-
/// Creates middle constraint presentation
/// \param theConstraint the constraint
/// \param thePlane the current sketch plane
/// \param thePrevious the previous presentation
GET_CONSTRAINT_PRS(rotateConstraint)
+#define GET_CONSTRAINT2_PRS(NAME) \
+ static AISObjectPtr NAME(ModelAPI_Feature* theConstraint, \
+ const std::shared_ptr<GeomAPI_Ax3>& thePlane, \
+ AISObjectPtr thePrevious);
+
+ /// Creates coincedent constraint presentation
+ /// \param theConstraint the constraint
+ /// \param thePlane the current sketch plane
+ /// \param thePrevious the previous presentation
+ GET_CONSTRAINT2_PRS(coincidentConstraint)
+
/// Creates angle constraint presentation
/// \param theConstraint the constraint
/// \param thePlane the current sketch plane
/// \param thePrevious the previous presentation
- GET_CONSTRAINT_PRS(angleConstraint)
+ GET_CONSTRAINT2_PRS(angleConstraint)
+
+ /// Creates length dimension presentation
+ /// \param theConstraint the constraint
+ /// \param thePlane the current sketch plane
+ /// \param thePrevious the previous presentation
+ GET_CONSTRAINT2_PRS(lengthDimensionConstraint)
+
+ /// Creates radius dimension presentation
+ /// \param theConstraint the constraint
+ /// \param thePlane the current sketch plane
+ /// \param thePrevious the previous presentation
+ GET_CONSTRAINT2_PRS(radiusConstraint)
};
#endif
static Handle(Image_AlienPixMap) MyPixMap;
SketcherPrs_HVDirection::SketcherPrs_HVDirection(ModelAPI_Feature* theConstraint,
+ ModelAPI_CompositeFeature* theSketcher,
const std::shared_ptr<GeomAPI_Ax3>& thePlane,
bool isHorisontal)
- : SketcherPrs_SymbolPrs(theConstraint, thePlane), myIsHorisontal(isHorisontal)
+ : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane),
+ myIsHorisontal(isHorisontal)
{
}
public:
/// Constructor
/// \param theConstraint a constraint feature
+ /// \param theSketcher a sketcher object
/// \param thePlane a coordinate plane of current sketch
/// \param isHorisontal a flag horizontal or vertical presentation
Standard_EXPORT SketcherPrs_HVDirection(ModelAPI_Feature* theConstraint,
+ ModelAPI_CompositeFeature* theSketcher,
const std::shared_ptr<GeomAPI_Ax3>& thePlane,
bool isHorisontal);
static Handle(Image_AlienPixMap) MyPixMap;
SketcherPrs_Middle::SketcherPrs_Middle(ModelAPI_Feature* theConstraint,
+ ModelAPI_CompositeFeature* theSketcher,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
- : SketcherPrs_SymbolPrs(theConstraint, thePlane)
+ : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane)
{
}
public:
/// Constructor
/// \param theConstraint a constraint feature
+ /// \param theSketcher a sketcher object
/// \param thePlane a coordinate plane of current sketch
Standard_EXPORT SketcherPrs_Middle(ModelAPI_Feature* theConstraint,
- const std::shared_ptr<GeomAPI_Ax3>& thePlane);
+ ModelAPI_CompositeFeature* theSketcher,
+ const std::shared_ptr<GeomAPI_Ax3>& thePlane);
DEFINE_STANDARD_RTTIEXT(SketcherPrs_Middle, SketcherPrs_SymbolPrs)
/// Returns true if the constraint feature arguments are correcly filled to build AIS presentation
static Handle(Image_AlienPixMap) MyPixMap;
SketcherPrs_Mirror::SketcherPrs_Mirror(ModelAPI_Feature* theConstraint,
+ ModelAPI_CompositeFeature* theSketcher,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
- : SketcherPrs_SymbolPrs(theConstraint, thePlane)
+ : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane)
{
}
public:
/// Constructor
/// \param theConstraint a constraint feature
+ /// \param theSketcher a sketcher object
/// \param thePlane a coordinate plane of current sketch
Standard_EXPORT SketcherPrs_Mirror(ModelAPI_Feature* theConstraint,
+ ModelAPI_CompositeFeature* theSketcher,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
DEFINE_STANDARD_RTTIEXT(SketcherPrs_Mirror, SketcherPrs_SymbolPrs)
static Handle(Image_AlienPixMap) MyPixMap;
SketcherPrs_Parallel::SketcherPrs_Parallel(ModelAPI_Feature* theConstraint,
+ ModelAPI_CompositeFeature* theSketcher,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
- : SketcherPrs_SymbolPrs(theConstraint, thePlane)
+ : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane)
{
}
public:
/// Constructor
/// \param theConstraint a constraint feature
+ /// \param theSketcher a sketcher object
/// \param thePlane a coordinate plane of current sketch
Standard_EXPORT SketcherPrs_Parallel(ModelAPI_Feature* theConstraint,
+ ModelAPI_CompositeFeature* theSketcher,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
DEFINE_STANDARD_RTTIEXT(SketcherPrs_Parallel, SketcherPrs_SymbolPrs)
static Handle(Image_AlienPixMap) MyPixMap;
SketcherPrs_Perpendicular::SketcherPrs_Perpendicular(ModelAPI_Feature* theConstraint,
+ ModelAPI_CompositeFeature* theSketcher,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
- : SketcherPrs_SymbolPrs(theConstraint, thePlane)
+ : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane)
{
}
public:
/// Constructor
/// \param theConstraint a constraint feature
+ /// \param theSketcher a sketcher object
/// \param thePlane a coordinate plane of current sketch
Standard_EXPORT SketcherPrs_Perpendicular(ModelAPI_Feature* theConstraint,
+ ModelAPI_CompositeFeature* theSketcher,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
DEFINE_STANDARD_RTTIEXT(SketcherPrs_Perpendicular, SketcherPrs_SymbolPrs)
#include <GeomAPI_Vertex.h>
#include <GeomAPI_Dir.h>
#include <GeomAPI_Ax3.h>
+#include <GeomAPI_Circ.h>
+
+#include <GeomDataAPI_Point2D.h>
#include <SketchPlugin_Line.h>
#include <SketchPlugin_Circle.h>
#include <TopoDS_Vertex.hxx>
#include <Geom_Curve.hxx>
#include <TColGeom_SequenceOfCurve.hxx>
+#include <gp_Dir.hxx>
static SketcherPrs_PositionMgr* MyPosMgr = NULL;
//*****************************************************************
//! Returns curves connected to the given point
-TColGeom_SequenceOfCurve getCurves(const GeomPointPtr& thePnt, const SketcherPrs_SymbolPrs* thePrs)
+std::list<ObjectPtr> getCurves(const GeomPointPtr& thePnt, const SketcherPrs_SymbolPrs* thePrs)
{
- TColGeom_SequenceOfCurve aList;
- //GeomAx3Ptr aAx3 = thePrs->plane();
- //CompositeFeaturePtr aOwner = thePrs->sketcher();
- //GeomPnt2dPtr aPnt2d = thePnt->to2D(aAx3->origin(), aAx3->dirX(), aAx3->dirY());
+ std::list<ObjectPtr> aList;
+ GeomAx3Ptr aAx3 = thePrs->plane();
+ ModelAPI_CompositeFeature* aOwner = thePrs->sketcher();
+ GeomPnt2dPtr aPnt2d = thePnt->to2D(aAx3->origin(), aAx3->dirX(), aAx3->dirY());
+
+ int aNbSubs = aOwner->numberOfSubs();
+ for (int i = 0; i < aNbSubs; i++) {
+ FeaturePtr aFeature = aOwner->subFeature(i);
+ if (aFeature->getKind() == SketchPlugin_Line::ID()) {
+ AttributePoint2DPtr aSPnt1 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ aFeature->data()->attribute(SketchPlugin_Line::START_ID()));
+ AttributePoint2DPtr aSPnt2 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ aFeature->data()->attribute(SketchPlugin_Line::END_ID()));
- //int aNbSubs = aOwner->numberOfSubs();
- //for (int i = 0; i < aNbSubs; i++) {
- // FeaturePtr aFeature = aOwner->subFeature(i);
- // if (aFeature->getKind() == SketchPlugin_Line::ID()) {
- // GeomPnt2dPtr aPnt1 =
- // SketcherPrs_Tools::getPoint(aFeature.get(), SketchPlugin_Line::START_ID());
- // GeomPnt2dPtr aPnt2 =
- // SketcherPrs_Tools::getPoint(aFeature.get(), SketchPlugin_Line::END_ID());
- // if (aPnt1->isEqual(aPnt2d) || aPnt2->isEqual(aPnt2d)) {
- // GeomShapePtr aShp = SketcherPrs_Tools::getShape(aFeature->firstResult());
- // GeomCurvePtr aCurv = std::shared_ptr<GeomAPI_Curve>(new GeomAPI_Curve(aShp));
- // aList.Append(aCurv->impl<Handle(Geom_Curve)>());
- // }
- // } else if ((aFeature->getKind() == SketchPlugin_Circle::ID()) ||
- // (aFeature->getKind() == SketchPlugin_Arc::ID())) {
- // GeomShapePtr aShp = SketcherPrs_Tools::getShape(aFeature->firstResult());
- // GeomCurvePtr aCurv = std::shared_ptr<GeomAPI_Curve>(new GeomAPI_Curve(aShp));
- // }
- //}
+ GeomPnt2dPtr aPnt1 = aSPnt1->pnt();
+ GeomPnt2dPtr aPnt2 = aSPnt2->pnt();
+
+ if (aPnt1->isEqual(aPnt2d) || aPnt2->isEqual(aPnt2d)) {
+ GeomShapePtr aShp = SketcherPrs_Tools::getShape(aFeature->firstResult());
+ GeomCurvePtr aCurv = std::shared_ptr<GeomAPI_Curve>(new GeomAPI_Curve(aShp));
+ aList.push_back(aFeature->firstResult());
+ }
+ } else if ((aFeature->getKind() == SketchPlugin_Circle::ID()) ||
+ (aFeature->getKind() == SketchPlugin_Arc::ID())) {
+ GeomCurvePtr aCurve;
+ ObjectPtr aResObj;
+ std::list<ResultPtr> aResults = aFeature->results();
+ std::list<ResultPtr>::const_iterator aIt;
+ for (aIt = aResults.cbegin(); aIt != aResults.cend(); aIt++) {
+ GeomShapePtr aShp = SketcherPrs_Tools::getShape((*aIt));
+ if (aShp->isEdge()) {
+ aResObj = (*aIt);
+ aCurve = std::shared_ptr<GeomAPI_Curve>(new GeomAPI_Curve(aShp));
+ break;
+ }
+ }
+ if (aCurve.get()) {
+ double aStart = aCurve->startParam();
+ double aEnd = aCurve->endParam();
+ GeomCirclePtr aCircle = GeomCirclePtr(new GeomAPI_Circ(aCurve));
+ double aParam;
+ if (aCircle->parameter(thePnt, 1.e-4, aParam) && (aParam >= aStart) && (aParam <= aEnd))
+ aList.push_back(aResObj);
+ }
+ }
+ }
return aList;
}
ObjectPtr theLine, const SketcherPrs_SymbolPrs* thePrs,
double theStep, GeomPointPtr thePnt)
{
- TColGeom_SequenceOfCurve aCurves = getCurves(thePnt, thePrs);
+ std::list<ObjectPtr> aCurves = getCurves(thePnt, thePrs);
gp_Pnt aP = thePnt->impl<gp_Pnt>();
- gp_Vec aVec1 = getVector(theLine, thePrs->plane()->dirX(), aP);
+ //gp_Vec aVec1 = getVector(theLine, thePrs->plane()->dirX(), aP);
+ std::list<gp_Vec> aVectors;
+ std::list<ObjectPtr>::const_iterator aItCurv;
+ for (aItCurv = aCurves.cbegin(); aItCurv != aCurves.cend(); aItCurv++) {
+ ObjectPtr aObject = (*aItCurv);
+ gp_Vec aVec = getVector(aObject, thePrs->plane()->dirX(), aP);
+ aVectors.push_back(aVec);
+ }
+ gp_Vec aBase = getVector(theLine, thePrs->plane()->dirX(), aP);
+ std::list<double> aAngles;
+ std::list<gp_Vec>::const_iterator aItVec;
+ for (aItVec = aVectors.cbegin(); aItVec != aVectors.cend(); aItVec++) {
+ gp_Vec aVec = (*aItVec);
+ double aAngle = aBase.Angle(aVec);
+ aAngles.push_back(aAngle);
+ }
// Compute shifting vector for a one symbol
- gp_Vec aShift = aVec1.Crossed(thePrs->plane()->normal()->impl<gp_Dir>());
- aShift.Normalize();
- aShift.Multiply(theStep * 1.5);
- aP.Translate(aShift);
+ //gp_Vec aShift = aVec1.Crossed(thePrs->plane()->normal()->impl<gp_Dir>());
+ //aShift.Normalize();
+ //aShift.Multiply(theStep * 1.5);
+ //aP.Translate(aShift);
return aP;
}
SketcherPrs_Rigid::SketcherPrs_Rigid(ModelAPI_Feature* theConstraint,
+ ModelAPI_CompositeFeature* theSketcher,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
- : SketcherPrs_SymbolPrs(theConstraint, thePlane)
+ : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane)
{
}
public:
/// Constructor
/// \param theConstraint a constraint feature
+ /// \param theSketcher a sketcher object
/// \param thePlane a coordinate plane of current sketch
Standard_EXPORT SketcherPrs_Rigid(ModelAPI_Feature* theConstraint,
+ ModelAPI_CompositeFeature* theSketcher,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
SketcherPrs_SymbolPrs::SketcherPrs_SymbolPrs(ModelAPI_Feature* theConstraint,
+ ModelAPI_CompositeFeature* theSketcher,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
- : AIS_InteractiveObject(), myConstraint(theConstraint), myPlane(thePlane), myIsCustomColor(false)
+ : AIS_InteractiveObject(), myConstraint(theConstraint),
+ myPlane(thePlane), myIsCustomColor(false),
+ mySketcher(theSketcher)
{
SetAutoHilight(Standard_False);
}
theBndBox.Update (aTmpBox.CornerMin().x(), aTmpBox.CornerMin().y(), aTmpBox.CornerMin().z(),
aTmpBox.CornerMax().x(), aTmpBox.CornerMax().y(), aTmpBox.CornerMax().z());
}
-
-//*********************************************************************************
-CompositeFeaturePtr SketcherPrs_SymbolPrs::sketcher() const
-{
- return ModelAPI_Tools::compositeOwner(FeaturePtr(myConstraint));
-}
\ No newline at end of file
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
Standard_EXPORT SketcherPrs_SymbolPrs(ModelAPI_Feature* theConstraint,
+ ModelAPI_CompositeFeature* theSketcher,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
virtual ~SketcherPrs_SymbolPrs();
Standard_EXPORT ModelAPI_Feature* feature() const { return myConstraint; }
/// Returns Sketcher object (owner of the constraint)
- Standard_EXPORT CompositeFeaturePtr sketcher() const;
+ Standard_EXPORT ModelAPI_CompositeFeature* sketcher() const { return mySketcher; }
/// Return array of points where symbols will be placed
const Handle(Graphic3d_ArrayOfPoints)& pointsArray() const { return myPntArray; }
/// Constraint feature
ModelAPI_Feature* myConstraint;
+ /// Sketcher feature
+ ModelAPI_CompositeFeature* mySketcher;
+
/// Plane of the current sketcher
std::shared_ptr<GeomAPI_Ax3> myPlane;
static Handle(Image_AlienPixMap) MyPixMap;
SketcherPrs_Tangent::SketcherPrs_Tangent(ModelAPI_Feature* theConstraint,
+ ModelAPI_CompositeFeature* theSketcher,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
- : SketcherPrs_SymbolPrs(theConstraint, thePlane)
+ : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane)
{
}
public:
/// Constructor
/// \param theConstraint a constraint feature
+ /// \param theSketcher a sketcher object
/// \param thePlane a coordinate plane of current sketch
Standard_EXPORT SketcherPrs_Tangent(ModelAPI_Feature* theConstraint,
+ ModelAPI_CompositeFeature* theSketcher,
const std::shared_ptr<GeomAPI_Ax3>& thePlane);
DEFINE_STANDARD_RTTIEXT(SketcherPrs_Tangent, SketcherPrs_SymbolPrs)
static Handle(Image_AlienPixMap) MyPixMap;
SketcherPrs_Transformation::SketcherPrs_Transformation(ModelAPI_Feature* theConstraint,
+ ModelAPI_CompositeFeature* theSketcher,
const std::shared_ptr<GeomAPI_Ax3>& thePlane,
bool isTranslation)
- : SketcherPrs_SymbolPrs(theConstraint, thePlane), myIsTranslation(isTranslation)
+ : SketcherPrs_SymbolPrs(theConstraint, theSketcher, thePlane), myIsTranslation(isTranslation)
{
}
public:
/// Constructor
/// \param theConstraint a constraint feature
+ /// \param theSketcher a sketcher object
/// \param thePlane a coordinate plane of current sketch
/// \param isTranslation a flag is it translation or rotation
Standard_EXPORT SketcherPrs_Transformation(ModelAPI_Feature* theConstraint,
+ ModelAPI_CompositeFeature* theSketcher,
const std::shared_ptr<GeomAPI_Ax3>& thePlane,
bool isTranslation);