|
wxArt2D
|
Restriction engine for editing restrictions like snapping. More...
#include <restrict.h>


Public Types | |
| enum | a2dSnapToWhat { snapToNone = 0x00000000, snapToObjectPosX = 0x00000001, snapToObjectPosY = 0x00000002, snapToObjectPos = snapToObjectPosX | snapToObjectPosY, snapToStart = 0x00000100, snapToEnd = 0x00000200, snapToPins = 0x00000400, snapToPinsUnconnected = 0x00000800, snapToObjectIntersection = 0x00001000, snapToObjectVertexes = 0x00002000, snapToObjectSegmentsMiddle = 0x00004000, snapToObjectSegments = 0x00008000, snapToGridPosX = 0x00010000, snapToGridPosY = 0x00020000, snapToGridPos = snapToGridPosX | snapToGridPosY, snapToPointPosX = 0x00040000, snapToPointPosY = 0x00080000, snapToPointPosXorY = 0x00100000, snapToPointPosXorYForce = 0x00200000, snapToPointPos = snapToPointPosX | snapToPointPosY, snapToPointAngleMod = 0x00400000, snapToPointAngleRational = 0x00800000, snapToPointAngle = snapToPointAngleMod | snapToPointAngleRational, snapToBoundingBox = 0x01000000, snapToObjectSnapVPath = 0x02000000, snapToGridPosForced = 0x04000000, snapToAll = 0xFFFFFFFF } |
Public Types inherited from a2dObject | |
| enum | CloneOptions { clone_members = 0x00000001, clone_properties = 0x00000002, clone_childs = 0x00000004, clone_unused = 0x00000008, clone_setoriginal = 0x00000010, clone_seteditcopy = 0x00000020, clone_noReference = 0x00000040, clone_noCameleonRef = 0x00000080, clone_toDrag = 0x00000100, clone_flat = 0x00000000, clone_deep = clone_members | clone_properties | clone_childs } |
| options for cloning More... | |
| typedef a2dAutoZeroPtr< a2dObject > | TAutoZeroPtrListClass |
| this is needed inside the smart pointer template code | |
Public Member Functions | |
| a2dRestrictionEngine () | |
| Constructor. | |
| ~a2dRestrictionEngine () | |
| Destructor. | |
| void | SetSnapGrid (const a2dDoMu &x, const a2dDoMu &y) |
| Set snapping grid (only position) | |
| const a2dDoMu & | GetSnapGridX () const |
| Get horizontal center snapping distance (zero if disabled) | |
| const a2dDoMu & | GetSnapGridY () const |
| Get vertical center snapping distance (zero if disabled) | |
| void | SetSnapOrigin (const a2dDoMu &x, const a2dDoMu &y) |
| Set snapping origin (position grid offest/shift) | |
| void | SetSnapOriginX (const a2dDoMu &x) |
| void | SetSnapOriginY (const a2dDoMu &y) |
| const a2dDoMu & | GetSnapOriginX () const |
| Get snapping origin X (position grid offset/shift) | |
| const a2dDoMu & | GetSnapOriginY () const |
| Get snapping origin Y (position grid offset/shift) | |
| void | SetRotationAngle (double a) |
| Set rotation angle raster. | |
| double | GetRotationAngle () const |
| Get rotation angle raster. | |
| int | GetSnapThresHold () const |
| used to snap vertexes to a pin or point like snapping features in objects. | |
| void | SetSnapThresHold (int thresHold) |
| used to snap vertexes to a pin or point like snapping features in objects. | |
| double | GetSnapThresHoldWorld () const |
| used to snap vertexes to a pin or point, for snapping features in objects. More... | |
| void | SetSnap (bool snap) |
| enable all snapping features or not | |
| bool | GetSnap () const |
| enable all snapping features or not | |
| void | SetSnapOnlyVisibleObjects (bool snapOnlyVisbleObjects) |
| enable all snapping features for object only for visible object. | |
| bool | GetSnapOnlyVisibleObjects () const |
| all snapping features for object only for visible object? | |
| void | SetRotationRational (wxUint32 nomMask, wxUint32 denMask) |
| Set rotation rational raster nominator/denominator mask. More... | |
| void | SetSnapSourceFeatures (wxUint32 snapSourceFeatures) |
| void | SetSnapSourceFeature (a2dSnapToWhat snapSourceFeature, bool value=true) |
| set one of the snapping features for the source to true or false, leaf others as is | |
| a2dSnapToWhatMask | GetSnapSourceFeatures () const |
| void | SetSnapTargetFeatures (wxUint32 snapTargetFeatures) |
| void | SetSnapTargetFeature (a2dSnapToWhat snapTargetFeature, bool value=true) |
| set one of the snapping features for targets to true or false, leaf others as is | |
| bool | GetSnapTargetFeature (a2dSnapToWhat snapTargetFeature) const |
| return the setting of a specific snapping feature | |
| a2dSnapToWhatMask | GetSnapTargetFeatures () const |
| virtual bool | RestrictCanvasObjectAtVertexes (a2dCanvasObject *object, a2dPoint2D &point, double &dx, double &dy, wxUint32 sourceRequired=snapToAll, bool ignoreEngine=false) |
| return the clossest vertex which can be snapped if any. More... | |
| virtual bool | RestrictVertexes (a2dVertexArray *segments, a2dPoint2D &point, double &dx, double &dy, wxUint32 sourceRequired=snapToAll, bool ignoreEngine=false) |
| return the clossest vertex which can be snapped if any. More... | |
| virtual bool | RestrictVertexes (a2dVertexList *lsegments, a2dPoint2D &point, double &dx, double &dy, wxUint32 sourceRequired=snapToAll, bool ignoreEngine=false) |
| return the clossest vertex which can be snapped if any. More... | |
| virtual bool | RestrictPoint (double &x, double &y, wxUint32 sourceRequired=snapToAll, bool ignoreEngine=false) |
| Restrict a single point of a line or polyline. More... | |
| virtual bool | RestrictLine (a2dLine &line, wxUint32 sourceRequired=snapToAll, bool ignoreEngine=false) |
| Restrict a single line. More... | |
| virtual bool | RestrictAngle (double *ang, wxUint32 sourceRequired=snapToAll, bool ignoreEngine=false) |
| Restrict angle. More... | |
| void | SetRestrictPoint (double xSnap, double ySnap) |
| sets the point for snapping to More... | |
| const a2dPoint2D & | GetRestrictPoint () const |
| to ask engine for the restrict point More... | |
| a2dPoint2D | GetPointToSnap () const |
| to ask engine for the point that needs to be snapped to a a2dCanvasObject More... | |
| void | SetPointSnapResult (const a2dPoint2D &p) |
| set the point that was snapped to a a2dCanvasObject vertex More... | |
| bool | IsWithInThresHold (const a2dPoint2D &p) |
| check if point is within threshold to m_pointToSnap | |
| a2dLine & | GetLineToSnap () |
| to ask engine for the line that needs to be snapped to a a2dCanvasObject More... | |
| void | SetParentSnapObjects (a2dCanvasObject *obj) |
| parent object of objects that need to be snapped to More... | |
| a2dCanvasObject * | GetParentSnapObjects () const |
| return pointer of the current parent object More... | |
| void | SetShiftKeyDown (bool shiftDown) |
| some snapping may depend on shift key being down | |
| bool | GetShiftKeyDown () const |
| some snapping may depend on shift key being down | |
| void | SetReleaseSnap (bool releaseSnap) |
| do not snap if set | |
| bool | GetReleaseSnap () const |
| do not snap if set | |
Public Member Functions inherited from a2dObject | |
| virtual bool | ProcessEvent (wxEvent &event) |
| bool | SearchDynamicEventTable (wxEvent &event) |
| void | Connect (int winid, int lastId, int eventType, wxObjectEventFunction func, wxObject *userData=(wxObject *) NULL, wxEvtHandler *eventSink=(wxEvtHandler *) NULL) |
| bool | Disconnect (int winid, int lastId, wxEventType eventType, wxObjectEventFunction func=NULL, wxObject *userData=(wxObject *) NULL, wxEvtHandler *eventSink=(wxEvtHandler *) NULL) |
| void | ProcessConnectedEvent (wxEvent &event) |
| wxCHECK_VERSION(2,9,0) More... | |
| void | ConnectEvent (wxEventType type, wxEvtHandler *eventSink) |
| bool | DisconnectEvent (wxEventType type, wxEvtHandler *eventSink) |
| bool | DisconnectEventAll (wxEvtHandler *eventSink) |
| Remove all dynamic events in classA, going to classB (eventSink) More... | |
| a2dObject () | |
| constructor | |
| virtual | ~a2dObject () |
| destructor | |
| void | operator= (const a2dObject &other) |
| assignment operator | |
| int | GetOwnedBy () |
| like it to be protected, but this does not work with wxList macros More... | |
| virtual a2dObject * | SetNonDynamic () |
| Call to mark this object as non-dynamic (static/local/auto) More... | |
| void | CheckReferences () |
| Check zero reference count and delete if count is 0. More... | |
| a2dObject * | Clone (CloneOptions options, a2dRefMap *refs=NULL) const |
| create an exact copy of this property | |
| a2dObject (const a2dObject &other, CloneOptions options, a2dRefMap *refs) | |
| virtual wxString | GetName () const |
| Returns the name of this object, if no name is given the internal id will be returned. More... | |
| virtual void | SetName (const wxString &name) |
| Creates the a2dStringProperty PROPID_Name. More... | |
| virtual bool | IsTemporary_DontSave () const |
| Check if this is a temporary object, which should not be saved. | |
| void | SaveAsDocument (a2dIOHandlerXmlSerOut &out) |
| Save this object and all below as an XML document. More... | |
| virtual void | Save (wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dObjectList *towrite) |
| write all needed to an XML type of file called the CVG format More... | |
| void | LoadFromDocument (a2dIOHandlerXmlSerIn &parser) |
| Load this object and all below from an XML document. More... | |
| virtual void | Load (wxObject *parent, a2dIOHandlerXmlSerIn &parser) |
| load object from CVG file More... | |
| wxInt64 | GetUniqueSerializationId () const |
| return a unique id for this object More... | |
| virtual bool | AlwaysWriteSerializationId () const |
| If true, always write an id. More... | |
| virtual bool | LinkReference (a2dObject *other) |
| link a reference in the object to the given value More... | |
| virtual void | ResolveInform () |
| inform an object that reference resolution was done More... | |
| void | Walker (wxObject *parent, a2dWalkerIOHandler &handler) |
| This is used to recursively walk through an object tree. | |
| void | SetCheck (bool check) |
| general flag use at will. More... | |
| bool | GetCheck () const |
| general flag use at will. | |
| void | SetRelease (bool value) |
| set release flag More... | |
| bool | GetRelease () const |
| get release flag More... | |
| a2dAutoZeroPtr< a2dObject > ** | GetAutoZeroPtrList () |
| return the list head pointer for autozero pointers to this object More... | |
| DECLARE_PROPERTIES () | |
| a2dNamedProperty * | GetProperty (const a2dPropertyId *propertyId, a2dPropertyId::Flags flags=a2dPropertyId::flag_none) const |
| get property on this object More... | |
| void | SetProperty (a2dNamedProperty *propertyHolder, a2dPropertyId::SetFlags flags=a2dPropertyId::set_none) |
| Set the property to the this object. More... | |
| void | SetProperty (const a2dNamedProperty &propertyHolder, a2dPropertyId::SetFlags flags=a2dPropertyId::set_none) |
| Set the property to the this object and if enabled, to all childs and object members. More... | |
| virtual a2dNamedProperty * | FindProperty (const a2dPropertyId *id, a2dPropertyId::Flags flags=a2dPropertyId::flag_none) |
| Find a dynamic property with given id in the property list. More... | |
| virtual const a2dNamedProperty * | FindProperty (const a2dPropertyId *id, a2dPropertyId::Flags flags=a2dPropertyId::flag_none) const |
| Find a dynamic property with given id in the property list. More... | |
| virtual bool | HasProperty (const a2dPropertyId *id, const wxString &stringvalue=wxEmptyString) const |
| Check if the object has a property with given id and string representation. More... | |
| virtual void | OnPropertyChanged (const a2dPropertyId *id) |
| This function is called after a property changed. More... | |
| virtual bool | EditProperties (const a2dPropertyId *id, bool withUndo=true) |
| edit properties of the object More... | |
| void | TakeOverProperties (a2dObject *from, a2dPropertyIdList *listOfIds) |
| Properties in the id list are taken from the given object, en set to this. More... | |
| wxURI | GetURI () const |
| quick way to get to PROPID_URI property More... | |
| void | SetURI (const wxURI &url) |
| quickly set a property PROPID_URI More... | |
| const a2dNamedPropertyList & | GetPropertyList () const |
| Get the Property List. More... | |
| bool | HasDynamicProperties () const |
| test if there are dynamic properties in the m_propertylist | |
| virtual bool | RemoveProperty (const a2dPropertyId *id, bool all=true) |
| This function is called by a2dPropertyId to remove a property from the list. More... | |
| void | RemoveTemporaryProperties () |
| remove all temporary properties | |
| virtual bool | AddProperty (a2dNamedProperty *property) |
| This function is called by a2dPropertyId to add a property to the list. More... | |
Static Public Attributes | |
| static a2dPropertyIdUint32 * | PROPID_SnapSourceFeaturesMem |
| static a2dPropertyIdUint32 * | PROPID_SnapSourceFeatures |
| static a2dPropertyIdUint32 * | PROPID_SnapTargetFeatures |
| static a2dPropertyIdDouble * | PROPID_RotationAngle |
| static a2dPropertyIdUint32 * | PROPID_RotationRationalNom |
| static a2dPropertyIdUint32 * | PROPID_RotationRationalDen |
| static a2dPropertyIdInt32 * | PROPID_SnapThresHold |
| static a2dPropertyIdPoint2D * | PROPID_PointToSnap |
| static a2dPropertyIdPoint2D * | PROPID_PointToRestrictTo |
| static a2dPropertyIdBool * | PROPID_SnapOnlyVisbleObjects |
| static a2dPropertyIdBool * | PROPID_Snap |
| static a2dPropertyIdBool * | PROPID_SnapGetSet |
| static a2dPropertyIdBool * | PROPID_AltDown |
| static a2dPropertyIdBool * | PROPID_ShiftDown |
| static const a2dSignal | sig_changed = wxNewId() |
Static Public Attributes inherited from a2dObject | |
| static a2dPropertyIdBool * | PROPID_Check = NULL |
| used for linking multiple referenced objects when serializing | |
| static a2dPropertyIdUri * | PROPID_URI = NULL |
| attach an URL to the object | |
| static a2dPropertyIdString * | PROPID_Name = NULL |
| Name property, to return name of this object. | |
| static a2dPropertyIdVoidPtr * | PROPID_autozeroptrlist = NULL |
| static const a2dSignal | sm_Edit_properties = wxNewId() |
| edit properties event, see EditProperties() | |
Protected Member Functions | |
| void | SignalChange () |
| void | SetInternal () |
| double | AngleRestrict (double angle) |
| Restrict an angle. | |
| void | AngleRestrictVectorRot (double *vecx, double *vecy) |
| Restrict the angle of a vector, keeping the vectors length. | |
| void | AngleRestrictVectorSkew (double *vecx, double *vecy, double otherx, double othery) |
| Restrict the angle of a vector, keeping the vectors projection on the orthogonal of another vector. | |
| double | RationalRestrict (double angle) |
| Rational restrict an angle. | |
| void | RationalRestrictVector (double *vecx, double *vecy) |
| Rational restrict the angle of a vector. | |
Protected Member Functions inherited from a2dObject | |
| virtual bool | DoIgnoreIfNotMember (const a2dPropertyId *id) const |
| used to decide if a property shall be ignored, if it is not a member More... | |
| virtual void | DoWalker (wxObject *parent, a2dWalkerIOHandler &handler) |
| iterate over this object and its children More... | |
Protected Attributes | |
| a2dSnapToWhatMask | m_snapSourceFeatures |
| set to the a2dSnapToWhat features enabled by the engine for the source object | |
| a2dSnapToWhatMask | m_snapTargetFeatures |
| set to the a2dSnapToWhat target features enabled by the engine and/or snap source object | |
| a2dDoMu | m_snapDistX |
| horizontal position snapping grid distance | |
| a2dDoMu | m_snapDistY |
| vertical position snapping grid distance | |
| a2dDoMu | m_originX |
| horizontal grid snapping origin vs. coordinate origin | |
| a2dDoMu | m_originY |
| vertical grid snapping origins vs. coordinate origin | |
| double | m_rotationAngle |
| angle snapping angle in degrees | |
| wxUint32 | m_rotationRationalNom |
| bit map of possible nominators (bit1->0.. bit32->31) for rational angle snapping | |
| wxUint32 | m_rotationRationalDen |
| bit map of possible denominators (bit1->0.. bit32->31) for rational angle snapping | |
| double * | m_angleList |
| sorted list of allowed rational angles | |
| int | m_nAngleList |
| number of allowed rational angles | |
| int | m_snapThresHold |
| threshold in pixels towards the snapping point. | |
| a2dPoint2D | m_pointToSnap |
| set to point that is currently being snapped. | |
| a2dPoint2D | m_snappedPoint |
| set to point that is snapped to m_pointToSnap | |
| a2dPoint2D | m_pointToRestrictTo |
| a2dLine | m_lineToSnap |
| bool | m_snapOnlyVisbleObjects |
| if true snapping modes for object is only on visible object. | |
| bool | m_snap |
| if true snapping modes are enabled, else non. | |
| bool | m_releaseSnap |
| to not snap inside snapping engine. | |
| bool | m_shiftDown |
| snapping modifier when shift key is pressed | |
| a2dCanvasObject * | m_parentObject |
| parent canvas object in a2dCanvasDocument on which snapping needs to be done. | |
| double | m_docSnapDistX |
| double | m_docSnapDistY |
| double | m_docOriginX |
| double | m_docOriginY |
Protected Attributes inherited from a2dObject | |
| a2dNamedPropertyList | m_propertylist |
| properties | |
| int | m_refcount |
| how many references to this object do exist | |
| bool | m_check: 1 |
| used for linking multiple referenced objects when serializing | |
| bool | m_release: 1 |
| when set object is treated as being deleted, and wil be deleted in idle time. | |
| bool | m_recursion_active: 1 |
| this is used as a recursion stopper | |
| bool | m_pendingDisconnects: 1 |
| unsigned int | m_iteratorCount |
| a2dAutoZeroPtr< a2dObject > * | m_autozeroptrlist |
| this is a list of all a2dAutoZeroPtr object pointing to this object | |
Friends | |
| a2dSnapToWhat | operator| (a2dSnapToWhat a, a2dSnapToWhat b) |
Additional Inherited Members | |
Protected Types inherited from a2dObject | |
| enum | { refcount_nondynamic = 0x76543210 } |
| special refcount value for non-dynamic objects | |
Restriction engine for editing restrictions like snapping.
The restriction engine is used by editing tools to restrict/snap editing of points, handles, pins, segments to the same things in other objects or to a grid on the whole drawing area. We call the object which needs to be snapped the source, while the object and points to which we want to snap the targets. When the source is a single vertex, the is no extra feature to be set. But if the source is a a2dCanvasObject, one can specify which features in it can be snapped to. This set by a2dSnapToWhat flags in m_snapSourceFeatures. For the targets, there are in general more options, set by a2dSnapToWhat flags in m_snapTargetFeatures.
With rational snapping is meant snapping to angles whose tangent is a rational number with a small integer nominatior and denominator. The max nominator/denominator is the snapping parameter. For slanting angles, the absolute slanting angle (that is angle to the coordinate axis) is used, not the slanting angle relative to the rotated coordinate system. With rational snapping, you can solve many problems of slant and angle snapping, where you want to snap also to the horizontal and vertical grid. If we snap to angles with a small rational tangent, the resulting points will also snap to a small fraction of the horizontal or vertical grid.
Each of these snapping modes may be enabled separately.
What snapping features in the targets need to be enabled in this specific case is in several cases set by the parameter called sourceRequired. The member m_snapTargetFeatures contains the default target snapping features which are enabled, and the sourceRequired is indicating what the source object (point, canvasobject), requires to be enabled in that. m_snapSourceFeatures stays the same, and is only indicating what vertexes/features will be snapped, taking them from the input source object (point/canvas object). IOW The source canvas object in e.g the dragtool, can decide/require to which vertexes in the target objects it wants to snap. It does not always make sense to snap to all enabled target features. This way one can enable it central, and a tool use/require it in a local manner.
A same approach could be implemented for the source objects, meaning enabling/disabling m_snapSourceFeatures parts when calling restrict on a source, but sofar there was no need for it.
An example menu handler to enable/disable snapping:
Definition at line 88 of file restrict.h.
Flags for defining to what should be snapped to. To the drawing/snapping grid, and inside other a2dCanvasObject's
| Enumerator | |
|---|---|
| snapToNone |
no snap to modes specified |
| snapToObjectPosX |
perform x position snapping |
| snapToObjectPosY |
perform y position snapping |
| snapToStart |
snap start point of line |
| snapToEnd |
snap end point of line |
| snapToPins |
snap to pins in other objects |
| snapToPinsUnconnected |
snap to pins in other objects when not connected |
| snapToObjectIntersection |
snap to intersections in other objects |
| snapToObjectVertexes |
snap to other objects its vertexes, which are decided in a2dCanvasObject::RestrictToObject() |
| snapToObjectSegmentsMiddle |
snap segments middle of other objects in a2dCanvasObject::RestrictToObject() |
| snapToObjectSegments |
snap segments of other objects in a2dCanvasObject::RestrictToObject() |
| snapToGridPosX |
perform x grid snapping |
| snapToGridPosY |
perform y grid snapping |
| snapToPointPosX |
perform x position snapping to a specific point |
| snapToPointPosY |
perform y position snapping to a specific point |
| snapToPointPosXorY |
perform snapping to X or Y of a specific point |
| snapToPointPosXorYForce |
perform alligning to X or Y of a specific point |
| snapToPointAngleMod |
perform angle snapping to multiples of m_rotationAngle to a specific point |
| snapToPointAngleRational |
perform rational angle snapping to a specific point |
| snapToBoundingBox |
perform snapping to boundingbox of objects |
| snapToObjectSnapVPath |
perform snapping to snapping vector path returned by a2dCanvasObject::GetSnapVpath() |
| snapToGridPosForced |
If no other snap point was closer, force to grid, even if not within threshold. |
Definition at line 101 of file restrict.h.
|
inline |
to ask engine for the line that needs to be snapped to a a2dCanvasObject
When engine is asked to snape a line, the line to snap is set. This can be used by e.g. a2dCanvasObject::RestrictToObject() to snap to other lines, pins etc.
Definition at line 367 of file restrict.h.
|
inline |
return pointer of the current parent object
Definition at line 386 of file restrict.h.
|
inline |
to ask engine for the point that needs to be snapped to a a2dCanvasObject
When engine is asked to snap a vertex/point, the result point to snap is set. This can be used by e.g. a2dCanvasObject::RestrictToObject() to snap to pins etc.
Definition at line 350 of file restrict.h.
|
inline |
to ask engine for the restrict point
For snapping modes that restrict to X,Y of the restrict Point.
Definition at line 343 of file restrict.h.
|
inline |
set what snapping features or enabled for the source to snap to. see a2dSnapToWhat for snapping features.
Definition at line 227 of file restrict.h.
|
inline |
set what snapping features or enabled for the target to snap to. see a2dSnapToWhat for snapping features.
Definition at line 249 of file restrict.h.
| double a2dRestrictionEngine::GetSnapThresHoldWorld | ( | ) | const |
used to snap vertexes to a pin or point, for snapping features in objects.
Calculated from m_snapThresHold, taking into account the active a2dCanvasView.
Definition at line 91 of file restrict.cpp.
|
virtual |
Restrict angle.
| ang | input angle and output angle after restriction |
| sourceRequired | what the caller wants the (x,y) to restrict to. ( is ANDed with m_snapTargetFeatures ) |
| ignoreEngine | set to ignore engine its own snap modes. |
Definition at line 485 of file restrict.cpp.
|
virtual |
return the clossest vertex which can be snapped if any.
The source a2dCanvasObject is asked for its snapping features/vertexes via a2dCanvasObject::GetSnapVpath(), but only those ementioned in m_snapSourceFeatures. All the features returned will be tried to snap to neighbouring canvas objects, and eventually the grid. e.g. It calls for each vertex in the snapping path the function RestrictPoint(), and the clossest snapped point will be snapped to.
| object | object to be snapped to other snapping targets |
| point | if a point to snap is found, it is stored here. |
| dx | x distance from the returned point to the snapping point. |
| dy | y distance from the returned point to the snapping point. |
| sourceRequired | what the caller wants the snapping points in the object to restrict to. ( is ANDed with m_snapTargetFeatures ) |
| ignoreEngine | set to ignore engine its own snap modes. |
Definition at line 685 of file restrict.cpp.
|
virtual |
Restrict a single line.
| line | the line to restrict |
| sourceRequired | what the caller wants the (x,y) to restrict to. ( is ANDed with m_snapTargetFeatures ) |
| ignoreEngine | set to ignore engine its own snap modes. |
Definition at line 480 of file restrict.cpp.
|
virtual |
Restrict a single point of a line or polyline.
The input point( x,y ) is snapped to the targets, being:
| x | input x and output x after restriction |
| y | input y and output y after restriction |
| sourceRequired | what the caller wants the (x,y) to restrict to inside the targets. ( is ANDed with m_snapTargetFeatures ) |
| ignoreEngine | set to ignore engine its own snap modes. |
Definition at line 227 of file restrict.cpp.
|
virtual |
return the clossest vertex which can be snapped if any.
| segments | segments to be snapped to other snapping targets |
| point | if a point to snap is found, it is stored here. |
| dx | x distance from the returned point to the snapping point. |
| dy | y distance from the returned point to the snapping point. |
| sourceRequired | what the caller wants the snapping points to restrict to. ( is ANDed with m_snapTargetFeatures ) |
| ignoreEngine | set to ignore engine its own snap modes. |
Definition at line 747 of file restrict.cpp.
|
virtual |
return the clossest vertex which can be snapped if any.
| lsegments | segments to be snapped to other snapping targets |
| point | if a point to snap is found, it is stored here. |
| dx | x distance from the returned point to the snapping point. |
| dy | y distance from the returned point to the snapping point. |
| sourceRequired | what the caller wants the snapping points to restrict to. ( is ANDed with m_snapTargetFeatures ) |
| ignoreEngine | set to ignore engine its own snap modes. |
Definition at line 774 of file restrict.cpp.
|
inline |
parent object of objects that need to be snapped to
For snapping features where canvas objects are involved, this needs to be set to the parent object of the objects which can be snaped or can be snapped to. For example when needing to snap a vertex/point to the objects in a a2dcanvasView, set this parent object to the a2dcanvasView::GetShowObject().
| obj,: | pointer to object to set as parent |
Definition at line 380 of file restrict.h.
| void a2dRestrictionEngine::SetPointSnapResult | ( | const a2dPoint2D & | p | ) |
set the point that was snapped to a a2dCanvasObject vertex
When engine is asked to snap a vertex/point, the result point is set here. This is used e.g. a2dCanvasObject::RestrictToObject() to snap to pins etc.
Definition at line 212 of file restrict.cpp.
|
inline |
sets the point for snapping to
In modes:
Definition at line 337 of file restrict.h.
|
inline |
Set rotation rational raster nominator/denominator mask.
nomMask bitX / denMask bit Y present an angle in radians to which can be snapped. e.g. if bit 2 is set in nomMask, and bit 6 is set in denMask, we will have 1/5 snap to 2*PI/5
| nomMask | each bit set here presents a number (bit1 number 0 until bit32 number 31) |
| denMask | each bit set here presents a number (bit1 number 0 until bit32 number 31) |
Definition at line 208 of file restrict.h.
|
inline |
set what snapping features or enabled for the source to snap to. see a2dSnapToWhat for snapping features.
Definition at line 215 of file restrict.h.
|
inline |
set what snapping features or enabled for the target to snap to. see a2dSnapToWhat for snapping features.
Definition at line 231 of file restrict.h.