#include "SketcherPrs_SensitivePoint.h"
-#include <Bnd_Box2d.hxx>
-#include <CSLib_Class2d.hxx>
-#include <ElCLib.hxx>
-#include <TopLoc_Location.hxx>
+#include <Graphic3d_ArrayOfPoints.hxx>
+#include "SketcherPrs_SymbolPrs.h"
IMPLEMENT_STANDARD_HANDLE(SketcherPrs_SensitivePoint, Select3D_SensitiveEntity);
IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_SensitivePoint, Select3D_SensitiveEntity);
SketcherPrs_SensitivePoint::SketcherPrs_SensitivePoint(const Handle(SelectBasics_EntityOwner)& anOwner,
- const Handle(Graphic3d_ArrayOfPoints)& thePntArray,
- int theId)
-:Select3D_SensitiveEntity(anOwner), myId(theId), myPntArray(thePntArray)
+ int theId)
+:Select3D_SensitiveEntity(anOwner), myId(theId)
{
SetSensitivityFactor(12.);
}
{
Standard_Real aDepth = RealLast();
Standard_Real aDistToCOG = RealLast();
- gp_Pnt aPnt = myPntArray->Vertice(myId);
+ gp_Pnt aPnt = Point();
if (!theMgr.Overlaps (aPnt, aDepth))
{
thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG);
gp_Pnt SketcherPrs_SensitivePoint::Point() const
{
- return myPntArray->Vertice(myId);
+ const Handle(SelectMgr_EntityOwner)& anOwner =
+ Handle(SelectMgr_EntityOwner)::DownCast(OwnerId());
+ const Handle(SketcherPrs_SymbolPrs)& aSymbPrs =
+ Handle(SketcherPrs_SymbolPrs)::DownCast(anOwner->Selectable());
+ return aSymbPrs->pointsArray()->Vertice(myId);
}
Handle(Select3D_SensitiveEntity) SketcherPrs_SensitivePoint::GetConnected()
{
- Handle(SketcherPrs_SensitivePoint) aNewEntity = new SketcherPrs_SensitivePoint (myOwnerId, myPntArray, myId);
+ Handle(SketcherPrs_SensitivePoint) aNewEntity = new SketcherPrs_SensitivePoint (myOwnerId, myId);
return aNewEntity;
}
Select3D_BndBox3d SketcherPrs_SensitivePoint::BoundingBox()
{
- gp_Pnt aPnt = myPntArray->Vertice(myId);
+ gp_Pnt aPnt = Point();
return Select3D_BndBox3d (SelectMgr_Vec3 (aPnt.X(), aPnt.Y(), aPnt.Z()),
SelectMgr_Vec3 (aPnt.X(), aPnt.Y(), aPnt.Z()));
}
#define SketcherPrs_SensitivePoint_H
#include <Select3D_SensitiveEntity.hxx>
-#include <Graphic3d_ArrayOfPoints.hxx>
#include <Standard_DefineHandle.hxx>
public:
//! Constructs a sensitive point object defined by the
//! owner OwnerId and the point Point.
- Standard_EXPORT SketcherPrs_SensitivePoint(const Handle(SelectBasics_EntityOwner)& OwnerId,
- const Handle(Graphic3d_ArrayOfPoints)& thePntArray, int theId);
+ Standard_EXPORT SketcherPrs_SensitivePoint(const Handle(SelectBasics_EntityOwner)& OwnerId, int theId);
Standard_EXPORT virtual Standard_Integer NbSubElements() Standard_OVERRIDE;
private:
int myId;
- Handle(Graphic3d_ArrayOfPoints) myPntArray;
};
#include "SketcherPrs_PositionMgr.h"
#include <SketchPlugin_Constraint.h>
-#include <SketchPlugin_MultiRotation.h>
-#include <SketchPlugin_MultiTranslation.h>
-#include <ModelAPI_AttributeInteger.h>
#include <ModelAPI_AttributeRefList.h>
#include <Graphic3d_AspectLine3d.hxx>
bool isTranslation)
: SketcherPrs_SymbolPrs(theConstraint, thePlane), myIsTranslation(isTranslation)
{
- int aPointsNb = 0;
- if (theConstraint->getKind() == SketchPlugin_MultiTranslation::ID()) {
- aPointsNb = theConstraint->integer(SketchPlugin_MultiTranslation::NUMBER_OF_COPIES_ID())->value();
- } else if (theConstraint->getKind() == SketchPlugin_MultiRotation::ID()) {
- aPointsNb = theConstraint->integer(SketchPlugin_MultiRotation::NUMBER_OF_COPIES_ID())->value();
- }
- aPointsNb == 0 ? aPointsNb = 2 : aPointsNb++; // by default we have 2 points for symbols
- myPntArray = new Graphic3d_ArrayOfPoints(aPointsNb);
}
bool SketcherPrs_Transformation::updatePoints(double theStep) const
return false;
SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get();
+ myPntArray = new Graphic3d_ArrayOfPoints(aNbB);
int i;
ObjectPtr aObj;