wxArt2D
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
a2dRestrictionEngineOld Class Reference

DEPRECATED Restriction engine for editing restrictions like snapping. More...

#include <restrict.h>

Inheritance diagram for a2dRestrictionEngineOld:
Inheritance graph
[legend]
Collaboration diagram for a2dRestrictionEngineOld:
Collaboration graph
[legend]

Classes

struct  SnapObjectInfo
 Structure to descripe snapping properties of an object. More...
 

Public Types

enum  EPositionSnapModes {
  posCenter = 0x00000001, posTopLeft = 0x00000002, posTop = 0x00000004, posTopRight = 0x00000008,
  posRight = 0x00000010, posBottomRight = 0x00000020, posBottom = 0x00000040, posBottomLeft = 0x00000080,
  posLeft = 0x00000100, posLineTop = 0x00000200, posLineHCenter = 0x00000400, posLineBottom = 0x00000800,
  posLineLeft = 0x00001000, posLineVCenter = 0x00002000, posLineRight = 0x00004000, posOther = 0x00008000,
  posSngl = 0x00010000, posEqual = 0x80000000, posNone = 0x00000000, pos6L = posLineTop | posLineHCenter | posLineBottom | posLineLeft | posLineVCenter | posLineRight,
  pos1P = posCenter, pos2P = posCenter | posTopLeft, pos3P = posCenter | posTopLeft | posBottomRight, pos5P = posCenter | posTopLeft | posTopRight | posBottomRight | posBottomLeft,
  pos9P = posCenter | posTopLeft | posTop | posTopRight | posRight | posBottomRight | posBottom | posBottomLeft | posLeft, posAny = pos9P | pos6L | posSngl, pos1P6L = posCenter | pos6L
}
 Position snap modes/flags (once for x any y) More...
 
enum  ESizeSnapModes {
  sizeLength = 0x00000001, sizeProject = 0x00000002, sizeMajor = 0x00000004, sizeAxis = 0x00000008,
  sizePos = 0x00000010, sizeMin = 0x00000020, sizeMax = 0x00000040, sizeEqual = 0x80000000,
  sizeNone = 0x00000000, sizeAny = 0x0000007F
}
 Size snap modes/flags (once for x and y) More...
 
enum  ERotationSnapModes {
  rotVectorAngleX = 0x00000001, rotVectorRationalX = 0x00000002, rotVectorAngleY = 0x00000004, rotVectorRationalY = 0x00000008,
  rotPureRotations = 0x00000010, rotPureSlanting = 0x00000020, rotEndpointAngle = 0x00000040, rotEndpointRational = 0x00000080,
  rotEndpointUntrans = 0x00000100, rotNone = 0x00000000, rotAllAngle = rotVectorAngleX | rotVectorAngleY | rotEndpointAngle, rotAllRational = rotVectorRationalX | rotVectorRationalY | rotEndpointRational,
  rotAll = 0x000001FF
}
 Rotation/Slanting snap modes/flags. More...
 
enum  ESnapWhat {
  snapPosX = 0x00000001, snapPosY = 0x00000002, snapSizeX = 0x00000004, snapSizeY = 0x00000008,
  snapRot = 0x00000010, snapSkew = 0x00000020, snapWH = 0x00000040, snapEndAngle = 0x00000080,
  snapStart = 0x00000100, snapEnd = 0x00000200, snapPointI = 0x80000000, snapPos = snapPosX | snapPosY,
  snapSize = snapSizeX | snapSizeY, snapPosSize = snapPos | snapSize, snapSizeWH = snapSize | snapWH
}
 Flags for what to touch during a restriction. More...
 
- 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< a2dObjectTAutoZeroPtrListClass
 this is needed inside the smart pointer template code
 

Public Member Functions

 a2dRestrictionEngineOld ()
 Constructor.
 
 ~a2dRestrictionEngineOld ()
 Destructor.
 
void SetPosModes (EPositionSnapModes modeX, EPositionSnapModes modeY=posEqual)
 Set position snap modes (ored EPositionSnapModes)
 
EPositionSnapModes GetPosModesX ()
 Get position snap modes (ored EPositionSnapModes)
 
EPositionSnapModes GetPosModesY ()
 
void SetSizeModes (ESizeSnapModes modeX, ESizeSnapModes modeY=sizeEqual)
 Set size snap modes (ored ESizeSnapModes)
 
ESizeSnapModes GetSizeModesX ()
 Get size snap modes (ored ESizeSnapModes)
 
ESizeSnapModes GetSizeModesY ()
 
void SetRotationModes (ERotationSnapModes mode)
 Set rotation/slanting snap modes (ored ERotationSnapModes)
 
ERotationSnapModes GetRotationModes ()
 Get rotation/slanting snap modes (ored ERotationSnapModes)
 
void SetSnapGrid (double x, double y)
 Set snapping grid (position and size)
 
void SetPosGrid (double x, double y)
 Set snapping grid (only position)
 
void SetSizeGrid (double x, double y)
 Set snapping grid (only size)
 
void SetSnapOrigin (double x, double y)
 Set snapping origin (position grid offest/shift)
 
void SetMinSize (double x, double y)
 Set minimum size.
 
void SetMaxSize (double x, double y)
 Set maximum size.
 
void SetRotationAngle (double a)
 Set rotation angle raster.
 
void SetRotationRational (wxUint32 nomMask, wxUint32 denMask)
 Set rotation rational raster nominator/denominator mask.
 
void RestrictAffine (a2dAffineMatrix *mNew, const a2dAffineMatrix *mOld, ESnapWhat snapWhat, SnapObjectInfo *info, double *w=0, double *h=0)
 Restrict an affine transformation. More...
 
void RestrictEndpointAngle (double *angle, const a2dAffineMatrix &matrix, ESnapWhat snapWhat)
 
void RestrictPoint (double *x, double *y)
 Restrict a single point of a line or polyline.
 
double GetCenterSnapX ()
 Get horizontal center snapping distance (zero if disabled)
 
double GetCenterSnapY ()
 Get vertical center snapping distance (zero if disabled)
 
- 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 a2dObjectSetNonDynamic ()
 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...
 
a2dObjectClone (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 ()
 
a2dNamedPropertyGetProperty (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 a2dNamedPropertyFindProperty (const a2dPropertyId *id, a2dPropertyId::Flags flags=a2dPropertyId::flag_none)
 Find a dynamic property with given id in the property list. More...
 
virtual const a2dNamedPropertyFindProperty (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 a2dNamedPropertyListGetPropertyList () 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...
 

Protected Member Functions

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 a2dObjectDoClone (CloneOptions options, a2dRefMap *refs) const =0
 
virtual void DoWalker (wxObject *parent, a2dWalkerIOHandler &handler)
 iterate over this object and its children More...
 

Protected Attributes

EPositionSnapModes m_posModesX
 ored EPositionSnapModes of enabled modes for x
 
EPositionSnapModes m_posModesY
 ored EPositionSnapModes of enabled modes for y
 
ESizeSnapModes m_sizeModesX
 ored ESizeSnapModes of enabled modes for x
 
ESizeSnapModes m_sizeModesY
 ored ESizeSnapModes of enabled modes for y
 
ERotationSnapModes m_rotModes
 ored ERotationSnapModes of enabled modes
 
double m_snapDistX
 horizontal position snapping grid distance
 
double m_snapDistY
 vertical position snapping grid distance
 
double m_originX
 horizontal grid snapping origin vs. coordinate origin
 
double m_originY
 vertical grid snapping origins vs. coordinate origin
 
double m_sizeX
 horizontal size snapping grid distance
 
double m_sizeY
 vertical size snapping grid distance
 
double m_minSizeX
 minimal horiontal size
 
double m_minSizeY
 minimal vertical size
 
double m_maxSizeX
 maximal horiontal size
 
double m_maxSizeY
 maximal vertical size
 
double m_rotationAngle
 angle snapping angle in degrees
 
wxUint32 m_rotationRationalNom
 bit map of possible nominators (0..31) for rational angle snapping
 
wxUint32 m_rotationRationalDen
 bit map of possible denominators (0..31) for rational angle snapping
 
double * m_angleList
 sorted list of allowed rational angles
 
int m_nAngleList
 number of allowed rational angles
 
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

EPositionSnapModes operator| (EPositionSnapModes a, EPositionSnapModes b)
 
ESizeSnapModes operator| (ESizeSnapModes a, ESizeSnapModes b)
 
ERotationSnapModes operator| (ERotationSnapModes a, ERotationSnapModes b)
 
ESnapWhat operator| (ESnapWhat a, ESnapWhat b)
 

Additional Inherited Members

- Static Public Attributes inherited from a2dObject
static a2dPropertyIdBoolPROPID_Check = NULL
 used for linking multiple referenced objects when serializing
 
static a2dPropertyIdUriPROPID_URI = NULL
 attach an URL to the object
 
static a2dPropertyIdStringPROPID_Name = NULL
 Name property, to return name of this object.
 
static a2dPropertyIdVoidPtrPROPID_autozeroptrlist = NULL
 
static const a2dSignal sm_Edit_properties = wxNewId()
 edit properties event, see EditProperties()
 
- Protected Types inherited from a2dObject
enum  { refcount_nondynamic = 0x76543210 }
 special refcount value for non-dynamic objects
 

Detailed Description

DEPRECATED Restriction engine for editing restrictions like snapping.

The restriction engine is used by editing tools to restrict editing of points and affine transformations.

void MyDrawFrm::OnDrawRasterSnap(wxCommandEvent &event)
{
if( event.IsChecked() )
{
*restrict=new a2dRestrictionEngineOld();
restrict->SetSnapGrid(20,20);
restrict->SetRotationModes(a2dRestrictionEngineOld::rotAllAngle);
restrict->SetRotationAngle(15);
a2dCanvasGlobals->SetRestrictionEngine(restrict);
}
else
{
a2dCanvasGlobals->SetRestrictionEngine(0);
}
}
Todo:
Implement angle snapping for lines with length snapping or snapping of the endpoints to vertical or horizontal grodlines.

Definition at line 583 of file restrict.h.

Member Enumeration Documentation

Position snap modes/flags (once for x any y)

Enumerator
posCenter 

enable position snapping of object center to grid

posTopLeft 

enable position snapping of object top left to grid

posTop 

enable position snapping of object top to grid

posTopRight 

enable position snapping of object top right to grid

posRight 

enable position snapping of object right to grid

posBottomRight 

enable position snapping of object bottom right to grid

posBottom 

enable position snapping of object bottom to grid

posBottomLeft 

enable position snapping of object bottom left to grid

posLeft 

enable position snapping of object left to grid

posLineTop 

enable position snapping of object top line to grid, if x axis parallel to main axis

posLineHCenter 

enable position snapping of object h-center line to grid, if x axis parallel to main axis

posLineBottom 

enable position snapping of object bottom line to grid, if x axis parallel to main axis

posLineLeft 

enable position snapping of object left line to grid, if y axis parallel to main axis

posLineVCenter 

enable position snapping of object v-center line to grid, if y axis parallel to main axis

posLineRight 

enable position snapping of object right line to grid, if y axis parallel to main axis

posOther 

enable position snapping of object other points to grid (e.g. triangle corner)

posSngl 

enable restriction of single points (e.g. of polylines)

posEqual 

used internally

posNone 

disable all posizion restriction modes

pos6L 

enable all 6 line snapping modes

pos1P 

enable center point snapping modes

pos2P 

enable center + top left point snapping modes

pos3P 

enable center + top left + bottom right point snapping modes

pos5P 

enable all center + 4 corner point snapping modes

pos9P 

enable all 9 point snapping modes

posAny 

enable all position restriction modes, except other point modes

pos1P6L 

enable center point and all 6 line snapping modes

Definition at line 593 of file restrict.h.

Rotation/Slanting snap modes/flags.

Enumerator
rotVectorAngleX 

enable angle snapping for rotation of first coordinate vektor

rotVectorRationalX 

enable rational snapping for rotations of first coordinate vektor

rotVectorAngleY 

enable angle snapping for rotations of second coordinate vektor

rotVectorRationalY 

enable rational snapping for rotations of second coordinate vektor

rotPureRotations 

allow only pure rotations, no slanting

rotPureSlanting 

allow only pure one axis slanting

rotEndpointAngle 

enable snapping of arc endpoint angles

rotEndpointRational 

enable snapping of arc endpoint angles (rational)

rotEndpointUntrans 

enable snapping of arc ednpoints in untransformed coordinate system

rotNone 

disable all rotation restriction modes

Definition at line 652 of file restrict.h.

Size snap modes/flags (once for x and y)

Enumerator
sizeLength 

enable size snapping of transformed axis vector length

sizeProject 

enable snapping of projection of transformed axis vector length to orthogonal of other axis vector

sizeMajor 

enable size snapping of transformed axis major component

sizeAxis 

enable size snapping of projection to untronsformed axis

sizePos 

snap size by snapping individual points

sizeMin 

enable minimum size restriction

sizeMax 

enable maximum size restriction

sizeEqual 

used internally

sizeNone 

disable all size restriction modes

sizeAny 

enable all size restriction modes

Definition at line 636 of file restrict.h.

Flags for what to touch during a restriction.

Enumerator
snapPosX 

perform x position snapping

snapPosY 

perform y position snapping

snapSizeX 

perform x size snapping

snapSizeY 

perform y size snapping

snapRot 

perform rotation snapping

snapSkew 

perform skew snapping

snapWH 

during size snapping, change w/h rather than transform

snapEndAngle 

snap angle of endpoints or arcs

snapStart 

snap start point of line

snapEnd 

snap end point of line

snapPointI 

snap point i of polygon (ored with i, other flags are invalid)

Definition at line 675 of file restrict.h.

Member Function Documentation

void a2dRestrictionEngineOld::RestrictAffine ( a2dAffineMatrix mNew,
const a2dAffineMatrix mOld,
ESnapWhat  snapWhat,
SnapObjectInfo info,
double *  w = 0,
double *  h = 0 
)

Restrict an affine transformation.

Parameters
mNewthe edited tranformation matrix, that will be restricted
mOldthe tranformation matrix as it was prior to editing
snapWhatenable various snapping options
infosnapping info
wif (snapWhat & snapWH) the w parameter reflects the width, rather than the matrix
hif (snapWhat & snapWH) the h parameter reflects the height, rather than the matrix

Definition at line 844 of file restrict.cpp.

void a2dRestrictionEngineOld::RestrictEndpointAngle ( double *  angle,
const a2dAffineMatrix matrix,
ESnapWhat  snapWhat 
)

Restrict a starting /ending angle of e.g. an elliptic arc The angle is in degrees The matrix is required for e.g. untransformed snapping

Definition at line 1509 of file restrict.cpp.


The documentation for this class was generated from the following files:
a2dRestrictionEngineOld Class Reference -- Sun Oct 12 2014 17:04:48 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation