wxArt2D
objlist.cpp
Go to the documentation of this file.
1 /*! \file canvas/src/objlist.cpp
2  \author Klaas Holwerda
3 
4  Copyright: 2001-2004 (c) Klaas Holwerda
5 
6  Licence: wxWidgets Licence
7 
8  RCS-ID: $Id: objlist.cpp,v 1.88 2009/05/20 18:42:10 titato Exp $
9 */
10 
11 #include "a2dprec.h"
12 
13 #ifdef __BORLANDC__
14 #pragma hdrstop
15 #endif
16 
17 #ifndef WX_PRECOMP
18 #include "wx/wx.h"
19 #endif
20 
21 #include "wx/canvas/objlist.h"
22 #include "wx/canvas/drawer.h"
23 #include "wx/canvas/canglob.h"
24 #include "wx/canvas/algos.h"
25 #include "wx/general/smrtptr.inl"
26 
27 #include "wx/general/a2dlist.h"
28 #include "wx/general/a2dlist.inl"
29 
30 #include <math.h>
31 #include <algorithm>
32 
33 //----------------------------------------------------------------------------
34 // template instanitiations
35 //----------------------------------------------------------------------------
36 
37 // MSVC warning 4660 is quite stupid. It says that the template is already instantiated
38 // by using it, but it is not fully instantiated as required for a library
39 #ifdef _MSC_VER
40 #pragma warning(disable: 4660)
41 #endif
42 
43 template class a2dSmrtPtrList<a2dCanvasObject>;
44 
45 #ifdef _MSC_VER
46 #pragma warning(default: 4660)
47 #endif
48 
49 //----------------------------------------------------------------------------
50 // globals
51 //----------------------------------------------------------------------------
52 
54 
55 bool XYSorter( const a2dCanvasObjectPtr& x, const a2dCanvasObjectPtr& y )
56 {
57  a2dCanvasObject* firstc = wxStaticCast( x.Get(), a2dCanvasObject );
58  a2dCanvasObject* secondc = wxStaticCast( y.Get(), a2dCanvasObject );
59 
60  if ( firstc->GetPosX() < secondc->GetPosX() )
61  return true;
62  if ( firstc->GetPosX() == secondc->GetPosX() )
63  if ( firstc->GetPosY() < secondc->GetPosY() )
64  return true;
65  return false;
66 }
67 
68 bool XRevYSorter( const a2dCanvasObjectPtr& x, const a2dCanvasObjectPtr& y )
69 {
70  a2dCanvasObject* firstc = wxStaticCast( x.Get(), a2dCanvasObject );
71  a2dCanvasObject* secondc = wxStaticCast( y.Get(), a2dCanvasObject );
72 
73  if ( firstc->GetPosX() < secondc->GetPosX() )
74  return true;
75  if ( firstc->GetPosX() == secondc->GetPosX() )
76  if ( firstc->GetPosY() > secondc->GetPosY() )
77  return true;
78  return false;
79 }
80 
81 bool YXSorter( const a2dCanvasObjectPtr& x, const a2dCanvasObjectPtr& y )
82 {
83  a2dCanvasObject* firstc = wxStaticCast( x.Get(), a2dCanvasObject );
84  a2dCanvasObject* secondc = wxStaticCast( y.Get(), a2dCanvasObject );
85 
86  if ( firstc->GetPosY() < secondc->GetPosY() )
87  return true;
88  if ( firstc->GetPosY() == secondc->GetPosY() )
89  if ( firstc->GetPosX() < secondc->GetPosX() )
90  return true;
91  return false;
92 }
93 
94 bool YRevXSorter( const a2dCanvasObjectPtr& x, const a2dCanvasObjectPtr& y )
95 {
96  a2dCanvasObject* firstc = wxStaticCast( x.Get(), a2dCanvasObject );
97  a2dCanvasObject* secondc = wxStaticCast( y.Get(), a2dCanvasObject );
98 
99  if ( firstc->GetPosY() < secondc->GetPosY() )
100  return true;
101  if ( firstc->GetPosY() == secondc->GetPosY() )
102  if ( firstc->GetPosX() > secondc->GetPosX() )
103  return true;
104  return false;
105 }
106 
107 //----------------------------------------------------------------------------
108 // a2dCanvasObjectList
109 //----------------------------------------------------------------------------
110 
111 a2dCanvasObjectList::a2dCanvasObjectList()
112 {
113 }
114 
115 a2dCanvasObjectList::~a2dCanvasObjectList()
116 {
117 }
118 
120 {
121  s_a2dCanvasObjectSorter = &XYSorter;
122  sort();
123 }
124 
126 {
127  s_a2dCanvasObjectSorter = &XRevYSorter;
128  sort();
129 }
130 
132 {
133  s_a2dCanvasObjectSorter = &YXSorter;
134  sort();
135 }
136 
138 {
139  s_a2dCanvasObjectSorter = &YRevXSorter;
140  sort();
141 }
142 
144 {
145  a2dCanvasObjectList::iterator iter = begin();
146  while( iter != end() )
147  {
148  a2dCanvasObjectList::value_type obj = *iter;
149  if ( obj && obj->GetOwnedBy() > 2 )
150  {
151  *iter = obj->TClone( a2dObject::clone_deep );
152  }
153  iter++;
154  }
155 }
156 
158 {
159  wxASSERT( this != wxNullCanvasObjectList );
160 
161  if ( &other == wxNullCanvasObjectList )
162  return *this;
163 
164  clear();
165  for( a2dCanvasObjectList::const_iterator iter = other.begin(); iter != other.end(); ++iter )
166  {
167  a2dCanvasObject* obj = *iter;
168  push_back( obj );
169  }
170  return *this;
171 }
172 
174 {
175  if ( this == wxNullCanvasObjectList )
176  return wxNullCanvasObjectList;
177 
179 
180  for( a2dCanvasObjectList::const_iterator iter = begin(); iter != end(); ++iter )
181  {
182  a2dCanvasObject* obj = *iter;
183  if ( obj && options & a2dObject::clone_childs )
184  {
185  a2dCanvasObject* objnew = obj->TClone( options );
186  a->push_back( objnew );
187  }
188  else
189  a->push_back( obj );
190  }
191 
192  return a;
193 }
194 
196 {
197  if ( this == wxNullCanvasObjectList )
198  return wxNullCanvasObjectList;
199 
201  a2dAffineMatrix tworld;
202 
203  int index = 0;
204  for( a2dCanvasObjectList::const_iterator iter = begin(); iter != end(); ++iter )
205  {
206  a2dCanvasObjectList::value_type obj = *iter;
207  if ( !obj->GetRelease() && obj->CheckMask( mask ) )
208  {
209  bool pass = true;
210  if ( bbox.GetValid() )
211  {
212  a2dBoundingBox tmp;
213  tmp.Expand( obj->GetMappedBbox( tworld ) );
214  if ( bbox.Intersect( tmp ) != _IN )
215  pass = false;
216  }
217  if ( pass )
218  {
219  if ( options & a2dObject::clone_deep )
220  {
221  a2dCanvasObject* objnew = obj->TClone( options );
222  a->push_back( objnew );
223  }
224  else
225  a->push_back( obj );
226  if ( objectsIndex )
227  objectsIndex->push_back( index );
228  }
229 
230  }
231  if ( !obj->GetRelease() )
232  index++;
233  }
234 
235  return a;
236 }
237 
239 {
240  if ( this == wxNullCanvasObjectList )
241  return wxNullCanvasObjectList;
242 
244 
245  int index = 0;
246  for( a2dCanvasObjectList::const_iterator iter = begin(); iter != end(); ++iter )
247  {
248  a2dCanvasObjectList::value_type obj = *iter;
249  if ( !obj->GetRelease() && obj->GetCheck() )
250  {
251  if ( options & a2dObject::clone_deep )
252  {
253  a2dCanvasObject* objnew = obj->TClone( options );
254  a->push_back( objnew );
255  }
256  else
257  a->push_back( obj );
258  if ( objectsIndex )
259  objectsIndex->push_back( index );
260  }
261  if ( !obj->GetRelease() )
262  index++;
263  }
264 
265  return a;
266 }
267 
269 {
270  /*
271  a2dCanvasObjectIter myiter = Begin();
272  while( myiter != End() )
273  {
274  a2dCanvasObjectList::value_type obj = *myiter;
275  myiter++;
276  }
277  */
278  bool did = false;
279  for( a2dCanvasObjectList::iterator iter = begin(); iter != end(); ++iter )
280  {
281  a2dCanvasObject* obj = *iter;
282  if ( obj && obj->CheckMask( mask ) )
283  {
284  did = true;
285  obj->SetLayer( layer );
286  }
287  }
288 
289  return did;
290 }
291 
292 a2dBoundingBox a2dCanvasObjectList::GetBBox( a2dCanvasObjectFlagsMask mask )
293 {
294  a2dBoundingBox bbox;
295 
297  {
298  a2dCanvasObject* obj = *iter;
299  if ( obj->GetRelease() || !obj->CheckMask( mask ) )
300  continue;
301  bbox.Expand( obj->GetBbox() );
302  }
303  return bbox;
304 }
305 
306 int a2dCanvasObjectList::Release( a2dCanvasObjectFlagsMask mask, const wxString& classname, const a2dPropertyId* id, const wxString& name, bool now )
307 {
308  int did = 0;
309  a2dCanvasObjectList::iterator iter = begin();
310  while( iter != end() )
311  {
312  a2dCanvasObjectList::value_type obj = *iter;
313  if ( obj &&
314  ( classname.IsEmpty() || obj->GetClassInfo()->GetClassName() == classname ) &&
315  ( !id || obj->HasProperty( id ) ) &&
316  ( name.IsEmpty() || obj->GetName() == name ) &&
317  ( obj->CheckMask( mask ) )
318  )
319  {
320  did++;
321  if ( now )
322  {
323  iter = erase( iter );
324  }
325  else
326  {
327  obj->SetRelease( true );
328  obj->SetPending( true );
329  iter++;
330  }
331  }
332  else
333  iter++;
334  }
335 
336  return did;
337 }
338 
339 int a2dCanvasObjectList::Release( a2dCanvasObject* object, bool backwards, bool all, bool now, const a2dPropertyId* id )
340 {
341  int did = 0;
342  if ( backwards )
343  {
344  a2dCanvasObjectList::reverse_iterator iter = rbegin();
345  while( iter != rend() )
346  {
347  a2dCanvasObject* obj = *iter;
348  if ( obj && object == obj && ( !id || obj->HasProperty( id ) ) )
349  {
350  if ( now )
351  {
352  iterator it( iter.base() ) ;
353  -- it ;
354  erase( it ) ;
355  iter++;
356  //erase((++iter).base());
357  }
358  else
359  {
360  obj->SetRelease( true );
361  obj->SetPending( true );
362  iter++;
363  }
364  did++;
365 
366  if ( !all )
367  break;
368  }
369  else
370  iter++;
371  }
372  }
373  else
374  {
375  a2dCanvasObjectList::iterator iter = begin();
376  while( iter != end() )
377  {
378  a2dCanvasObject* obj = *iter;
379 
380  if ( obj && object == obj && ( !id || obj->HasProperty( id ) ) )
381  {
382  if ( now )
383  {
384  iter = erase( iter );
385  }
386  else
387  {
388  obj->SetRelease( true );
389  obj->SetPending( true );
390  iter++;
391  }
392  did++;
393 
394  if ( !all )
395  break;
396 
397  }
398  else
399  iter++;
400  }
401  }
402 
403  return did;
404 }
405 
406 int a2dCanvasObjectList::Copy( double x, double y, a2dCanvasObjectFlagsMask mask, long target, bool check )
407 {
408  int nr = 0;
409 
410  a2dRefMap refs;
411 
412  a2dCanvasObjectList::iterator iter = begin();
413  while( iter != end() )
414  {
415  a2dCanvasObjectList::value_type obj = *iter;
416  if ( obj && check )
417  obj->SetCheck( false );
418  if ( obj && obj->CheckMask( mask ) )
419  {
420  nr++;
421  a2dCanvasObject* objn = obj->TClone( a2dObject::clone_deep, &refs );
422  push_front( objn );
423  objn->Translate( x, y );
424  objn->SetPending( true );
425  objn->SetSpecificFlags( false, mask );
426  if ( check )
427  objn->SetCheck( true );
428  if ( target != -1 )
429  objn->SetLayer( target );
430  }
431  ++iter;
432  }
433 
434  refs.LinkReferences();
435  return nr;
436 }
437 
438 int a2dCanvasObjectList::Move( double x, double y, a2dCanvasObjectFlagsMask mask, long target, bool check )
439 {
440  int nr = 0;
441 
442  for( a2dCanvasObjectList::iterator iter = begin(); iter != end(); ++iter )
443  {
444  a2dCanvasObject* obj = *iter;
445  if ( obj && check )
446  obj->SetCheck( false );
447  if ( obj && obj->CheckMask( mask ) )
448  {
449  nr++;
450  obj->Translate( x, y );
451  if ( check )
452  obj->SetCheck( true );
453  if ( target != -1 )
454  obj->SetLayer( target );
455  }
456  }
457 
458  return nr;
459 }
460 
462 {
463  a2dCanvasObjectList toTop;
464 
465  int nr = 0;
466  a2dCanvasObjectList::iterator iter = begin();
467  while( iter != end() )
468  {
469  a2dCanvasObjectList::value_type obj = *iter;
470  if ( obj && check )
471  obj->SetCheck( false );
472  if ( obj && obj->CheckMask( mask ) )
473  {
474  if ( check )
475  obj->SetCheck( true );
476  toTop.push_back( obj );
477  nr++;
478  iter = erase( iter );
479  obj->SetPending( true );
480  }
481  else
482  iter++;
483  }
484  iter = toTop.begin();
485  while( iter != toTop.end() )
486  {
487  a2dCanvasObjectList::value_type obj = *iter;
488  push_back( obj );
489  iter++;
490  }
491  return nr;
492 }
493 
495 {
496  int nr = 0;
497  a2dCanvasObjectList::iterator iter = begin();
498  while( iter != end() )
499  {
500  a2dCanvasObjectList::value_type obj = *iter;
501  if ( obj && check )
502  obj->SetCheck( false );
503  if ( obj && obj->CheckMask( mask ) )
504  {
505  if ( check )
506  obj->SetCheck( true );
507  nr++;
508  iter = erase( iter );
509  insert( begin(), obj );
510  obj->SetPending( true );
511  }
512  else
513  iter++;
514  }
515 
516  return nr;
517 }
518 
520  const wxString& classname,
521  a2dCanvasObjectFlagsMask whichobjects,
522  const a2dBoundingBox& bbox,
523  const a2dAffineMatrix& tworld )
524 {
525  bool did = false;
526  for( a2dCanvasObjectList::iterator iter = begin(); iter != end(); ++iter )
527  {
528  a2dCanvasObject* obj = *iter;
529  if ( obj &&
530  ( classname.IsEmpty() || obj->GetClassInfo()->GetClassName() == classname ) &&
531  obj->CheckMask( whichobjects ) )
532  {
533  if ( bbox.GetValid() )
534  {
535  a2dBoundingBox tmp;
536  tmp.Expand( obj->GetMappedBbox( tworld ) );
537  if ( bbox.Intersect( tmp ) == _IN )
538  {
539  did = true;
540  obj->SetSpecificFlags( setOrClear, which );
541  }
542  }
543  else
544  {
545  did = true;
546  obj->SetSpecificFlags( setOrClear, which );
547  }
548  }
549  }
550  return did;
551 }
552 
554 {
555  a2dCanvasObject* cobj;
556 
557  for( const_iterator iter = begin(); iter != end(); ++iter )
558  {
559  cobj = *iter;
560  if ( cobj && obj == cobj )
561  return cobj;
562  }
563 
564  return ( a2dCanvasObject* ) NULL;
565 }
566 
567 a2dCanvasObject* a2dCanvasObjectList::Find( const wxString& objectname, const wxString& classname, a2dCanvasObjectFlagsMask mask, const a2dPropertyId* propid, const wxString& valueAsString, wxUint32 id ) const
568 {
569  a2dCanvasObject* cobj;
570 
571  for( const_iterator iter = begin(); iter != end(); ++iter )
572  {
573  cobj = *iter;
574 
575  if ( cobj &&
576  ( objectname.IsEmpty() || objectname.Matches( cobj->GetName() ) ) &&
577  ( classname.IsEmpty() || cobj->GetClassInfo()->GetClassName() == classname ) &&
578  ( id == 0 || cobj->GetUniqueSerializationId() == ( int )id ) &&
579  ( !propid || cobj->HasProperty( propid, valueAsString ) ) &&
580  ( cobj->CheckMask( mask ) )
581  )
582  return cobj;
583  }
584 
585  return ( a2dCanvasObject* ) NULL;
586 }
587 
588 bool a2dCanvasObjectList::SwitchObjectNamed( const wxString& objectname, a2dCanvasObject* newobject )
589 {
590  a2dCanvasObject* cobj;
591 
592  for( a2dCanvasObjectList::iterator iter = begin(); iter != end(); ++iter )
593  {
594  cobj = *iter;
595 
596  if ( cobj && cobj->GetName() == objectname )
597  {
598  newobject->SetRoot( cobj->GetRoot(), false );
599  *iter = newobject;
600  return true;
601  }
602  }
603 
604  return false;
605 }
606 
608 {
609  bool did = false;
610 
611  for( a2dCanvasObjectList::iterator iter = begin(); iter != end(); ++iter )
612  {
613  a2dCanvasObject* obj = *iter;
614  if ( obj && obj->CheckMask( mask ) )
615  {
616  did = true;
617  obj->SetFill( fill );
618  obj->SetStroke( stroke );
619  }
620  }
621 
622  return did;
623 }
624 
625 void a2dCanvasObjectList::Transform( const a2dAffineMatrix& tworld , const wxString& type, a2dCanvasObjectFlagsMask mask, const a2dPropertyId* id )
626 {
627  a2dCanvasObject* cobj;
628 
629  for( a2dCanvasObjectList::iterator iter = begin(); iter != end(); ++iter )
630  {
631  cobj = *iter;
632 
633  if ( cobj &&
634  ( type.IsEmpty() || cobj->GetClassInfo()->GetClassName() == type ) &&
635  ( !id || cobj->HasProperty( id ) ) &&
636  ( cobj->CheckMask( mask ) )
637  )
638  {
639  cobj->Transform( tworld );
640  }
641  }
642 }
643 
644 void a2dCanvasObjectList::SetTransform( const a2dAffineMatrix& tworld , const wxString& type, a2dCanvasObjectFlagsMask mask, const a2dPropertyId* id )
645 {
646  a2dCanvasObject* cobj;
647 
648  for( a2dCanvasObjectList::iterator iter = begin(); iter != end(); ++iter )
649  {
650  cobj = *iter;
651 
652  if ( cobj &&
653  ( type.IsEmpty() || cobj->GetClassInfo()->GetClassName() == type ) &&
654  ( !id || cobj->HasProperty( id ) ) &&
655  ( cobj->CheckMask( mask ) )
656  )
657  {
658  cobj->SetTransformMatrix( tworld );
659  }
660  }
661 }
662 
664  const a2dPropertyId* id,
665  const a2dBoundingBox& bbox
666  )
667 {
668  a2dCanvasObject* cobj;
669  int count = 0;
670 
671  for( a2dCanvasObjectList::iterator iter = begin(); iter != end(); ++iter )
672  {
673  cobj = *iter;
674 
675  if ( cobj &&
676  !bbox.GetValid() || bbox.Intersect( cobj->GetBbox() ) == _IN )
677  {
678  if ( ( type.IsEmpty() || cobj->GetClassInfo()->GetClassName() == type ) &&
679  ( !id || cobj->HasProperty( id ) ) &&
680  ( cobj->CheckMask( mask ) )
681  )
682  {
683  if ( total && total != wxNullCanvasObjectList )
684  total->push_back( cobj );
685  count++;
686  }
687  }
688  }
689 
690  return count;
691 }
692 
694 {
695  int count = 0;
696 
697  a2dCanvasObjectList::iterator iter = begin();
698  while( iter != end() )
699  {
700  a2dCanvasObjectList::value_type cobj = *iter;
701 
702  if ( cobj &&
703  ( type.IsEmpty() || cobj->GetClassInfo()->GetClassName() == type ) &&
704  ( !id || cobj->HasProperty( id ) ) &&
705  ( cobj->CheckMask( mask ) )
706  )
707  {
708  if ( total && total != wxNullCanvasObjectList )
709  {
710  iter = erase( iter );
711  total->push_back( cobj );
712  }
713  else
714  iter++;
715  count++;
716  }
717  else
718  iter++;
719  }
720 
721  return count;
722 }
723 
725 {
726  return total->TakeOverTo( this, type, mask, id );
727 }
728 
730 {
731 #ifdef _DEBUG
732  for( a2dCanvasObjectList::iterator iter = begin(); iter != end(); ++iter )
733  {
734  for( a2dCanvasObjectList::iterator iter2 = iter; ( ++iter2 ) != end(); )
735  {
736  wxASSERT( *iter != *iter2 );
737  }
738  }
739 #endif
740 }
741 
742 void a2dCanvasObjectList::Insert( size_t before, a2dCanvasObject* obj, bool ignoreReleased )
743 {
744  a2dCanvasObjectList::iterator iter = begin();
745 
746  if ( !ignoreReleased && before > size() )
747  push_back( obj );
748  else
749  {
750  size_t i;
751  for( i = 0; i < before; i++ )
752  {
753  a2dCanvasObject* obj = *iter;
754  if ( ignoreReleased && obj->GetRelease() )
755  i--;
756  iter++;
757  }
758  insert( iter, obj );
759  }
760  obj->SetPending( true );
761 }
762 
763 //----------------------------------------------------------------------------
764 // a2dCorridor
765 //----------------------------------------------------------------------------
766 a2dCorridor::a2dCorridor()
767 {
768 }
769 
770 a2dCorridor::~a2dCorridor()
771 {
772 }
773 
774 a2dCorridor::a2dCorridor( const a2dIterC& ic )
775 {
776  if ( ic.m_contextList.size() )
777  {
778  m_relativetransform = ic.m_contextList.back()->GetTransform();
779  m_inverseRelativetransform = ic.m_contextList.back()->GetInverseTransform();
780  }
781  for( a2dSmrtPtrList< a2dIterPP >::const_iterator iter = ic.m_contextList.begin(); iter != ic.m_contextList.end(); iter++ )
782  {
783  a2dIterPP* pp = *iter;
784  a2dCanvasObject* obj = pp->GetObject();
785  push_back( obj );
786  }
787  m_capture = ic.GetDrawingPart()->GetCaptured();
788 }
789 
790 a2dCorridor::a2dCorridor( const a2dDrawingPart& view )
791 {
793  if ( view.GetShowObject() )
794  {
795  findcorridor.SetSkipNotRenderedInDrawing( true );
796  findcorridor.Start( view.GetShowObject() );
797  if( findcorridor.m_found.size() )
798  {
799  this->TakeOverFrom( &findcorridor.m_found );
800  }
801  else
802  push_back( view.GetShowObject() );
803  }
804 
805  a2dCanvasObject* cobj;
806  for( a2dCanvasObjectList::iterator iter = begin(); iter != end(); ++iter )
807  {
808  cobj = *iter;
809  if ( cobj )
810  {
811  m_relativetransform *= cobj->GetTransformMatrix();
812  }
813  }
814 
815  m_inverseRelativetransform = m_relativetransform;
816  m_inverseRelativetransform.Invert();
817  m_capture = view.GetCaptured();
818 }
819 
821 {
822  push_back( object );
823 
824  a2dCanvasObject* cobj;
825  for( a2dCanvasObjectList::iterator iter = begin(); iter != end(); ++iter )
826  {
827  cobj = *iter;
828  if ( cobj )
829  {
830  m_relativetransform *= cobj->GetTransformMatrix();
831  }
832  }
833 
834  m_inverseRelativetransform = m_relativetransform;
835  m_inverseRelativetransform.Invert();
836 }
837 
Display Part of a a2dDrawing, in which a2dCanvasObjects are shown.
Definition: drawer.h:470
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
Definition: objlist.cpp:406
bool ChangeLayer(wxUint16 layer, a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL)
move only in this group objects with the given mask to the layer given
Definition: objlist.cpp:268
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
Definition: objlist.cpp:519
Base class for all types of strokes, understood by a2dDrawer2D classes.
Definition: stylebase.h:378
void SetRoot(a2dDrawing *root, bool recurse=true)
Sets this object to a a2dCanvasDocument.
Definition: canobj.cpp:5933
void SortYX()
sort in Y and is same also X
Definition: objlist.cpp:131
virtual bool HasProperty(const a2dPropertyId *id, const wxString &stringvalue=wxEmptyString) const
Check if the object has a property with given id and string representation.
Definition: gen.cpp:1621
void Push(a2dCanvasObject *object)
push object onto existing corridor
Definition: objlist.cpp:820
virtual wxString GetName() const
Returns the name of this object, if no name is given the internal id will be returned.
Definition: gen.cpp:1310
const a2dAffineMatrix & GetTransformMatrix() const
get the matrix used to position the object
Definition: canobj.h:500
void SetRelease(bool value)
set release flag
Definition: gen.h:1346
class to map references to objects stored in XML, in order to make the connection later on...
Definition: gen.h:3462
OVERLAP Intersect(const a2dBoundingBox &, double Marge=0) const
Definition: bbox.cpp:205
void SortXRevY()
sort in X and is same also in reverse Y
Definition: objlist.cpp:125
void SetTransformMatrix(const a2dAffineMatrix &mat=a2dIDENTITY_MATRIX)
Returns the matrix used to position the object.
Definition: canobj.h:509
a2dDrawing * GetRoot() const
get a2dCanvasDocument of the object.
Definition: canobj.h:952
a2dCanvasObject * GetCaptured() const
are events redirected to a captured corridor? if so return the captured object in it...
Definition: drawer.h:641
bool SwitchObjectNamed(const wxString &objectname, a2dCanvasObject *newobject)
If object with the given name is found, it is switched to newobject.
Definition: objlist.cpp:588
if set, clone childs, otherwise ref-copy them
Definition: gen.h:1207
virtual void SetPending(bool pending)
set this object pending for update
Definition: canobj.cpp:2585
basic list class based on STL containers.
see wx/general/smrtptr.h
a2dCanvasObject is the base class for Canvas Objects.
Definition: canobj.h:371
a2dCanvasObjectList m_found
objects found
Definition: algos.h:384
void SortYRevX()
sort in Y and is same also in reverse X
Definition: objlist.cpp:137
a2dCanvasObjectList & operator=(const a2dCanvasObjectList &other)
this only copies pointer stored in the list.
Definition: objlist.cpp:157
a2dCanvasObject * GetObject()
Get the current object.
Definition: canobj.h:3016
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 ...
Definition: objlist.cpp:461
wxUint64 a2dCanvasObjectFlagsMask
mask flags for a2dCanvasObject
Definition: candefs.h:152
void Transform(const a2dAffineMatrix &tworld, const wxString &type=wxT(""), a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL, const a2dPropertyId *id=NULL)
Transform objects fitting the given filter.
Definition: objlist.cpp:625
collect a2dCanvasObject&#39;s in a hierarchy of a a2dCanvasDocument
Definition: algos.h:363
a2dCanvasObjectList * wxNullCanvasObjectList
define a NON a2dCanvasObjectList
Definition: objlist.cpp:53
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.
Definition: objlist.cpp:693
bool GetValid() const
returns true if boundingbox is calculated properly and therefore its valid flag is set...
Definition: bbox.cpp:299
void Expand(const a2dPoint2D &, const a2dPoint2D &)
expand boundingbox width two points
Definition: bbox.cpp:155
void Transform(const a2dAffineMatrix &tworld)
transform the object using the given matrix
Definition: canobj.h:577
#define forEachIn(listtype, list)
easy iteration for a2dlist
Definition: a2dlist.h:111
double GetPosX() const
get x position from affine matrix
Definition: canobj.h:527
void Insert(size_t before, a2dCanvasObject *obj, bool ignoreReleased)
insert at index, taking into account released objects if needed.
Definition: objlist.cpp:742
Definition: bbox.h:26
#define wxStaticCast(obj, className)
The wxWindows 2.4.2 wxStaticCast is buggy. It evaluates its argument twice.
Definition: gen.h:123
a2dCanvasObject * GetShowObject() const
return pointer of then currently shown object on the drawer.
Definition: drawer.h:680
void SetSpecificFlags(bool setOrClear, a2dCanvasObjectFlagsMask which)
set all bit flags in object that or true in mask to true or false
Definition: canobj.cpp:2645
void Translate(double x, double y)
relative translate the object to position x,y in world coordinates
Definition: canobj.h:569
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...
Definition: objlist.cpp:306
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.
Definition: objlist.cpp:663
bool CheckMask(a2dCanvasObjectFlagsMask mask) const
Compares all flags in object to the given mask and return true is the same.
Definition: canobj.cpp:2665
static const a2dCanvasObjectFlagsMask IsOnCorridorPath
Definition: candefs.h:204
void SortXY()
sort in X and is same also Y
Definition: objlist.cpp:119
void SetCheck(bool check)
general flag use at will.
Definition: gen.h:1339
A 2x3 affine matrix class for 2D transformations.
Definition: afmatrix.h:53
void MakeUnique()
all with reference count &gt; 1 are cloned.
Definition: objlist.cpp:143
basic list class based on STL containers.
double GetPosY() const
get y position from affine matrix
Definition: canobj.h:530
while iterating a a2dCanvasDocument, this holds the context.
Definition: canobj.h:3212
bool Start(a2dCanvasObject *object)
Definition: algos.cpp:409
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
Definition: objlist.cpp:438
a2dWalker based algorithms
a2dBoundingBox GetMappedBbox(a2dIterC &ic, bool withExtend=true)
first translate boundingbox with cworld and recalculate at new position
Definition: canobj.cpp:3256
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.
Definition: canobj.cpp:2924
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.
Definition: objlist.cpp:724
bool GetRelease() const
get release flag
Definition: gen.h:1350
This is the base class for all kinds of property id&#39;s for a2dObject.
Definition: id.h:154
a2dCanvasObjectList * CloneChecked(a2dObject::CloneOptions options=a2dObject::clone_deep, a2dlist< long > *objectsIndex=NULL) const
clone to new list only objects with check flag set
Definition: objlist.cpp:238
list for a2dCanvasObject
a2dCanvasObject * Find(a2dCanvasObject *obj) const
return the object if it is part of the list
Definition: objlist.cpp:553
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
Definition: bbox.h:39
bool Invert(void)
Invert matrix.
Definition: afmatrix.cpp:197
void AssertUnique()
Check if all objects are only once in the list.
Definition: objlist.cpp:729
a2dCanvasObjectList * Clone(a2dObject::CloneOptions options) const
Clone everything ( Clones objects also) in a new created list.
Definition: objlist.cpp:173
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
Definition: objlist.cpp:607
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
Definition: canobj.cpp:631
virtual void SetLayer(wxUint16 layer)
set layer index where this object is drawn upon.
Definition: canobj.cpp:5920
void SetTransform(const a2dAffineMatrix &tworld, const wxString &type=wxT(""), a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL, const a2dPropertyId *id=NULL)
Transform objects fitting the given filter.
Definition: objlist.cpp:644
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 ...
Definition: objlist.cpp:494
virtual bool LinkReferences(bool ignoreNonResolved=false)
link references to their destination
Definition: gen.cpp:4862
CloneOptions
options for cloning
Definition: gen.h:1200
a2dBoundingBox & GetBbox()
get boundingbox in world coordinates exclusive stroke width relative to its parent ...
Definition: canobj.cpp:3175
void SetFill(const a2dFill &fill)
Set a fill for the object which will be used instead of the layer fill.
Definition: canobj.cpp:2874
wxInt64 GetUniqueSerializationId() const
return a unique id for this object
Definition: gen.cpp:1450
general canvas module declarations and classes
objlist.cpp Source File -- Sun Oct 12 2014 17:04:22 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation