Version: 9.12.0
CurveCreator_Utils Class Reference

#include <CurveCreator_Utils.hxx>

Static Public Member Functions

static void ConvertPointToClick (const gp_Pnt &thePoint, Handle(V3d_View) theView, int &x, int &y)
 Returns the point clicked in 3D view. More...
 
static Quantity_Color getRandColor ()
 Generates a random color. More...
 
static Quantity_Color colorConv (QColor color)
 Convert QColor to Quantity_Color. More...
 
static QColor colorConv (Quantity_Color color)
 Convert Quantity_Color to QColor. More...
 
static gp_Pnt ConvertClickToPoint (int x, int y, Handle(V3d_View) theView)
 Returns the point clicked in 3D view. More...
 
static void constructShape (const CurveCreator_ICurve *theCurve, TopoDS_Shape &theShape, NCollection_IndexedDataMap< int, TopoDS_Shape > *Sect2Shape=NULL)
 Generates shape on the curve. More...
 
static bool constructCurve (const TopoDS_Shape theShape, CurveCreator_Curve *theCurve, gp_Ax3 &theLocalCS)
 Generates a curve from a shape. More...
 
static void getSelectedPoints (Handle(AIS_InteractiveContext) theContext, const CurveCreator_ICurve *theCurve, CurveCreator_ICurve::SectionToPointList &thePoints)
 Find selected points in the context. More...
 
static void setSelectedPoints (Handle(AIS_InteractiveContext) theContext, const CurveCreator_ICurve *theCurve, const CurveCreator_ICurve::SectionToPointList &thePoints=CurveCreator_ICurve::SectionToPointList())
 Set selected points to the context. More...
 
static void setLocalPointContext (const CurveCreator_ICurve *theCurve, Handle(AIS_InteractiveContext) theContext, const bool theOpen)
 Sets the local point context for the 3D viewer. More...
 
static bool pointOnObject (Handle(V3d_View) theView, Handle(AIS_InteractiveObject) theObject, const int theX, const int theY, gp_Pnt &thePoint, gp_Pnt &thePoint1, gp_Pnt &thePoint2)
 Checks whether the point belongs to the OCC object. More...
 
static bool constructBSpline (const Handle(TColgp_HArray1OfPnt)&thePoints, const Standard_Boolean theIsClosed, Handle(Geom_BSplineCurve)&theBSpline)
 The algorithm builds the cubic B-spline passing through the points that the tangent vector in each given point P is calculated by the following way: if point P is preceded by a point A and is followed by a point B then the tangent vector is equal to (P - A) / |P - A| + (B - P) / |B - P|; if point P is preceded by a point A but is not followed by any point then the tangent vector is equal to P - A; if point P is followed by a point B but is not preceded by any point then the tangent vector is equal to B - P. More...
 
static TopoDS_Wire ConstructWire (Handle(TColgp_HArray1OfPnt) thePoints, const bool theIsPolyline, const bool theIsClosed)
 Constructs the wire corresponding to the section. More...
 

Static Protected Member Functions

static bool hasProjectPointOnCurve (Handle(V3d_View) theView, const int theX, const int theY, const Handle(Geom_Curve)&theCurve, Standard_Real &theParameter, int &theDelta)
 
static bool isEqualPixels (const int theX, const int theY, const int theOtherX, const int theOtherY, const double theTolerance, int &theDelta)
 
static bool isEqualPoints (const gp_Pnt &thePoint, const gp_Pnt &theOtherPoint)
 
static Handle (TColgp_HArray1OfPnt) getPoints(const TopoDS_Shape &theShape
 Returns the array of points of a shape to construct a curve section. More...
 
static void FindPlane (const Handle(TColgp_HArray1OfPnt) &thePoints, gp_Pln &thePlane, Standard_Integer &thePlnStatus)
 This method computes a plane using the input points. More...
 

Protected Attributes

static bool & IsClosed
 
static bool bool & IsBSpline
 

Member Function Documentation

◆ colorConv() [1/2]

Quantity_Color CurveCreator_Utils::colorConv ( QColor  color)
static

◆ colorConv() [2/2]

QColor CurveCreator_Utils::colorConv ( Quantity_Color  color)
static

◆ constructBSpline()

bool CurveCreator_Utils::constructBSpline ( const Handle(TColgp_HArray1OfPnt)&  thePoints,
const Standard_Boolean  theIsClosed,
Handle(Geom_BSplineCurve)&  theBSpline 
)
static

References aResult, and Handle().

◆ constructCurve()

bool CurveCreator_Utils::constructCurve ( const TopoDS_Shape  theShape,
CurveCreator_Curve theCurve,
gp_Ax3 &  theLocalCS 
)
static
Parameters
theShapea shape to be converted to curve.
theCurvea curve object to be initialized.
theLocalCSthe local coordinate system of the curve.
Returns
true in case of success; false otherwise. Warning: the curve can be modified even if the shape is not valid for curve construction.

References CurveCreator_Curve::addSectionInternal(), FindPlane(), CurveCreator_UtilsICurve::getUniqSectionName(), Section3D::myIsBSpline, Section3D::myIsClosed, PLN_FIXED, PLN_FREE, PLN_ORIGIN, PLN_OX, CurveCreator::Polyline, and CurveCreator::Spline.

◆ constructShape()

void CurveCreator_Utils::constructShape ( const CurveCreator_ICurve theCurve,
TopoDS_Shape &  theShape,
NCollection_IndexedDataMap< int, TopoDS_Shape > *  Sect2Shape = NULL 
)
static
Parameters
theCurvea curve object, that contains data
theShapea generated shape
Sect2Shapeoptional out map: section to constructed shape (wire+vertices)

References ConstructWire(), CurveCreator_ICurve::getNbPoints(), CurveCreator_ICurve::getNbSections(), CurveCreator_ICurve::getSectionType(), Handle(), CurveCreator_ICurve::isClosed(), and CurveCreator::Polyline.

◆ ConstructWire()

TopoDS_Wire CurveCreator_Utils::ConstructWire ( Handle(TColgp_HArray1OfPnt)  thePoints,
const bool  theIsPolyline,
const bool  theIsClosed 
)
static

References constructBSpline(), and Handle().

◆ ConvertClickToPoint()

gp_Pnt CurveCreator_Utils::ConvertClickToPoint ( int  x,
int  y,
Handle(V3d_View)  theView 
)
static
Parameters
xThe X coordinate in the view.
yThe Y coordinate in the view.
theViewView where the given point takes place.
Return values
gp_PntReturns the point clicked in 3D view

References LOCAL_SELECTION_TOLERANCE.

◆ ConvertPointToClick()

void CurveCreator_Utils::ConvertPointToClick ( const gp_Pnt &  thePoint,
Handle(V3d_View)  theView,
int &  x,
int &  y 
)
static
Parameters
xThe X coordinate in the view.
yThe Y coordinate in the view.
theViewView where the given point takes place.
Return values
gp_PntReturns the point clicked in 3D view

◆ FindPlane()

void CurveCreator_Utils::FindPlane ( const Handle(TColgp_HArray1OfPnt) &  thePoints,
gp_Pln &  thePlane,
Standard_Integer &  thePlnStatus 
)
staticprotected

The plane is defined by gp_Pln object and the status. The status can have one of the following values:

  • 0 plane is not set.
  • 1 origin of the plane is fixed. The plane is defined by 1 or several coincident points.
  • 2 origin + OX axis of the plane is fixed. The plane is defined by 2 or more points that lie on a particular line.
  • 3 plane is fixed. Plane is defined by 3 not coincident points.
Parameters
thePointsthe points.
thePlanethe current plane on input. It can be modified on output.
thePlnStatusthe current status on input. It can be modified on output.

References PLN_FIXED, PLN_FREE, PLN_ORIGIN, and PLN_OX.

◆ getRandColor()

Quantity_Color CurveCreator_Utils::getRandColor ( )
static

◆ getSelectedPoints()

void CurveCreator_Utils::getSelectedPoints ( Handle(AIS_InteractiveContext)  theContext,
const CurveCreator_ICurve theCurve,
CurveCreator_ICurve::SectionToPointList thePoints 
)
static
Parameters
theContextthe viewer context
theCurvea curve object, that contains data

References CurveCreator_UtilsICurve::findSectionsToPoints().

◆ Handle()

static CurveCreator_Utils::Handle ( TColgp_HArray1OfPnt  ) const &
staticprotected

The shape can be either a wire or a vertex. For vertex a single point in the array is returned.

Parameters
theShapethe shape. Can be either a wire or a vertex.
IsClosedclosed flag. Output parameter.
IsBSplineBSpline flag. Output parameter.
Returns
the array of points. Null handle in case of failure.

◆ hasProjectPointOnCurve()

bool CurveCreator_Utils::hasProjectPointOnCurve ( Handle(V3d_View)  theView,
const int  theX,
const int  theY,
const Handle(Geom_Curve)&  theCurve,
Standard_Real &  theParameter,
int &  theDelta 
)
staticprotected

◆ isEqualPixels()

bool CurveCreator_Utils::isEqualPixels ( const int  theX,
const int  theY,
const int  theOtherX,
const int  theOtherY,
const double  theTolerance,
int &  theDelta 
)
staticprotected

◆ isEqualPoints()

bool CurveCreator_Utils::isEqualPoints ( const gp_Pnt &  thePoint,
const gp_Pnt &  theOtherPoint 
)
staticprotected

◆ pointOnObject()

bool CurveCreator_Utils::pointOnObject ( Handle(V3d_View)  theView,
Handle(AIS_InteractiveObject theObject,
const int  theX,
const int  theY,
gp_Pnt &  thePoint,
gp_Pnt &  thePoint1,
gp_Pnt &  thePoint2 
)
static
Parameters
theObjecta line or shape with a bspline inside
theXthe X coordinate in the view.
theYthe Y coordinate in the view.
thePointthe output point to be append to the model curve
thePoint1the output point to bound the line where a new point should be inserted
thePoint2the output point to bound the line where a new point should be inserted

References ConvertPointToClick(), Handle(), hasProjectPointOnCurve(), isEqualPixels(), LOCAL_SELECTION_TOLERANCE, SCENE_PIXEL_POINT_TOLERANCE, SCENE_PIXEL_PROJECTION_TOLERANCE, and GEOM::Vertices.

◆ setLocalPointContext()

void CurveCreator_Utils::setLocalPointContext ( const CurveCreator_ICurve theCurve,
Handle(AIS_InteractiveContext)  theContext,
const bool  theOpen 
)
static
Parameters
theCurvea curve object, that contains data
theContextthe viewer context
theOpenThe flag to open or close the local context.

References Handle().

◆ setSelectedPoints()

void CurveCreator_Utils::setSelectedPoints ( Handle(AIS_InteractiveContext)  theContext,
const CurveCreator_ICurve theCurve,
const CurveCreator_ICurve::SectionToPointList thePoints = CurveCreator_ICurve::SectionToPointList() 
)
static
Parameters
theContextthe viewer context
theCurvea curve object, that contains data
thePointsthe curve point indices to be selected in the context

References CurveCreator_UtilsICurve::getPoint(), Handle(), and LOCAL_SELECTION_TOLERANCE.

Member Data Documentation

◆ IsBSpline

bool bool& CurveCreator_Utils::IsBSpline
protected

◆ IsClosed

bool& CurveCreator_Utils::IsClosed
protected

The documentation for this class was generated from the following files: