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:
void SetWidth (const Standard_Real& theWidth) – set line width.
- 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:
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:
Class Sketcher_CommandArc3P
Sketcher_CommandArc3P – Command entering arc by 3 points. Entering order: start point, point lying on arc, end point.
Private methods:
void findlastSObject() - find last object at list of objects. It’s necessary to create polyline.
void setTempLine() – set default horisontal line. Default line is parallel to absciss.
Class members:
Sketcher_CommandArcCenter2P
Sketcher_CommandArcCenter2P – Command entering arc by center & 2 points. Entering order: Center point, start point, end point.
Private methods:
Class members:
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:
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:
Class Sketcher_CommandCircle3P
Sketcher_CommandCircle3P – Class command, entering object by 3 points.
Class members:
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:
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:
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:
Class Sketcher_CommandLine2P
Sketcher_CommandLine2P – Class command entering line by 2 points.
Class members:
Class Sketcher_CommandPoint
Sketcher_CommandPoint – Class command entering point.
Class members:
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:
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:
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:
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:
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:
Virtual functions:
virtual void SelectEvent () – find new point
virtual Sketcher_SnapType GetSnapType () – get type of current snap.
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:
Class Sketcher_SnapCenter
Sketcher_SnapCenter – Class snap searching center curve/circle/arc.
Class members:
Class Sketcher_SnapIntersection
Sketcher_SnapIntersection – Class snap searching intersection point of objects.
Private methods:
Class members:
Class Sketcher_SnapEnd
Sketcher_SnapEnd – Class snap searching end point of line/arc.
Class members:
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:
Class Sketcher_SnapLineParallel
Sketcher_SnapLineParallel – Class snap searching parallel lines. Return point projected on founded line.
Class members:
Class Sketcher_SnapLinePerpendicular
Sketcher_SnapLinePerpendicular – Class snap searching perpendicular lines. Return point projected on founded line.
Class members:
Class Sketcher_SnapMiddle
Sketcher_SnapMiddle – Class snap searching middle point of line/arc
Class members:
Class Sketcher_SnapNearest
Sketcher_SnapNearest – Class snap searching nearest point at line/circle/arc.
Class members:
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:
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:
Class Sketcher_GUI
Sketcher_GUI – abstract class for classes managing edit object classes.
Public methods:
Sketcher_GUI() – Constructs a Sketcher_GUI.
~Sketcher_GUI() – destructor.
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:
Public methods:
Sketcher_QtGUI (QWidget* parent) – Constructs a Sketcher_QtGUI. Pass parent window to property classes.
Class members:
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:
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:
Class Sketcher_PropertyCircle
Sketcher_PropertyCircle – Class editing circle. Show dialog window of
circle properties. It allow to change center point and radius.
Class members:
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:
Class members:
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:
Class members:
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: