#include <GeomAPI_Curve.h>
#include <GeomAPI_Vertex.h>
#include <GeomAPI_Dir.h>
+#include <GeomAPI_Ax3.h>
+
+#include <SketchPlugin_Line.h>
+#include <SketchPlugin_Circle.h>
+#include <SketchPlugin_Arc.h>
#include <BRepExtrema_ExtPC.hxx>
#include <TopoDS_Vertex.hxx>
#include <Geom_Curve.hxx>
+#include <TColGeom_SequenceOfCurve.hxx>
static SketcherPrs_PositionMgr* MyPosMgr = NULL;
return aP;
}
+
+//*****************************************************************
+//! Returns curves connected to the given point
+TColGeom_SequenceOfCurve 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());
+
+ //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));
+ // }
+ //}
+ return aList;
+}
+
+//*****************************************************************
gp_Pnt SketcherPrs_PositionMgr::getPointPosition(
ObjectPtr theLine, const SketcherPrs_SymbolPrs* thePrs,
double theStep, GeomPointPtr thePnt)
{
+ TColGeom_SequenceOfCurve aCurves = getCurves(thePnt, thePrs);
+
gp_Pnt aP = thePnt->impl<gp_Pnt>();
gp_Vec aVec1 = getVector(theLine, thePrs->plane()->dirX(), aP);
return aP;
}
-
+//*****************************************************************
void SketcherPrs_PositionMgr::deleteConstraint(const SketcherPrs_SymbolPrs* thePrs)
{
std::map<ObjectPtr, PositionsMap>::iterator aIt;
#include <GeomAPI_Vertex.h>
#include <GeomAPI_Curve.h>
+#include <ModelAPI_Tools.h>
+
#include <Events_InfoMessage.h>
#include <Graphic3d_ArrayOfSegments.hxx>
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
#include "SketcherPrs_SensitivePoint.h"
#include <ModelAPI_Feature.h>
#include <ModelAPI_AttributeRefList.h>
+#include <ModelAPI_CompositeFeature.h>
#include <AIS_InteractiveObject.hxx>
#include <GeomAPI_Ax3.h>
/// Returns feature object
Standard_EXPORT ModelAPI_Feature* feature() const { return myConstraint; }
+ /// Returns Sketcher object (owner of the constraint)
+ Standard_EXPORT CompositeFeaturePtr sketcher() const;
+
/// Return array of points where symbols will be placed
const Handle(Graphic3d_ArrayOfPoints)& pointsArray() const { return myPntArray; }
GeomCurvePtr aLine;
GeomCirclePtr aCircle;
+ double aFirst, aLast;
if (aCurv1->isLine()) {
aLine = aCurv1;
aCircle = GeomCirclePtr(new GeomAPI_Circ(aCurv2));
+ aFirst = aCurv2->startParam();
+ aLast = aCurv2->endParam();
} else {
aLine = aCurv2;
aCircle = GeomCirclePtr(new GeomAPI_Circ(aCurv1));
+ aFirst = aCurv1->startParam();
+ aLast = aCurv1->endParam();
}
GeomPointPtr aPnt1 = aLine->getPoint(aLine->startParam());
GeomPointPtr aPnt2 = aLine->getPoint(aLine->endParam());
double aParam;
GeomPointPtr aPnt;
- if (aCircle->parameter(aPnt1, 1.e-4, aParam))
+ if (aCircle->parameter(aPnt1, 1.e-4, aParam) && (aParam >= aFirst) && (aParam <= aLast))
aPnt = aPnt1;
else
aPnt = aPnt2;