40 #pragma warning(disable: 4660)
46 #pragma warning(default: 4660)
60 if ( firstc->
GetPosX() < secondc->GetPosX() )
62 if ( firstc->
GetPosX() == secondc->GetPosX() )
63 if ( firstc->
GetPosY() < secondc->GetPosY() )
73 if ( firstc->
GetPosX() < secondc->GetPosX() )
75 if ( firstc->
GetPosX() == secondc->GetPosX() )
76 if ( firstc->
GetPosY() > secondc->GetPosY() )
86 if ( firstc->
GetPosY() < secondc->GetPosY() )
88 if ( firstc->
GetPosY() == secondc->GetPosY() )
89 if ( firstc->
GetPosX() < secondc->GetPosX() )
99 if ( firstc->
GetPosY() < secondc->GetPosY() )
101 if ( firstc->
GetPosY() == secondc->GetPosY() )
102 if ( firstc->
GetPosX() > secondc->GetPosX() )
111 a2dCanvasObjectList::a2dCanvasObjectList()
115 a2dCanvasObjectList::~a2dCanvasObjectList()
121 s_a2dCanvasObjectSorter = &XYSorter;
127 s_a2dCanvasObjectSorter = &XRevYSorter;
133 s_a2dCanvasObjectSorter = &YXSorter;
139 s_a2dCanvasObjectSorter = &YRevXSorter;
145 a2dCanvasObjectList::iterator iter = begin();
146 while( iter != end() )
148 a2dCanvasObjectList::value_type obj = *iter;
149 if ( obj && obj->GetOwnedBy() > 2 )
151 *iter = obj->TClone( a2dObject::clone_deep );
159 wxASSERT(
this != wxNullCanvasObjectList );
161 if ( &other == wxNullCanvasObjectList )
165 for( a2dCanvasObjectList::const_iterator iter = other.begin(); iter != other.end(); ++iter )
175 if (
this == wxNullCanvasObjectList )
180 for( a2dCanvasObjectList::const_iterator iter = begin(); iter != end(); ++iter )
186 a->push_back( objnew );
197 if (
this == wxNullCanvasObjectList )
204 for( a2dCanvasObjectList::const_iterator iter = begin(); iter != end(); ++iter )
206 a2dCanvasObjectList::value_type obj = *iter;
207 if ( !obj->GetRelease() && obj->CheckMask( mask ) )
213 tmp.
Expand( obj->GetMappedBbox( tworld ) );
219 if ( options & a2dObject::clone_deep )
222 a->push_back( objnew );
227 objectsIndex->push_back( index );
231 if ( !obj->GetRelease() )
240 if (
this == wxNullCanvasObjectList )
246 for( a2dCanvasObjectList::const_iterator iter = begin(); iter != end(); ++iter )
248 a2dCanvasObjectList::value_type obj = *iter;
249 if ( !obj->GetRelease() && obj->GetCheck() )
251 if ( options & a2dObject::clone_deep )
254 a->push_back( objnew );
259 objectsIndex->push_back( index );
261 if ( !obj->GetRelease() )
279 for( a2dCanvasObjectList::iterator iter = begin(); iter != end(); ++iter )
309 a2dCanvasObjectList::iterator iter = begin();
310 while( iter != end() )
312 a2dCanvasObjectList::value_type obj = *iter;
314 ( classname.IsEmpty() || obj->GetClassInfo()->GetClassName() == classname ) &&
315 ( !
id || obj->HasProperty(
id ) ) &&
316 ( name.IsEmpty() || obj->GetName() == name ) &&
317 ( obj->CheckMask( mask ) )
323 iter = erase( iter );
327 obj->SetRelease(
true );
328 obj->SetPending(
true );
344 a2dCanvasObjectList::reverse_iterator iter = rbegin();
345 while( iter != rend() )
348 if ( obj &&
object == obj && ( !
id || obj->
HasProperty(
id ) ) )
352 iterator it( iter.base() ) ;
375 a2dCanvasObjectList::iterator iter = begin();
376 while( iter != end() )
380 if ( obj &&
object == obj && ( !
id || obj->
HasProperty(
id ) ) )
384 iter = erase( iter );
412 a2dCanvasObjectList::iterator iter = begin();
413 while( iter != end() )
415 a2dCanvasObjectList::value_type obj = *iter;
418 if ( obj && obj->CheckMask( mask ) )
442 for( a2dCanvasObjectList::iterator iter = begin(); iter != end(); ++iter )
466 a2dCanvasObjectList::iterator iter = begin();
467 while( iter != end() )
469 a2dCanvasObjectList::value_type obj = *iter;
472 if ( obj && obj->CheckMask( mask ) )
475 obj->SetCheck(
true );
476 toTop.push_back( obj );
478 iter = erase( iter );
479 obj->SetPending(
true );
484 iter = toTop.begin();
485 while( iter != toTop.end() )
487 a2dCanvasObjectList::value_type obj = *iter;
497 a2dCanvasObjectList::iterator iter = begin();
498 while( iter != end() )
500 a2dCanvasObjectList::value_type obj = *iter;
503 if ( obj && obj->CheckMask( mask ) )
506 obj->SetCheck(
true );
508 iter = erase( iter );
509 insert( begin(), obj );
510 obj->SetPending(
true );
520 const wxString& classname,
526 for( a2dCanvasObjectList::iterator iter = begin(); iter != end(); ++iter )
530 ( classname.IsEmpty() || obj->GetClassInfo()->GetClassName() == classname ) &&
557 for( const_iterator iter = begin(); iter != end(); ++iter )
560 if ( cobj && obj == cobj )
571 for( const_iterator iter = begin(); iter != end(); ++iter )
576 ( objectname.IsEmpty() || objectname.Matches( cobj->
GetName() ) ) &&
577 ( classname.IsEmpty() || cobj->GetClassInfo()->GetClassName() == classname ) &&
579 ( !propid || cobj->
HasProperty( propid, valueAsString ) ) &&
592 for( a2dCanvasObjectList::iterator iter = begin(); iter != end(); ++iter )
596 if ( cobj && cobj->
GetName() == objectname )
611 for( a2dCanvasObjectList::iterator iter = begin(); iter != end(); ++iter )
629 for( a2dCanvasObjectList::iterator iter = begin(); iter != end(); ++iter )
634 ( type.IsEmpty() || cobj->GetClassInfo()->GetClassName() == type ) &&
648 for( a2dCanvasObjectList::iterator iter = begin(); iter != end(); ++iter )
653 ( type.IsEmpty() || cobj->GetClassInfo()->GetClassName() == type ) &&
671 for( a2dCanvasObjectList::iterator iter = begin(); iter != end(); ++iter )
678 if ( ( type.IsEmpty() || cobj->GetClassInfo()->GetClassName() == type ) &&
683 if ( total && total != wxNullCanvasObjectList )
684 total->push_back( cobj );
697 a2dCanvasObjectList::iterator iter = begin();
698 while( iter != end() )
700 a2dCanvasObjectList::value_type cobj = *iter;
703 ( type.IsEmpty() || cobj->GetClassInfo()->GetClassName() == type ) &&
704 ( !
id || cobj->HasProperty(
id ) ) &&
705 ( cobj->CheckMask( mask ) )
708 if ( total && total != wxNullCanvasObjectList )
710 iter = erase( iter );
711 total->push_back( cobj );
726 return total->
TakeOverTo(
this, type, mask,
id );
732 for( a2dCanvasObjectList::iterator iter = begin(); iter != end(); ++iter )
734 for( a2dCanvasObjectList::iterator iter2 = iter; ( ++iter2 ) != end(); )
736 wxASSERT( *iter != *iter2 );
744 a2dCanvasObjectList::iterator iter = begin();
746 if ( !ignoreReleased && before > size() )
751 for( i = 0; i < before; i++ )
766 a2dCorridor::a2dCorridor()
770 a2dCorridor::~a2dCorridor()
774 a2dCorridor::a2dCorridor(
const a2dIterC& ic )
776 if ( ic.m_contextList.size() )
778 m_relativetransform = ic.m_contextList.back()->GetTransform();
779 m_inverseRelativetransform = ic.m_contextList.back()->GetInverseTransform();
795 findcorridor.SetSkipNotRenderedInDrawing(
true );
797 if( findcorridor.
m_found.size() )
806 for( a2dCanvasObjectList::iterator iter = begin(); iter != end(); ++iter )
815 m_inverseRelativetransform = m_relativetransform;
816 m_inverseRelativetransform.
Invert();
825 for( a2dCanvasObjectList::iterator iter = begin(); iter != end(); ++iter )
834 m_inverseRelativetransform = m_relativetransform;
835 m_inverseRelativetransform.
Invert();
Display Part of a a2dDrawing, in which a2dCanvasObjects are shown.
int Copy(double x, double y, a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL, long target=-1, bool check=false)
copy only in this group object with the same mask
bool ChangeLayer(wxUint16 layer, a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL)
move only in this group objects with the given mask to the layer given
bool SetSpecificFlags(bool setOrClear, a2dCanvasObjectFlagsMask which, const wxString &classname=wxT(""), a2dCanvasObjectFlagsMask whichobjects=a2dCanvasOFlags::ALL, const a2dBoundingBox &bbox=wxNonValidBbox, const a2dAffineMatrix &tworld=a2dIDENTITY_MATRIX)
set all given bit flags at once recursive for all objects in given boundingbox
Base class for all types of strokes, understood by a2dDrawer2D classes.
void SetRoot(a2dDrawing *root, bool recurse=true)
Sets this object to a a2dCanvasDocument.
void SortYX()
sort in Y and is same also X
virtual bool HasProperty(const a2dPropertyId *id, const wxString &stringvalue=wxEmptyString) const
Check if the object has a property with given id and string representation.
void Push(a2dCanvasObject *object)
push object onto existing corridor
virtual wxString GetName() const
Returns the name of this object, if no name is given the internal id will be returned.
const a2dAffineMatrix & GetTransformMatrix() const
get the matrix used to position the object
void SetRelease(bool value)
set release flag
class to map references to objects stored in XML, in order to make the connection later on...
OVERLAP Intersect(const a2dBoundingBox &, double Marge=0) const
void SortXRevY()
sort in X and is same also in reverse Y
void SetTransformMatrix(const a2dAffineMatrix &mat=a2dIDENTITY_MATRIX)
Returns the matrix used to position the object.
a2dDrawing * GetRoot() const
get a2dCanvasDocument of the object.
a2dCanvasObject * GetCaptured() const
are events redirected to a captured corridor? if so return the captured object in it...
bool SwitchObjectNamed(const wxString &objectname, a2dCanvasObject *newobject)
If object with the given name is found, it is switched to newobject.
if set, clone childs, otherwise ref-copy them
virtual void SetPending(bool pending)
set this object pending for update
basic list class based on STL containers.
a2dCanvasObject is the base class for Canvas Objects.
a2dCanvasObjectList m_found
objects found
void SortYRevX()
sort in Y and is same also in reverse X
a2dCanvasObjectList & operator=(const a2dCanvasObjectList &other)
this only copies pointer stored in the list.
a2dCanvasObject * GetObject()
Get the current object.
int BringToTop(a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL, bool check=false)
move only in this group objects with the given mask to the back of the list drawn last ...
wxUint64 a2dCanvasObjectFlagsMask
mask flags for a2dCanvasObject
void Transform(const a2dAffineMatrix &tworld, const wxString &type=wxT(""), a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL, const a2dPropertyId *id=NULL)
Transform objects fitting the given filter.
collect a2dCanvasObject's in a hierarchy of a a2dCanvasDocument
a2dCanvasObjectList * wxNullCanvasObjectList
define a NON a2dCanvasObjectList
int TakeOverTo(a2dCanvasObjectList *total, const wxString &type=wxT(""), a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL, const a2dPropertyId *id=NULL)
Move objects fitting the given filter to the total list.
bool GetValid() const
returns true if boundingbox is calculated properly and therefore its valid flag is set...
void Expand(const a2dPoint2D &, const a2dPoint2D &)
expand boundingbox width two points
void Transform(const a2dAffineMatrix &tworld)
transform the object using the given matrix
#define forEachIn(listtype, list)
easy iteration for a2dlist
double GetPosX() const
get x position from affine matrix
void Insert(size_t before, a2dCanvasObject *obj, bool ignoreReleased)
insert at index, taking into account released objects if needed.
#define wxStaticCast(obj, className)
The wxWindows 2.4.2 wxStaticCast is buggy. It evaluates its argument twice.
a2dCanvasObject * GetShowObject() const
return pointer of then currently shown object on the drawer.
void SetSpecificFlags(bool setOrClear, a2dCanvasObjectFlagsMask which)
set all bit flags in object that or true in mask to true or false
void Translate(double x, double y)
relative translate the object to position x,y in world coordinates
int Release(a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL, const wxString &classname=wxT(""), const a2dPropertyId *id=NULL, const wxString &name=wxT(""), bool now=true)
release only objects with the given mask and classname and has property named propertyname and object...
int CollectObjects(a2dCanvasObjectList *total, const wxString &type=wxT(""), a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL, const a2dPropertyId *id=NULL, const a2dBoundingBox &bbox=wxNonValidBbox)
Copy objects fitting the given filter to the total list.
bool CheckMask(a2dCanvasObjectFlagsMask mask) const
Compares all flags in object to the given mask and return true is the same.
static const a2dCanvasObjectFlagsMask IsOnCorridorPath
void SortXY()
sort in X and is same also Y
void SetCheck(bool check)
general flag use at will.
A 2x3 affine matrix class for 2D transformations.
void MakeUnique()
all with reference count > 1 are cloned.
basic list class based on STL containers.
double GetPosY() const
get y position from affine matrix
while iterating a a2dCanvasDocument, this holds the context.
bool Start(a2dCanvasObject *object)
int Move(double x, double y, a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL, long target=-1, bool check=false)
move only in this group object with the same mask
a2dWalker based algorithms
a2dBoundingBox GetMappedBbox(a2dIterC &ic, bool withExtend=true)
first translate boundingbox with cworld and recalculate at new position
void SetStroke(const wxColour &strokecolor, double width=0, a2dStrokeStyle style=a2dSTROKE_SOLID)
Set a stroke for the object which will be used instead of the layer stroke.
int TakeOverFrom(a2dCanvasObjectList *total, const wxString &type=wxT(""), a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL, const a2dPropertyId *id=NULL)
Move objects fitting the given filter from the total list to this list.
bool GetRelease() const
get release flag
This is the base class for all kinds of property id's for a2dObject.
a2dCanvasObjectList * CloneChecked(a2dObject::CloneOptions options=a2dObject::clone_deep, a2dlist< long > *objectsIndex=NULL) const
clone to new list only objects with check flag set
a2dCanvasObject * Find(a2dCanvasObject *obj) const
return the object if it is part of the list
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
bool Invert(void)
Invert matrix.
void AssertUnique()
Check if all objects are only once in the list.
a2dCanvasObjectList * Clone(a2dObject::CloneOptions options) const
Clone everything ( Clones objects also) in a new created list.
bool SetDrawerStyle(const a2dFill &brush, const a2dStroke &stroke, a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL)
set only in this list fill and stroke of objects with the given mask
the a2dDrawingPart is a a2dView specially designed for displaying parts of a a2dDrawing. It uses a a2dDrawer2D to actually redraw things from the document, by giving that a2dDrawer2D as drawing context to the document, and telling the document to redraw a certain rectangular area. At that last is what this class is for. It optimizes the areas to be redrawn after object in the document were changed. To do that it combines redraw areas to a minimal set of redrawing areas. All the administration for this and the way things will be redrawn is from this view.
a2dDrawingPart * GetDrawingPart() const
get current a2dDrawingPart
virtual void SetLayer(wxUint16 layer)
set layer index where this object is drawn upon.
void SetTransform(const a2dAffineMatrix &tworld, const wxString &type=wxT(""), a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL, const a2dPropertyId *id=NULL)
Transform objects fitting the given filter.
int BringToBack(a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL, bool check=false)
move only in this group objects with the given mask to the front of the list drawn first ...
virtual bool LinkReferences(bool ignoreNonResolved=false)
link references to their destination
CloneOptions
options for cloning
a2dBoundingBox & GetBbox()
get boundingbox in world coordinates exclusive stroke width relative to its parent ...
void SetFill(const a2dFill &fill)
Set a fill for the object which will be used instead of the layer fill.
wxInt64 GetUniqueSerializationId() const
return a unique id for this object
general canvas module declarations and classes