Class Sketcher
Sketcher is a main class, witch process program commands and manage other Sketcher
classes.
Public methods:
-
Sketcher (Handle(AIS_InteractiveContext)& theContext, Sketcher_GUI*
sg) – Constructs a Sketcher with context theContext and GUI sg. Compose
command entering geometric primitive list.
-
~Sketcher() – destructor.
-
void SetContext (Handle(AIS_InteractiveContext)& theContext) –
set context.
-
void SetData (Handle(TColStd_HSequenceOfTransient)& thedata) –
set list of objects.
-
Handle(TColStd_HSequenceOfTransient) GetData () – get list of objects.
-
void SetCoordinateSystem (const gp_Ax3& theCS) – set coordinate
system.
-
gp_Ax3 GetCoordinateSystem () – get coordinate system from Sketcher.
-
void SetPrecise(const Standard_Real& aPrecise) – set precise
for snap.
-
void SetColor (const Quantity_NameOfColor theColor) – set color.
Default color - Quantity_NOC_YELLOW
-
void SetType (const Sketcher_ObjectType theType) – set type of object.
Sketcher_ObjectType must be:
- MainSketcherType (default)
- AuxiliarySketcherType.
- void SetStyle (const Aspect_TypeOfLine theLineStyle) – set line style.
Aspect_TypeOfLine must be:
- Aspect_TOL_SOLID (default)
- Aspect_TOL_DASH
- Aspect_TOL_DOT
- Aspect_TOL_DOTDASH
-
void SetWidth (const Standard_Real& theWidth) – set line width.
- void ObjectAction (const Sketcher_ObjectTypeOfMethod theMethod) –
set entering object command by theMethod. Sketcher_ObjectTypeOfMethod must
be:
- Nothing _Method (default)
- Point_Method (command entering point)
- Line2P_Method (command entering line by 2 points)
- CircleCenterRadius_Method (command entering circle by center and
radius point)
- Circle3P_Method (command entering circle by 3 points)
- CircleCenter2P_Method (command entering circle by center and two
points)
- Circle2PTan_Method (command entering circle by 2 points & 1 tangent
to curve)
- CircleP2Tan_Method (command entering circle by point & 2 tangent
to curve)
- Circle3Tan_Method (command entering circle by 3 tangent to curve)
- Arc3P_Method (command entering arc by 3 points)
- BezierCurve_Method (command entering Bezier Curve by several points)
- Trim_Method (command editing object by cutting a part, limited with
intersection of other curves.
-
Sketcher_ObjectTypeOfMethod GetStatus () – get current object creating
method.
-
void OnMouseInputEvent (V3d_Coordinate &v3dX, V3d_Coordinate &v3dY,
V3d_Coordinate &v3dZ, Quantity_Parameter& projVx, Quantity_Parameter&
projVy, Quantity_Parameter& projVz) – input event handler.
-
void OnMouseMoveEvent (V3d_Coordinate &v3dX, V3d_Coordinate &v3dY,
V3d_Coordinate &v3dZ, Quantity_Parameter& projVx, Quantity_Parameter&
projVy, Quantity_Parameter& projVz) - mouse move handler.
-
void OnCancel () – cancel event handler. Stop entering object, erase
all interactive objects.
-
void DeleteSelectedObject () – delete objects selected in the context.
-
void ViewProperties () – show properties for selected object.
-
void RedrawAll () – erase and redraw all objects from object list.
-
void SetPolylineMode (Standard_Boolean amode) – set polyline mode.
-
void SetSnap (Sketcher_SnapType theSnap) – set current snap type.
-
Sketcher_SnapType GetSnap () – get current snap type.
Private methods:
-
Standard_Boolean ProjectPointOnPlane (V3d_Coordinate &v3dX, V3d_Coordinate
&v3dY, V3d_Coordinate &v3dZ, Quantity_Parameter& projVx, Quantity_Parameter&
projVy, Quantity_Parameter& projVz) – calculate 2d point on current
plane return true, if point was founded.
-
void addCommand (Handle(Sketcher_Command) theCommand) – add theCommand
to command list.
-
voidSelectCurCommand() – get command from command list
Class members:
- Handle(AIS_InteractiveContext) myContext – current context.
- Handle(TColStd_HSequenceOfTransient) myData – object list.
- Sketcher_GUI* myGUI – GUI.
- Handle(TColStd_HSequenceOfTransient) myCommands – command entering
objects list.
- Handle(Sketcher_Command) CurCommand – current command entering
object.
- Sketcher_ObjectTypeOfMethod myCurrentMethod – current method.
- Handle(Sketcher_AnalyserSnap) myAnalyserSnap – class, manger snap.
- Handle(Sketcher_Object) myCurObject – object.
- Handle(Geom_Line) myCurrentLine – this line is necessary to calculate
2d point.
- Handle(Geom_Plane) myCurrentPlane – work plane.
- gp_Ax3 myCoordinateSystem – current coordinate system.
- gp_Dir myCurrentDir – direction perpendicular to screen.
- gp_Pnt myTempPnt – 3d point.
- gp_Pnt2d myCurrentPnt2d – 2d point projected on current plane.
- GeomAPI_IntCS myIntCS – solver searching intersection line and
plane.
- gp_Pnt2d PolylineFirstPoint – this point is necessary for polyline.
- Standard_Boolean PolylineFirstPointExist – is necessary for polyline.
True, if command was changed from line to arc or vice versa
Class Sketcher_Command
Sketcher_Command – base class of commands entering objects. This commands
main function is to create objects by mouse button click handler and mouse move
handler. New object store in the list of objects.
Public methods:
-
Sketcher_Command (const Standard_CString name) – Constructs a Sketcher_Command.
-
~Sketcher_Command () – destructor.
-
void SetContext (Handle(AIS_InteractiveContext)& theContext) –
set context.
-
void SetData (Handle(TColStd_HSequenceOfTransient)& thedata) –
set list of objects.
-
void SetAx3(const gp_Ax3 &theAx3) – set coordinate system.
-
void SetAnalyserSnap (Handle(Sketcher_AnalyserSnap)& theAnalyserSnap)
– set snap manager.
-
void SetColor (const Quantity_NameOfColor theColor) – set color.
-
void SetType (const Sketcher_ObjectType theType) – set type of object.
-
void SetStyle (const Aspect_TypeOfLine theLineStyle) – set line style.
-
void SetWidth (const Standard_Real theWidth) – set line width.
-
void AddObject (const Handle(Geom2d_Geometry)& theGeom2d_Geometry,
const Handle(AIS_InteractiveObject)& theAIS_InteractiveObject, const
Sketcher_ObjectGeometryType theGeometryType) – add new object to object
list.
-
Standard_Boolean GetPolylineFirstPnt (gp_Pnt2d& p1) – set last
entering gp_Pnt2d for polyline.
-
void SetPolylineFirstPnt (const gp_Pnt2d& p1) – get last entering
gp_Pnt2d for polyline.
-
void SetPolylineMode (Standard_Boolean mode) – set polyline mode,if
mode is true. In other case – take off polyline mode.
Virtual functions:
-
virtual void Action () – turn command to active state
-
virtual Standard_Boolean MouseInputEvent (const gp_Pnt2d& thePnt2d)
– input event handler. Get 2d point on work plane.
-
virtual void MouseMoveEvent (const gp_Pnt2d& thePnt2d) – mouse
move handler. Get 2d point on work plan. Draw new object.
-
virtual void CancelEvent () – cancel event handler, stop entering
object.
-
virtual Sketcher_ObjectTypeOfMethod GetTypeOfMethod() – get command
Method.
Class members:
- Handle(AIS_InteractiveContext) myContext – current context
- Handle(TColStd_HSequenceOfTransient) data – list of objects.
- Handle(Sketcher_AnalyserSnap) myAnalyserSnap – snap manager.
- Quantity_NameOfColor myColor – object color.
- Sketcher_ObjectType myType – type of object.
- Aspect_TypeOfLine myStyle – object style.
- Standard_Real myWidth – object width.
- Handle(AIS_Drawer) myDrawer – drawer is necessary to set attributes
(color, style, width) to object representation.
- Handle(Prs3d_LineAspect) myPrs3dAspect – store attributes.
- Standard_Boolean myPolylineMode – polyline mode.
- gp_Pnt2d curPnt2d – current 2d point on work plane.
- gp_Ax3 curCoordinateSystem – currrent coordinate system.
- gp_Pnt2d myFirstgp_Pnt2d – first point of entering object.
- Handle(Geom_CartesianPoint) myFirstPoint – first point of entering
object .
- Handle(Geom_CartesianPoint) mySecondPoint – second point of entering
object .
- Handle(AIS_Line) myRubberLine – Interactive line, showing during
entering arc.
- TCollection_ExtendedString ObjectName – object mask name.
- Standard_Integer ObjectCounter – object entering counter
Class Sketcher_CommandArc3P
Sketcher_CommandArc3P – Command entering arc by 3 points. Entering order:
start point, point lying on arc, end point.
Private methods:
Class members:
- Arc3PAction myArc3Paction – arc entering state
- Nothing – default
- Input_1ArcPoint – input start point
- Input_2ArcPoint – input point lying on arc.
- Input_3ArcPoint – input end point
- Input_PolylineArc – input arc in polyline mode
- Handle(Geom_Circle) tempGeom_Circle – circle is necessary to create
AIS_Circle
- Handle(AIS_Circle) myRubberCircle – Interactive circle, showing
during entering arc.
- gp_Pnt2d mySecondgp_Pnt2d – second point, lying on arc.
- gp_Circ tempCirc – temp circle.
- gp_Pnt third_Pnt – end point.
- Geom2dAdaptor_Curve temp2dAdaptor_Curve – solver is necessary tfind
tangent point.
- gp_Circ2d temp2d_Circ – 2d circle on work plane.
- Handle(Geom2d_Circle) tempGeom2d_Circle – 2d circle
- gp_Pnt2d midpoint2d, tempu1_pnt2d, tempu2_pnt2d – points on work
plane. It’s necessary to determine arc orientation to create tangent
arc.
- Standard_Real u1,u2,temp_u1, temp_u2 – point parameters
- Standard_Real dist1, dist2 – distances between points.
- Handle(Geom2d_Line) tempGeom2d_Line – 2d line
- Handle(Geom2d_CartesianPoint) FirstGeom2d_Point – start point
- Handle(Geom2d_CartesianPoint) TempGeom2d_Point – point lying on
arc
Sketcher_CommandArcCenter2P
Sketcher_CommandArcCenter2P – Command entering arc by center & 2
points. Entering order: Center point, start point, end point.
Private methods:
- Standard_Boolean ProjectOnCircle(const gp_Pnt2d& thePnt2d) - project
point on circle. Return true, if point projected
Class members:
- ArcCenter2PAction myArcCenter2PAction – arc entering state.
- Nothing – default
- Input_1ArcPoint – input center point
- Input_ MidPoint – input start point
- Input_2ArcPoint – input point lying on arc.
- Input_2ArcPoint – input end point
- Handle(AIS_Point) myRubberCenterPoint – Interactive center point
- gp_Pnt2d mySecondgp_Pnt2d – start 2d point.
- gp_Pnt2d myMidgp_Pnt2d – 2d point, lying on arc
- Handle(Geom2d_Circle) tempGeom2d_Circle – 2d circle
- gp_Pnt third_Pnt – end point.
- Handle(Geom_Circle) tempGeom_Circle – circle
- Handle(AIS_Circle) myRubberCircle – Interactive circle, showing
during entering arc
- Standard_Real radius – arc radius
- Geom2dAPI_ProjectPointOnCurve ProjectOnCurve – project point on
curve
Sketcher_CommandBezierCurve
Sketcher_CommandBezierCurve – Command entering Bezier Curve by points.
Private methods:
-
void closeBezierCurve() – display Bezier Curve, add to list of objects.
-
void storePoles() – display Pole point, add to list of objects.
Class members:
- BezierCurveAction myBezierCurveAction – Bezier Curve entering state
- Nothing – default
- Input_1Point – input start point
- Input_2Point – input second point
- Input_ OtherPoints – input current end point
- Handle(Geom2d_BezierCurve)
- myGeom2d_BezierCurve – 2d Bezier Curve
- Handle(Geom_BezierCurve) myGeom_BezierCurve – Bezier Curve
- TopoDS_Edge curEdge – part of curve is necessary for representation
of curve
- Handle(AIS_Shape) myRubberAIS_Shape – Interactive curve
- gp_Pnt2d tempPnt2d – 2d point enter by user
- gp_Pnt myFirstgp_Pnt – start 2d point
- gp_Pnt tempPnt – point in 3d space
- Standard_Integer IndexCounter – pole points counter
Class Sketcher_CommandCircle2PTan
Sketcher_CommandCircle2PTan – Command entering Circle by 2 Point &
1 tangent tcurve. Entering order: first point, second point, object of tangent.
Private methods:
void SelectCurve() – select nearest curve.
Standard_Boolean SumDistanceToCircle () – select tangent point to determine
circle orientation. Return true, if that point exist.
Class members:
- Circle2PTanAction myCircle2PTanAction – circle entering by 2 points
& 1 tangent tcurve state:
- Nothing – default
- Input_1CirclePoint – input first point
- Input_2CirclePoint – input second point
- Input_3CircleTan – select object of tangent.
- Handle(Sketcher_Object) mySObject – current object.
- Standard_Real minDistance – minimum distance tcurrent point.
- Standard_Real curDistance – current distance tcurrent point.
- Standard_Real u_temp – point parameter, lying on selected object.
- gp_Pnt2d tempPnt2d – temp 2d point.
- Handle(Geom2d_CartesianPoint) First2dPoint – first point
- Handle(Geom2d_CartesianPoint) Second2dPoint – second point
- gp_Circ2d temp_Circ2d – 2d circle on work plane.
- gp_Circ best_Circ – prefferid circle from all possible circle.
- Handle(AIS_Circle) myRubberCircle – Interactive circle, showing
during entering arc.
- Handle(Geom2d_Line) tempGeom2d_Line – 2d line
- Handle(Geom2d_Circle) tempGeom2d_Circle – 2d circle
- Handle(Geom2d_Curve) tempGeom2d_Curve – 2d curve
- Handle(Geom_Circle) tempGeom_Circle – circle
- Geom2dAPI_ProjectPointOnCurve myProjectOnCurve – project point
on curve.
Class Sketcher_CommandCircle3P
Sketcher_CommandCircle3P – Class command, entering object by 3 points.
Class members:
- Circle3PAction myCircle3Paction – circle entering by 3 points state:
- Nothing – default
- Input_1CirclePoint – input first point
- Input_2CirclePoint – input second point
- Input_3CirclePoint – input third point
- Handle(Geom_Circle) tempGeom_Circle – circle
- Handle(AIS_Circle) myRubberCircle – Interactive circle, showing
during entering circle.
- gp_Pnt2d mySecondgp_Pnt2d – second entering point.
- gp_Pnt third_Pnt – third entering point.
- gp_Circ tempCirc – circle
Class Sketcher_CommandCircle3Tan
Sketcher_CommandCircle3Tan – Class command, entering circle by 3 tangent
of objects.
Private methods:
-
void SelectCurve() – select nearest curve.
-
Standard_Boolean SumDistanceToCircle () - select tangent point to determine
circle orientation. Return true, if that point exist.
-
Standard_Boolean CheckgpObject() – check object, is it possible to
create tangent circle. Return true, if the createing is possible.
-
Standard_Boolean StoregpObject() – store objects for creating tangent
circle.
Class members:
- Circle3TanAction myCircle3TanAction – circle entering by 3 tangent
tcurve state:
- Nothing – default
- Input_1CircleTan – select first object of tangent
- Input_2CircleTan – select second object of tangent
- Input_3CircleTan – select third object of tangent
- Handle(Sketcher_Object) mySObject – current object.
- Standard_Real minDistance – minimum distance tcurve.
- Standard_Real curDistance – current distance tcurve.
- Standard_Real u1,u2, u_temp – nearest point parameters, lying on
selected curves.
- gp_Pnt2d tempPnt2d – temp 2d point.
- gp_Pnt2d mySecondgp_Pnt2d – second entering point.
- gp_Circ2d temp_Circ2d – 2d circle
- gp_Circ best_Circ – prefferid circle from all possible circle.
- Handle(AIS_Circle) myRubberCircle – Interactive circle, showing
during entering arc.
- Handle(Geom2d_Circle) tempGeom2d_Circle – temp 2d circle
- Handle(Geom2d_Curve) tempGeom2d_Curve – temp 2d curve
- Handle(Geom2d_Curve) myFirst2d_Curve – first 2d curve
- Handle(Geom2d_Curve) mySecond2d_Curve – second 2d curve
- Handle(Geom_Circle) tempGeom_Circle – circle
- Standard_Boolean gp_lin1Exist,gp_lin2Exist – store information
about type of selected objects. True, if object is line.
- Standard_Boolean gp_circ1Exist,gp_circ2Exist – store information
about type of selected objects. True, if object is circle.
- gp_Lin2d gp_lin1,gp_lin2 – 2d lines, selected to create circle.
- gp_Circ2d gp_circ1,gp_circ2 – 2d circles, selected to create circle.
- Geom2dAPI_ProjectPointOnCurve myProjectOnCurve – project point
on curve.
Class Sketcher_CommandCircleCenterRadius
Sketcher_CommandCircleCenterRadius – Class command entering circle by
center point & point, lying on circle. Entering order: center point, point,
lying on circle.
Class members:
- CircleCenterRadiusAction myCircleCenterRadiusAction – circle entering
state.
- Nothing – default
- Input_CenterPoint – input center point
- Input_RadiusPoint – input point, lying on circle
- Standard_Real radius – circle radius
- Handle(Geom_Circle) tempGeom_Circle – circle
- Handle(AIS_Circle) myRubberCircle – Interactive object of circle
- gp_Ax2d myCircleAx2d – axis is necessary to create 2d circle.
Class Sketcher_CommandCircleP2Tan
Sketcher_CommandCircleP2Tan – Class command entering circle by point
& 2 tangent tcurve. Entering order: point, first object of tangent, second
object of tangent.
Private methods:
-
void SelectCurve() – select nearest curve.
-
Standard_Boolean SumDistanceToCircle () - select tangent point to determine
circle orientation. Return true, if that point exist.
-
Standard_Boolean CheckgpObject() – check object, is it possible to create
tangent circle Return true, if the bulding is possible.
-
Standard_Boolean StoregpObject() – store objects for creating tangent
circle.
Class members:
- CircleP2TanAction myCircleP2TanAction – circle entering by point
& 2 tangent tcurve state:
- Nothing – default
- Input_1CirclePoint – input point
- Input_2CircleTan – select first object of tangent
- Input_3CircleTan – select second object of tangent.
- Handle(Sketcher_Object) mySObject – current object.
- Standard_Real minDistance – minimum distance tcurve.
- Standard_Real curDistance – current distance tcurve.
- Standard_Real u2, u_temp – nearest point parameters, lying on selected
curves.
- gp_Pnt2d tempPnt2d – temp 2d point.
- gp_Pnt2d mySecondgp_Pnt2d – second entering point.
- Handle(Geom2d_CartesianPoint) First2dPoint – second 2d point
- gp_Circ2d temp_Circ2d – 2d circle
- gp_Circ best_Circ – prefferid circle from all possible circle.
- Handle(AIS_Circle) myRubberCircle – Interactive circle, showing
during entering arc.
- Handle(Geom2d_Circle) tempGeom2d_Circle – temp 2d circle .
- Handle(Geom2d_Curve) tempGeom2d_Curve – temp 2d curve .
- Handle(Geom2d_Curve) mySecond2d_Curve – second 2d curve .
- Handle(Geom_Circle) tempGeom_Circle – circle .
- Standard_Boolean gp_linExis – store information about type of selected
objects. True, if object is line.
- Standard_Boolean gp_circExist – store information about type of
selected objects. True, if object is circle.
- gp_Lin2d gp_lin – 2d lines, selected to create circle.
- gp_Circ2d gp_circ – 2d circles, selected to create circle.
- Geom2dAPI_ProjectPointOnCurve myProjectOnCurve – project point
on curve.
Class Sketcher_CommandLine2P
Sketcher_CommandLine2P – Class command entering line by 2 points.
Class members:
- Line2PAction myLine2PAction – entering line by 2 points state.
- Nothing – default
- Input_ FirstPointLine – input first point
- Input_ SecondPointLine – input second point
Class Sketcher_CommandPoint
Sketcher_CommandPoint – Class command entering point.
Class members:
- PointAction myPointAction – entering point state
- Nothing – default
- Input_ Point – input point
Class Sketcher_CommandTrim
Sketcher_CommandTrim – Class command editing objects. This Command allow
to cut a part of object, limited with intersection of other curves. The object
is breaking to some parts. Number of parts is bigger intersections by 1. Nearest
part to cursor is cutting. If none intersections found, it’s completly
remove. In case of cutting circle is creating arc.
Private methods:
-
void StandardEvent() – input event handler and mouse move handler.
-
void SelectNearestCurve() – select nearest curve.
-
void FixObjectPoints() – find intersection points, store points in
sequence.
-
void TrimCurve() – manager of cutting curve
-
Standard_Boolean PointProjected (Standard_Integer index) – find nearest
point.
-
void SetParam() – compute intersection point parameter.
-
void AddParam() – add parameter to sequence.
-
void FindSegment() – determine part of curve, that has been cutting.
-
Standard_Boolean Redraw() – redraw object, if it's necessary.
-
void RedrawOld() – draw erased object.
-
void DelTrimmedObject() – remove object from list of objects, erase
object..
-
void EditLine(Standard_Real u1,Standard_Real u2) – edit line by 2
parameters.
-
void AddNewLine(Standard_Real u1,Standard_Real u2) – Constructs a
new line by 2 parameters.
-
void EditCircle() – Constructs a arc from circle by 2 parameters.
-
void EditArc(Standard_Real u1,Standard_Real u2) – edit arc by 2 parameters.
-
void AddNewArc(Standard_Real u1,Standard_Real u2) – Constructs a
new arc by 2 parameters.
Class members:
- TrimAction myTrimAction – command trim state.
- NothingAction - default
- TrimObject – trim
- Handle(Sketcher_Object) mySObject – current object.
- Sketcher_ObjectGeometryType TypeofObject – type of current object.
- TCollection_ExtendedString TrimName – mask name of new object
- Standard_Integer curCurveIndex – index of current object.
- Standard_Integer NearestCurveIndex – index of nearest object.
- Geom2dAPI_ProjectPointOnCurve myProjectOnCurve – project point
on curve.
- Geom2dAPI_InterCurveCurve my2dAPI_InterCurveCurve – find intersection
of 2 curves.
- Handle(Geom2d_Edge) curGeom2d_Edge – 2d edge .
- Handle(Geom2d_Arc) curGeom2d_Arc – 2d arc .
- Handle(Geom2d_Circle) curGeom2d_Circle – 2d circle .
- Handle(Geom2d_Curve) nearestGeom2d_Curve – 2d curve
- Handle(Geom2d_Line) temp1Geom2d_Line – 2d line .
- Handle(Geom2d_Line) temp2Geom2d_Line – 2d line , to find intersections.
- Standard_Real minDistance – minimum distance curve.
- Standard_Real curDistance – current distance curve.
- Standard_Real NearestPntU – parameter of point projected on nearest
curve.
- Standard_Real tempU – temp 2d point parameter.
- Standard_Real FirstU,SecondU – points parameters on cutting part
of cuve.
- gp_Pnt2d tempPnt2d – temp 2d point.
- gp_Pnt2d mySecondgp_Pnt2d – temp 2d point.
- gp_Circ2d nearestgp_Circ2d – nearest 2d circle.
- Standard_Boolean isInputMouse – true, if current hadler is input
event handler.
- Standard_Boolean RedrawFlag – redraw flag.
- TColStd_SequenceOfReal mySeqOfPntU – list of itersections.
- RedrawState myRedrawState – redraw objects state.
- NothingRedraw – default.
- RedrawTrimmedObject – redraw object
- OneObjectRemove – redraw object and erase 1 new object.
- TwoObjectRemove - redraw object and erase 2 new object.
- Handle(AIS_InteractiveObject) curTrimmedObj – current object.
- Handle(AIS_InteractiveObject) newTrimmedObj – new object
- Handle(AIS_InteractiveObject FirstObj – first new object
- Handle(AIS_InteractiveObject) SecondObj – second new object.
- Standard_Real curFirstObjParam_Start – current start point parameter
on first object.
- Standard_Real curFirstObjParam_End – current end point parameter
on first object.
- Standard_Real newFirstObjParam_Start – new start point parameter
on first object.
- Standard_Real newFirstObjParam_End – new end point parameter on
first object.
- Standard_Real curSecondObjParam_Start – current start point parameter
on second object.
- Standard_Real curSecondObjParam_End – current end point parameter
on second object.
- Standard_Real newSecondObjParam_Start – new start point parameter
on second object.
- Standard_Real ewSecondObjParam_End – new end point parameter on
second object.
Class Sketcher_AnalyserSnap
Sketcher_AnalyserSnap – Snap manager class. Compose snap list. Take 2d
point at work plane. Depending on snap type, start corresponding snap command
to find new point. Als, it contain analyser snap handler. Analyzer snap automatically
determine preffered snap among all possible snaps.
Public methods:
- Sketcher_AnalyserSnap (Handle(AIS_InteractiveContext)& theContext,
Handle(TColStd_HSequenceOfTransient)& thedata, gp_Ax3 &theAx3) –
Constructs a Sketcher_AnalyserSnap. Compose snap list.
- ~Sketcher_AnalyserSnap () – destructor.
- void SetContext (Handle(AIS_InteractiveContext)& theContext) ) –
set context.
- void SetData (Handle(TColStd_HSequenceOfTransient)& thedata) –
set list of objects.
- void SetAx3 (const gp_Ax3 &theAx3) - set coordinate system
- void SetMinDistance(const Standard_Real& aPrecise) – set precise
for snap.
- void SetSnapType (Sketcher_SnapType theSnap) - set current snap type.
- Sketcher_SnapType GetSnapType() – get current snap type.
- gp_Pnt2d MouseInput (const gp_Pnt2d& thePnt2d) – input event handler.
Take 2d point on work plane and pass it to current snap. Return new point,
founded by snap.
- gp_Pnt2d MouseMove (const gp_Pnt2d& thePnt2d) – mouse move handler.
Take 2d point on work plane and pass it to current snap. Return new point,
founded by snap. Draw snap.
- void Cancel () – cancel event handler
- gp_Pnt2d MouseInputException (const gp_Pnt2d& p1, const gp_Pnt2d&
thePnt2d, TangentType CType, Standard_Boolean TangentOnly) – input event
exception handler for snapparallel, snapperpendicular, snaptangent.
- gp_Pnt2d MouseMoveException (const gp_Pnt2d& p1, const gp_Pnt2d&
thePnt2d, TangentType CType, Standard_Boolean TangentOnly) – mouse move
exception handler for snapparallel, snapperpendicular, snaptangent.
Private methods:
-
void SnapAnalyserEvent () - search best point among all possible snaps.
-
void AddPoints (const Standard_Real& factor) – add point to sequence.
Add corresponding point parameter to sequence.
-
void addSnap (Handle(Sketcher_Snap) theSnap) – add theSnap to snap
list.
-
void SelectCurSnap () – get snap from snap list.
Class members:
- Handle(AIS_InteractiveContext) myContext – context.
- Handle(TColStd_HSequenceOfTransient) data – list of objects
- Handle(TColStd_HSequenceOfTransient) mySnaps – list of snap
- Handle(Sketcher_Snap) CurSnap – current snap.
- Sketcher_SnapType myCurrentSnap – current snap type.
- gp_Ax3 curCoordinateSystem – coordinate system.
- gp_Pnt2d myPnt2d – 2d point on work plane.
- gp_Pnt2d storedPnt2d – 2d point stored for snapparallel, snapperpendicular,
snaptangent.
- TangentType storedTangentType – tangent type.
- Standard_Boolean isTangent – true, if exception called for tangent
snap.
- Standard_Boolean isLine - true, if exception called for snapparallel,
snapperpendicular.
- TColgp_SequenceOfPnt2d mySeqOfPnt2d – 2d point list.
- TColStd_SequenceOfReal mySeqOfDistance – distance list.
- TColStd_SequenceOfReal mySeqOfFactor – point parameter list.
- TColStd_SequenceOfInteger mySnapType – snap type list.
- Sketcher_SnapType mySnapAnType – current snap type for best 2d point
- Sketcher_SnapType curSnapAnType – snap type for new 2d point
- Standard_Real minimumSnapDistance – distance between current point
and new point
- Standard_Real bestDist – preferred distance.
- Standard_Real curDist – current distance.
Class Sketcher_Snap
Sketcher_Snap – base class of Snap. It`s main function: find a new point
by means of some method. Snap type must be:
- SnapNothing – default
- SnapEnd – snap to end line or arc point.
- SnapMiddle – snap to middle line or arc point.
- SnapCenter – snap to center of circle or arc
- SnapNearest – snap to nearest point on object.
- SnapIntersection – snap to point of intersection
- SnapTangent – snap to tangent point.
- SnapParallel – snap parallelel lines
- SnapPerpendicular – snap perpendicular line.
- SnapAnalyse – analyser, select best snap from all possible snaps.
Public methods:
-
Sketcher_Snap () – Constructs a Sketcher_Snap.
-
~Sketcher_Snap () – Destructor.
-
void SetContext (Handle(AIS_InteractiveContext)& theContext) –
set context.
-
void SetData (Handle(TColStd_HSequenceOfTransient)& thedata) - set
list of objects
-
void SetAx3 (const gp_Ax3 &theAx3) – set coordinate system.
-
void Sketcher_ Snap::SetMinDistance(const Standard_Real& aPrecise)
– set precise.
-
void DrawRelation() – draw relation.
-
void EraseRelation() – erase relation.
-
gp_Pnt2d MouseInputEvent (const gp_Pnt2d& tempPnt2d) – input
event handler. Take 2d point on work plane. Return new point, founded by
snap.
-
gp_Pnt2d MouseMoveEvent (const gp_Pnt2d& tempPnt2d) – mouse move
handler. Take 2d point on work plane. Return new point, founded by snap.
-
void EraseSnap () – cancel event handler. Erase point.Turn Snap to
default state.
-
Standard_Boolean AnalyserEvent (const gp_Pnt2d& tempPnt2d, gp_Pnt2d&
newPnt2d, Standard_Real& dist, Standard_Integer& type) – Analyser
hadler. Get new point, minimum distance, snap type. Return new point, distance
to point, snap type.
-
void setFirstPnt (const gp_Pnt2d& p) – set point for exceptions.
-
void setFirstPnt (const gp_Pnt2d& p, TangentType ttype) - set point
and tangent type for exceptions. Tangent type must be:
- NothingTangent – without tangent (default)
- Line_FirstPnt – line tangent to curve by first point.
- Line_SecondPnt – line tangent to curve by second point.
- Circle_CenterPnt – tangent circle
Virtual functions:
Protected methods:
-
Standard_Boolean countProject () – find point projected on curve.
-
Standard_Boolean count () – check distance to point. Return true,
if distance lesser minimum distance.
Class members:
- Handle(AIS_InteractiveContext) myContext – context
- Handle(TColStd_HSequenceOfTransient) data – list of objects.
- gp_Ax3 curCoordinateSystem – coordinate system.
- Handle(Sketcher_Object) mySObject – current object.
- Sketcher_ObjectGeometryType myGeometryType – object geometry type.
- Standard_Boolean firstDisplay – true, if new point displaied to
screen
- Handle(Geom_CartesianPoint) myGeom_Point – new point .
- Handle(AIS_Point) myAIS_Point – point, displayed in the screen.
- Handle(AIS_InteractiveObject) curHilightedObj – current hilighted
object.
- gp_Pnt2d curPnt2d – current 2d point.
- gp_Pnt2d objectPnt2d – analyzing 2d point.
- gp_Pnt2d bestPnt2d – preferred 2d point.
- Standard_Boolean findbestPnt2d – true, if preferred point exist.
- Handle(Geom2d_CartesianPoint) curGeom2d_Point – 2d point .
- Standard_Real minDistance – minimum distance.
- Standard_Real curDistance – current distance.
- Geom2dAPI_ProjectPointOnCurve ProjectOnCurve – project point on
curve.
- Handle(Geom_Plane) myPlane – work plane.
- TopoDS_Edge FirstEdge – first object edge.
- TopoDS_Edge SecondEdge – second object edge.
Class Sketcher_SnapCenter
Sketcher_SnapCenter – Class snap searching center curve/circle/arc.
Class members:
- Handle(Geom2d_Circle) curGeom2d_Circle – circle .
Class Sketcher_SnapIntersection
Sketcher_SnapIntersection – Class snap searching intersection point of
objects.
Private methods:
- void findSecondObject(Standard_Integer start) – find intersections
points for object with start index.
Class members:
- Handle(Sketcher_Object) secondSObject – second object
- Handle(Geom2d_Curve) cur1Geom2d_Curve – first object .
- Handle(Geom2d_Curve) cur2Geom2d_Curve – second object .
- Handle(Geom2d_Edge) cur1Geom2d_Edge – first 2d edge .
- Handle(Geom2d_Edge) cur2Geom2d_Edge – second 2d edge .
- Handle(Geom2d_Line) cur1Geom2d_Line – first 2d line .
- Handle(Geom2d_Line) cur2Geom2d_Line – second 2d line
- Standard_Real bpu – parameter of intersection point.
- Geom2dAPI_InterCurveCurve my2dAPI_InterCurveCurve – find intersection
point of curves.
- Handle(AIS_InteractiveObject) curHilightedObj2 – second hilighted
object.
Class Sketcher_SnapEnd
Sketcher_SnapEnd – Class snap searching end point of line/arc.
Class members:
- Handle(Geom2d_Edge) curGeom2d_Edge – 2d edge
- Handle(Geom2d_Arc) curGeom2d_Arc – 2d arc .
Class Sketcher_SnapLine
Sketcher_SnapLine – base class of snaps searching parallel/perpendicular
lines.
Private methods:
-
void SelectNearest() – select nearest line
-
void checkparallel() – check lines for parallel
-
Standard_Boolean ProjectPoint() – project point on line
-
void setEdges() – set Edges to display relation.
Class members:
- Standard_Real minAngle – minimum angle between lines.
- Standard_Real curAngle – current angle between lines.
- gp_Pnt2d nearestPnt2d – nearest point at selected line.
- gp_Dir2d curDir2d – direction of current line.
- gp_Dir2d tempDir2d – direction of line from object list.
- Handle(Geom2d_Line) curGeom2d_Line – 2d line from object list.
- Handle(Geom2d_Line) tempGeom2d_Line – new 2d line.
- gp_Lin mygp_Lin1,mygp_Lin2 – two lines for Edges. It’s necessary
to display relation..
Class Sketcher_SnapLineParallel
Sketcher_SnapLineParallel – Class snap searching parallel lines. Return
point projected on founded line.
Class members:
- Handle(AIS_ParallelRelation) myParRelation – snap parallel relation.
Class Sketcher_SnapLinePerpendicular
Sketcher_SnapLinePerpendicular – Class snap searching perpendicular lines.
Return point projected on founded line.
Class members:
- Handle(AIS_PerpendicularRelation) myPerRelation – snap perpendicular
relation.
Class Sketcher_SnapMiddle
Sketcher_SnapMiddle – Class snap searching middle point of line/arc
Class members:
- Handle(Geom2d_Edge) curGeom2d_Edge – 2d edge .
- Handle(Geom2d_Arc) curGeom2d_Arc – 2d arc
Class Sketcher_SnapNearest
Sketcher_SnapNearest – Class snap searching nearest point at line/circle/arc.
Class members:
- Handle(Geom2d_Curve) curGeom2d_Curve – 2d curve .
Class Sketcher_SnapTangent
Sketcher_SnapTangent – Class snap searching tangent to objects. It is
possible to construct tangent line to curve by first point or second point,
and tangent circle to curve.
Private methods:
-
void SelectLine_FirstPntEvent() – Find nearest point on curve and
store it. Construct tangent line at this point.
-
voidSelectLine_CheckFirstPntEvent() – check first point of line belonging
to circle/arc. Create tangent line at this point.
-
void SelectLine_FixEvent() – find tangent line at first point.
-
void SelectLine_SecondPntEvent() – find tangent line at second point.
-
void SelectCurveCenterEvent() – find tangent circle to curve.
Class members:
- TangentType myTangentType – tangent type.
- NothingTangent – without tangent (default)
- Line_FirstPnt – line tangent to curve by first point.
- Line_SecondPnt – line tangent to curve by second point.
- Circle_CenterPnt – tangent circle.
- Standard_Real radiusDistance – distance between current point on
work plane to tangent points to find preffered point.
- gp_Pnt2d myFirstPnt2d – first point.
- Standard_Boolean FixFirstPnt – flag. True, if first point lying
on arc/circle.
- Standard_Real minAngle – minimum angle between tangent line and
current line.
- Standard_Real curAngle – current angle between tangent line and
current line.
- gp_Lin2d mylin2d – tangent line at first point.
- gp_Dir2d tempDir2d – dirrection of current line.
- Handle(Geom2d_Arc) curGeom2d_Arc – arc .
- Handle(Geom2d_Circle) curGeom2d_Circle – current 2d circle .
- Handle(Geom2d_Line) tempGeom2d_Line – temp 2d line .
- Handle(Geom2d_Circle) tempGeom2d_Circle – temp 2d circle
- Handle(Geom2d_Curve) tempGeom2d_Curve – temp 2d curve
- Geom2dAPI_InterCurveCurve my2dAPI_InterCurveCurve – find intersection
point of 2 curves.
Class Sketcher_Object
Sketcher_Object – Class storing geometry primitive and all it's attributes.
Public methods:
-
Sketcher_Object (const Handle(Geom2d_Geometry)& theGeom2d_Geometry,
const Handle(AIS_InteractiveObject)& theAIS_InteractiveObject, const
TCollection_ExtendedString& theName, const Sketcher_ObjectGeometryType
theGeometryType, const Sketcher_ObjectTypeOfMethod theTypeOfMethod) –
Constructs a Sketcher_Object with geometry theGeom2d_Geometry, representation
theAIS_InteractiveObject, name theName, geometry type theGeometryType, type
of method theTypeOfMethod. Default attributes – color Quantity_NOC_YELLOW,
type MainSketcherType, line style Aspect_TOL_SOLID, line width 1.0.
-
~Sketcher_Object () – destructor.
-
void SetGeometry (const Handle(Geom2d_Geometry)& theGeom2d_Geometry)
- set geometry.
-
Handle(Geom2d_Geometry) GetGeometry () – get geometry
-
void SetAIS_Object (const Handle(AIS_InteractiveObject)& theAIS_InteractiveObject)
- set object representation.
-
Handle(AIS_InteractiveObject) GetAIS_Object() – get object representation.
-
void SetObjectName (const TCollection_ExtendedString& theName) –
set object name.
-
TCollection_ExtendedString GetObjectName () – get object name.
-
void SetGeometryType (const Sketcher_ObjectGeometryType theGeometryType)
– set type of geometry.
-
Sketcher_ObjectGeometryType GetGeometryType () – get type of geometry.
-
void SetTypeOfMethod (const Sketcher_ObjectTypeOfMethod theTypeOfMethod)
- set object entering method.
-
Sketcher_ObjectTypeOfMethod GetTypeOfMethod () – get object entering
method.
-
void SetColor(const Quantity_NameOfColor theColor) – set color
-
Quantity_NameOfColor GetColor() – get color.
-
void SetType(const Sketcher_ObjectType theType) – set type of object.
-
Sketcher_ObjectType GetType () – get type of object
-
void SetStyle(const Aspect_TypeOfLine theLineStyle) – set line style.
-
Aspect_TypeOfLine GetStyle () – get line style
-
void SetWidth(const Standard_Real theWidth) – set line width.
-
Standard_Real GetWidth () – get line width
Class members:
- Handle(Geom2d_Geometry) myGeometry – object geometry
- Handle(AIS_InteractiveObject) myAIS_InteractiveObject – object
representation.
- TCollection_ExtendedString myName – object name.
- Sketcher_ObjectGeometryType myGeometryType – type of geometry.
- Sketcher_ObjectTypeOfMethod myTypeOfMethod – object entering method.
- Quantity_NameOfColor myNameOfColor – color.
- Sketcher_ObjectType myObjectType – type of object.
- Aspect_TypeOfLine myLineStyle – line style.
- Standard_Real myWidth – line width.
Class Sketcher_GUI
Sketcher_GUI – abstract class for classes managing edit object classes.
Public methods:
Virtual functions:
-
void SetContext (Handle(AIS_InteractiveContext)& theContext) –
pass context to property classes.
-
void SetAx3 (const gp_Ax3& theAx3) – pass coordinate system to
property classes.
-
void SetSketcher_Object (Handle(Sketcher_Object)& CurObject) –
determine property to show, pass object to this property class.
Class Sketcher_QtGUI
Sketcher_QtGUI – Class, managing edit object classes. Pass object to
property class. Property classes correspond to object geometry:
- PointSketcherObject – point.
- LineSketcherObjec – line (edge)
- CircleSketcherObject - circle
- ArcSketcherObject – arc.
Public methods:
Sketcher_QtGUI (QWidget* parent) – Constructs a Sketcher_QtGUI. Pass
parent window to property classes.
Class members:
- Property_Point* prop_point – class editing point.
- Property_Line* prop_line – class editing line.
- Property_Circle* prop_circle – class editing circle.
- Property_Arc* prop_arc – class editing arc.
Class Sketcher_Property
Sketcher_Property – base class for editing object classes. Show dialog
window with object properties. Enable user to change object name, type of object,
geometry properties. Color, line style, line width disable to point properties.
Public methods:
-
Sketcher_Property (QWidget* parent, const char* name, WFlags fl ) –
Constructs a Sketcher_Property which is a child of 'parent', with the name
'name' and widget flags set to 'fl'.
-
~Property() – destructor.
-
void SetContext (Handle(AIS_InteractiveContext)& theContext) –
set context.
-
void SetAx3 (gp_Ax3& theAx3) – set coordinate system
-
void SetObject(Handle(Sketcher_Object)& CurObject) – set object,
show dialog window.
-
void onOK() – clicking on "OK" button handler.
-
void onApply() - clicking on " Apply " button handler.
Private methods:
-
void Init() – Constructs a supplementary elements.
-
void SetID () – set object name to LineEditID.
-
TCollection_ExtendedString GetID () – get text from LineEditID.
-
void SetCoord(QLineEdit* le,const gp_Pnt2d& p) – set point coordinate
in the form of [x,y] to le
-
bool CheckCoord(QLineEdit* le, gp_Pnt2d& p) – get point coordinate
from le.
-
void CheckAttributes() – check attributes for change.
-
void GetAttributes() – set attributes to object.
-
void GetName() – check name and type of object for change.
-
void SetColor() – show object color in dialog window.
-
Quantity_NameOfColor GetColor() – get object color from dialog window.
-
void SetObjectType() – show object type in dialog window.
-
Sketcher_ObjectType GetObjectType() – get object type in dialog window.
-
void SetObjectStyle() – show object line style in dialog window.
-
Aspect_TypeOfLine GetObjectStyle() – get object line style in dialog
window.
-
void SetWidth() – show object line width in dialog window.
-
Standard_Real GetWidth() – get object line width in dialog window.
Virtual functions:
-
virtual void SetGeometry() – show object geometry in dialog window.
-
virtual bool CheckGeometry() – check geometry for change
-
virtual bool GetGeometry() - Create new object. Return true, if object
created.
Class members:
- const Qstring StartCoord,MidCoord,EndCoord – strings is necessary
to show coordinate in the form of “[x,y]”
- const QregExp NumberExpr – character set true for coordinate string.
- Qstring NumName – temp string.
- Handle(AIS_InteractiveContext) myContext - context
- gp_Ax3 myCoordinateSystem – coordinate system.
- Handle(Sketcher_Object) mySObject – editing object.
- Handle(AIS_InteractiveObject) myAIS_Object – editing object representation.
- TCollection_ExtendedString myID,tempID – editing object name
- Quantity_NameOfColor myNameOfColor - editing object color.
- Sketcher_ObjectType myObjectType - editing object type.
- Aspect_TypeOfLine myObjectStyle – editing object line style.
- Standard_Real myWidth – editing object line width.
- Handle(AIS_Drawer) myDrawer – drawer is necessary to set attributes
to object representation.
- Handle(Prs3d_LineAspect) myPrs3dAspect – editing object attributes.
- gp_Pnt2d firstPnt2d,tempPnt2d – 2d points.
Class Sketcher_PropertyArc
Sketcher_PropertyArc – Class editing arc. Show dialog window of arc properties.
It allow to change center point, radius, parameters of start & end point.
Parameters changing from 0 to1.
Class members:
- Handle(Geom2d_Arc) curGeom2d_Arc – arc .
- double myRadius,tempRadius – object radius, radius changed by user.
- double myFirstParameter,myLastParameter – arc parameters.
- double tempFirstParameter,tempLastParameter – arc parameters changed
by user
Class Sketcher_PropertyCircle
Sketcher_PropertyCircle – Class editing circle. Show dialog window of
circle properties. It allow to change center point and radius.
Class members:
- Handle(Geom2d_Circle) curGeom2d_Circle – circle .
- double myRadius – circle radius.
- double tempRadius – radius changed by user.
Class Sketcher_PropertyLine
Sketcher_PropertyLine – Class editing edge. Show dialog window of edge
properties. It allow to change first and second point coordinates.
Public methods:
- void SetLineLength() – calculate edge length, show it in dialog window.
Class members:
- Handle(Geom2d_Edge) curGeom2d_Edge – edge .
- gp_Pnt2d secondPnt2d – second point of edge
- gp_Pnt2d temp2Pnt2d – second point of edge editing by user.
Class Sketcher_PropertyPoint
Sketcher_PropertyPoint – Class editing point. Show dialog window of point
properties. It allow to change point coordinates.
Class members:
Handle(Geom2d_CartesianPoint) curGeom2d_Point – point.
Class Geom2d_Arc
Geom2d_Arc – Class, describing 2d arc geometry. Inherit from Geom2d_Circle.
Keep information about boundary points. Check paramepers, when set it. Start
parameter must be lesser than last parameter.
Public methods:
-
Geom2d_Arc(const gp_Circ2d& C) – Constructs a Geom2d_Arc with
circle c. Default parameters are 0, 2*pi.
-
Geom2d_Arc(const gp_Ax2d& Ax2d,const Standard_Real R) – Constructs
a Geom2d_Arc with axis Ax2d and radius R. Default parameters are 0, 2*pi.
-
~Geom2d_Arc() – destructor.
-
void SetParam(const gp_Pnt2d& start,const gp_Pnt2d& mid,const gp_Pnt2d&
end) – set parameters. Mid point is lying on arc. It is necessary
to define arc orientation.
-
void SetFirstParam(const Standard_Real u1) – set first parameter.
-
void SetFirstParam(const gp_Pnt2d& p1) – set first parameter.
-
void SetLastParam(const Standard_Real u2) – set last parameter.
-
void SetLastParam(const gp_Pnt2d& p2) – set last parameter.
-
Standard_Real FirstParameter() const – get first parameter.
-
Standard_Real LastParameter() const - get last parameter.
-
gp_Pnt2d FirstPnt() const – get first 2d point.
-
gp_Pnt2d LastPnt() const - get last 2d point.
-
gp_Pnt2d MiddlePnt() const – get middle 2d point.
Private methods:
- void CheckParam() – set correct parameters.
Class members:
- Standard_Real myFirstParam – start parameter.
- Standard_Real myLastParam – end parameter.
Class Geom2d_Edge
Geom2d_Edge – Class, describing 2d edge geometry. Inherit from Geom2d_Line.
Keep information about boundary points.
Public methods:
-
Geom2d_Edge() – Constructs a Geom2d_Edge. Created line – absciss
line.
-
~Geom2d_Edge() – destructor.
-
Standard_Boolean SetPoints(const gp_Pnt2d& p1,const gp_Pnt2d& p2)
– set edge by 2 points. Check points to equal. Return true, if edge
created.
-
gp_Pnt2d GetStart_Pnt() const – get start 2d point.
-
gp_Pnt2d GetEnd_Pnt() const – get end 2d point
-
gp_Pnt2d MiddlePnt() const – get middle 2d point.
-
Standard_Real StartParameter() const – get start 2d point parameter
-
Standard_Real EndParameter() const – get end 2d point parameter
Class members:
- gp_Pnt2d StartPnt – start 2d point.
- gp_Pnt2d EndPnt – end 2d point.
OpenCASCADE Sketcher
www.laduga.com
www.laduga.ru