wxArt2D
algos.h
Go to the documentation of this file.
1 /*! \file wx/canvas/algos.h
2  \brief a2dWalker based algorithms
3 
4  \author Klaas Holwerda
5 
6  Copyright: 2000-2004 (c) Klaas Holwerda
7 
8  Licence: wxWidgets Licence
9 
10  RCS-ID: $Id: algos.h,v 1.2 2009/09/03 20:09:53 titato Exp $
11 */
12 
13 #ifndef __WXALGOS_H__
14 #define __WXALGOS_H__
15 
16 #ifndef WX_PRECOMP
17 #include "wx/wx.h"
18 #endif
19 
20 #include <map>
21 #include <set>
22 
23 using namespace std;
24 
25 #include "wx/canvas/canglob.h"
26 #include "wx/canvas/candefs.h"
27 #include "wx/canvas/objlist.h"
28 #include "wx/canvas/xmlpars.h"
29 
30 //! Debug handler for output the hierarchy found in a a2dDocument
31 /*!
32 
33  \ingroup docalgo
34 */
35 class A2DCANVASDLLEXP a2dDumpWalker: public a2dWalkerIOHandler
36 {
37 public:
38 
39  a2dDumpWalker();
40 
41  ~a2dDumpWalker();
42 
43  void Initialize();
44 
45  //! Start traversing at object, returns true.
46  bool Start( a2dObject* object );
47 
48  //! called from within a2dCanvasDocument
49  bool WalkTask( wxObject* parent, wxObject* object, a2dWalkEvent event );
50 };
51 
52 //! perform a function on each a2dCanvasObject in the document
53 /*!
54 
55  \ingroup docalgo
56 */
57 class A2DCANVASDLLEXP a2dWalker_CallMemberFunc: public a2dWalkerIOHandler
58 {
59 public:
60 
62 
64 
65  typedef void ( a2dCanvasObject::*a2dCanvasObjectFunc ) ();
66 
67  //! object to start the algorithm
68  /*!
69  all object nested down here will have the function called.
70  */
71  bool Start( a2dObject* object, a2dCanvasObjectFunc func );
72 
73  //! called from within a2dCanvasDocument
74  bool WalkTask( wxObject* parent, wxObject* object, a2dWalkEvent event );
75 
76 
77  a2dCanvasObjectFunc m_func;
78 };
79 
80 //! perform a function on each a2dCanvasObject in the document
81 /*!
82 
83  \ingroup docalgo
84 */
85 class A2DCANVASDLLEXP a2dWalker_CallMemberFuncW: public a2dWalkerIOHandler
86 {
87 public:
88 
90 
92 
93  typedef void ( a2dCanvasObject::*a2dCanvasObjectFuncW ) ( a2dWalkerIOHandler* );
94 
95  //! object to start the algorithm
96  /*!
97  all object nested down here will have the function called.
98  return true
99  */
100  bool Start( a2dObject* object, a2dCanvasObjectFuncW func );
101 
102  //! called from within a2dCanvasDocument
103  bool WalkTask( wxObject* parent, wxObject* object, a2dWalkEvent event );
104 
105 
106  a2dCanvasObjectFuncW m_func;
107 };
108 
109 //! set layers available in a2dCanvasView as found in document
110 /*!
111 
112  \ingroup docalgo
113 */
114 class A2DCANVASDLLEXP a2dWalker_SetAvailable: public a2dWalkerIOHandler
115 {
116 public:
117 
118  a2dWalker_SetAvailable( a2dLayers* layerSetup );
119 
120  a2dWalker_SetAvailable( a2dDrawingPart* drawingPart );
121 
123 
124  //! object to start the algorithm
125  /*!
126  all object nested down here will be check on layers available
127  returns true
128  */
129  bool Start( a2dObject* object );
130 
131  //! called from within a2dCanvasDocument
132  bool WalkTask( wxObject* parent, wxObject* object, a2dWalkEvent event );
133 
134 protected:
135 
136  //! visible on this drawingPart
138 
139  //! availability set for this layer setup
141 };
142 
143 //! Remove from a2dObject in a hierarchy, certain properties.
144 /*!
145  Property Id's stored in a list, are searched for in the hierarchy of a document.
146  a2dObject::Walker() etc. is used to walk through the hierarchy.
147  Every a2dObject passed, is inspected for containing one of the the properties of the list.
148  The found properties will be removed.
149 
150  \ingroup docalgo
151 */
152 class A2DCANVASDLLEXP a2dWalker_RemoveProperty: public a2dWalkerIOHandler
153 {
154 public:
155 
156  //! constructor with no a2dPropertyId added yet. For that use AddPropertyId()
157  a2dWalker_RemoveProperty( bool all = true );
158 
159  //! constructor with a2dPropertyId added to the propertyIsList to search for.
160  a2dWalker_RemoveProperty( a2dPropertyId* id , bool all = true );
161 
162  //! constructor with the propertyIdList to search for as input
163  a2dWalker_RemoveProperty( const a2dPropertyIdList& idList , bool all = true );
164 
166 
167  //! add a a2dPropertyId to the list
168  void AddPropertyId( a2dPropertyId* id );
169 
170  //! start removing properties from the object given, and down.
171  //! returns true if some property was removed.
172  bool Start( a2dObject* object );
173 
174  //! called from within a2dCanvasDocument
175  virtual bool WalkTask( wxObject* parent, wxObject* object, a2dWalkEvent event );
176 
177  //! to remove all or only one property on each object found.
178  bool m_all;
179 
180  //! properties to search for
182 };
183 
184 //! Remove from property in a hierarchy of a canvas document.
185 /*!
186  \ingroup docalgo
187 */
189 {
190 public:
191 
192  //! constructor with no a2dPropertyId added yet. For that use AddPropertyId()
194 
195  //! constructor with a2dPropertyId added to the propertyIsList to search for.
197 
198  //! constructor with the propertyIdList to search for as input
200 
202 
203  //! add a a2dPropertyId to the list
204  void AddPropertyId( a2dPropertyId* id );
205 
206  //! start removing properties from the object given, and down.
207  //! returns true if some property was removed.
208  bool Start( a2dCanvasObject* object );
209 
210  //! called from within a2dCanvasDocument
211  virtual bool WalkTask( wxObject* parent, wxObject* object, a2dWalkEvent event );
212 
213  //! if set when a property is removed make the canvas object pending.
214  void SetMakePending( bool makePending ) { m_makePending = makePending; }
215 
216  //! to remove all or only one property on each object found.
217  bool m_all;
218 
219  //! properties to search for
221 
222  //! mask required in object
224 
225  //! how deep to recurse into document
226  int m_depth;
227 
228  //! set object pending when property is removed.
230 };
231 
232 //! document walking to select a2dCanvasObject by filtering against several constraints.
233 /*!
234  This is often used as base class for other algorithms.
235  Its task is to select object that adhere to the filter properties set for this class.
236 
237  \ingroup docalgo
238 */
240 {
241 public:
242 
243  //! constructor with no a2dPropertyId added yet. For that use AddPropertyId()
245 
246  //! constructor with a2dPropertyId added to the propertyIsList to search for.
248 
249  //! constructor with the propertyIdList to search for as input
251 
253 
254  //! add a a2dPropertyId to the list
255  void AddPropertyId( const a2dPropertyId* id );
256 
257  //! used from constructors
258  void Initialize();
259 
260  //! start iteration here
261  //! returns m_result, which value depends on derived class, and defaults to false.
262  bool Start( a2dCanvasObject* object );
263 
264  //! add to classname to set of classes to be filtered.
265  void AddClassName( wxString className );
266 
267  //! remove this classname from set.
268  void RemoveClassName( wxString className );
269 
270  //! when set, object filtered on classname are written to target ( file or layer )
271  //! Else non filtered on classname objects are written to the target.
272  void SetAllowClassList( bool allow ) { m_allowClassList = allow; }
273 
274  //! when set, object filtered on classname are written to target ( file or layer )
275  //! Else non filtered on classname objects are written to the target.
276  bool GetAllowClassList() { return m_allowClassList; }
277 
278  //! if not empty, objects must have this name
279  void SetObjectName( const wxString& objectname = wxT( "" ) ) { m_objectname = objectname; }
280 
281  //! if not 0, objects must have this UniqueSerializationId
282  void SetUniqueSerializationId( wxInt64 id ) { m_id = id; }
283 
284  //! if valid, objects must fit in this boundingbox
285  void SetBoundingBox( const a2dBoundingBox& bbox ) { m_bbox = bbox; }
286 
287  //! if boundingbox is set, the object is testen against this condition, default _IN
288  void SetBoundingBoxCondition( wxUint16 intersectionCondition ) { m_intersectionCondition = intersectionCondition; }
289 
290  //! how far we go into nested a2dObject's
291  void SetRecursionDepth( int depth = INT_MAX ) { m_depth = depth; }
292 
293  //! if set, layer which the object is on must be visible
294  void SetCheckLayerVisible( bool check ) { m_layervisible = check; }
295 
296  //! if set, layer which the object is on must be selectable
297  void SetCheckLayerSelectable( bool check ) { m_layerselectable = check; }
298 
299  //! if set, the start object will be skipped
300  void SetSkipStart( bool skip ) { m_skipStartObject = skip; }
301 
302  //! if not empty, object must have the properties in this list
304 
305  //! object must fit this mask.
307 
308  //! list of classnames to be filtered
309  set<wxString> m_classnameMap;
310 
311  //! name for object is not empty
312  wxString m_objectname;
313 
314  //! wanted id
315  wxInt64 m_id;
316 
317  //! wanted depth
318  int m_depth;
319 
320  //! object must be in this box if it the box is valid
322 
323  //! test m_bbox against teh object in question for this condition
325 
326  //!if set, the layer must be visible
328 
329  //!if set, the layer must be selectable
331 
332  //! the start object itself is not checked
334 
335  //! to negate list of classnames to be filtered
337 
338 protected:
339 
340  //! convert canvasobject to a list of polygons.
341  //! But only for simple primitive objects.
342  //! first a2dCanvasObject::GetAsCanvasVpaths() is used to convert to vector paths,
343  //! and next the vector path is translated into polygons.
344  a2dCanvasObjectList* ConvertToPolygons( a2dCanvasObject* canvasobject, bool transform );
345 
346  //! convert canvasobject to a list of Vpath.
347  //! But only for simple primitive objects.
348  //! first a2dCanvasObject::GetAsCanvasVpaths() is used to convert to vector paths,
349  a2dCanvasObjectList* ConvertToVpath( a2dCanvasObject* canvasobject, bool transform );
350 
351  //! return true if object fits the filter
352  bool ObjectOke( a2dCanvasObject* obj );
353 
354  //! return true of object fits the classname filter
355  bool ClassOfObjectOke( a2dCanvasObject* obj );
356 
357 };
358 
359 //! collect a2dCanvasObject's in a hierarchy of a a2dCanvasDocument
360 /*!
361  \ingroup docalgo
362 */
364 {
365 public:
366 
367  //! constructor with no a2dPropertyId added yet. For that use AddPropertyId()
369 
370  //! constructor with a2dPropertyId added to the propertyIsList to search for.
372 
373  //! constructor with the propertyIdList to search for as input
375 
377 
378  void Initialize();
379 
380  //! called from within a2dCanvasDocument
381  virtual bool WalkTask( wxObject* parent, wxObject* object, a2dWalkEvent event );
382 
383  //! objects found
385 };
386 
388  bool operator() (const a2dCanvasObjectPtr& lhs, const a2dCanvasObjectPtr& rhs) const{
389  return lhs.Get() < rhs.Get();
390  }
391 };
392 
393 typedef set< a2dCanvasObjectPtr, a2dCanvasObjectPtr_compare > a2dCanvasObjectsSet;
394 
395 //! used to canvas object on name
396 extern bool NameSorter( const a2dCanvasObjectPtr& x, const a2dCanvasObjectPtr& y );
397 //! used to canvas object on name in reverse order
398 extern bool NameSorterReverse( const a2dCanvasObjectPtr& x, const a2dCanvasObjectPtr& y );
399 //! used to canvas object on number of childs order and if same on name
400 extern bool OnNrChilds( const a2dCanvasObjectPtr& x, const a2dCanvasObjectPtr& y );
401 //! used to canvas object on number of childs reverse order and if same on name
402 extern bool OnNrChildsReverse( const a2dCanvasObjectPtr& x, const a2dCanvasObjectPtr& y );
403 
404 //! collect a2dCanvasObject's in a hierarchy of a a2dCanvasDocument
405 /*!
406  \ingroup docalgo
407 */
409 {
410 public:
411 
413  {
414  //! name of canvasobject
416  //! name of canvasobject reverse
418  //! Number of childs
420  //! Number of childs reverse
421  onNrChildsReverse
422  };
423 
424  //! constructor with no a2dPropertyId added yet. For that use AddPropertyId()
426 
427  //! constructor with a2dPropertyId added to the propertyIsList to search for.
429 
430  //! constructor with the propertyIdList to search for as input
432 
434 
435  void Initialize();
436 
437  //! called from within a2dCanvasDocument
438  virtual bool WalkTask( wxObject* parent, wxObject* object, a2dWalkEvent event );
439 
440  //! if set, objects must have childs
441  void SetWithChilds( bool check ) { m_childs = check; }
442 
443  void SortOn( a2dSortOn which ) { m_sortOn = which; }
444 
445  bool Start( a2dCanvasObject* object );
446 
447  //! objects found
448  a2dCanvasObjectsSet m_found;
449 
450 private:
451 
452  bool m_childs;
453 
454  a2dSortOn m_sortOn;
455 
456 };
457 
458 //! find a2dCanvasObjects in a hierarchy of a a2dCanvasDocument
459 /*!
460  \ingroup docalgo
461 */
462 class A2DCANVASDLLEXP a2dWalker_FindCanvasObject: public a2dWalkerIOHandler
463 {
464 public:
465 
466  //! constructor with no a2dPropertyId added yet. For that use AddPropertyId()
468 
470 
471  bool Start( a2dCanvasObject* object );
472 
473  void Initialize();
474 
475  //! called from within a2dCanvasDocument
476  virtual bool WalkTask( wxObject* parent, wxObject* object, a2dWalkEvent event );
477 
478  //! object found
480 };
481 
482 //! set a2dCanvasObjects flags in a hierarchy of a a2dCanvasDocument
483 /*!
484  \ingroup docalgo
485 */
487 {
488 public:
489 
490  //! constructor with no a2dPropertyId added yet. For that use AddPropertyId()
492 
493  //! constructor with a2dPropertyId added to the propertyIsList to search for.
495 
496  //! constructor with the propertyIdList to search for as input
498 
500 
501  void Initialize();
502 
503  //! start removing properties from the object given, and down.
504  bool Start( a2dCanvasObject* object, bool setTo );
505 
506  //! called from within a2dCanvasDocument
507  virtual bool WalkTask( wxObject* parent, wxObject* object, a2dWalkEvent event );
508 
509  //! mask for which flags to set
511 
512  //! clear or set the flags
514 };
515 
516 //! set pending flag in a drawing
518 {
519  DECLARE_CLASS( a2dWalker_SetPending )
520 
521 public:
522 
523  //! constructor with no a2dPropertyId added yet. For that use AddPropertyId()
526  {
527  m_skipNotRenderedInDrawing = true;
528  }
529 };
530 
531 //! set a2dCanvasObjects property in a hierarchy of a a2dCanvasDocument
532 /*!
533  \ingroup docalgo
534 */
536 {
537 public:
538 
539  //! constructor with a2dPropertyId to set
541 
543 
544  void Initialize();
545 
546  //! called from within a2dDocument
547  virtual bool WalkTask( wxObject* parent, wxObject* object, a2dWalkEvent event );
548 
549  //! id of property to set
551 
552 };
553 
554 //----------------------------------------------------------------------------
555 // a2dWalker_SetProperty
556 //----------------------------------------------------------------------------
557 
558 //! set a2dObjects property in a hierarchy of a a2dDocument
559 /*!
560  \ingroup docalgo
561 */
562 template < class basetype, class a2dpropertyidtyped, class proptype = a2dObject >
564 {
565 public:
566 
567  //! constructor with no a2dPropertyIdTyped<basetype, proptype> added yet. For that use AddPropertyId()
568  a2dWalker_SetProperty( basetype valueToSet, bool all = true );
569 
570  //! constructor with a2dPropertyId added to the propertyIsList to search for.
571  a2dWalker_SetProperty( const a2dpropertyidtyped* id, basetype valueToSet , bool all = true );
572 
573  //! destructor
575 
576  //! add a a2dPropertyId to the list
577  void AddPropertyId( const a2dpropertyidtyped* id );
578 
579  //! start removing properties from the object given, and down.
580  bool Start( a2dObject* object );
581 
582  //! called from within a2dCanvasDocument
583  virtual bool WalkTask( wxObject* parent, wxObject* object, a2dWalkEvent event );
584 
585  //! to remove all or only one property on each object found.
586  bool m_all;
587 
588  //! value to set
589  basetype m_valueToSet;
590 
591  //! properties to search for
593 };
594 
596 
601 
605 
606 template< class basetype, class a2dpropertyidtyped, class proptype >
608 {
609  m_valueToSet = valueToSet;
610  m_all = all;
611 }
612 
613 template< class basetype, class a2dpropertyidtyped, class proptype >
614 a2dWalker_SetProperty< basetype, a2dpropertyidtyped, proptype >::a2dWalker_SetProperty( const a2dpropertyidtyped* id, basetype valueToSet, bool all )
615 {
616  m_valueToSet = valueToSet;
617  m_propertyList.push_back( ( a2dPropertyId* ) id );
618  m_all = all;
619 }
620 
621 template< class basetype, class a2dpropertyidtyped, class proptype >
623 {
624 }
625 
626 template< class basetype, class a2dpropertyidtyped, class proptype >
628 {
629  m_propertyList.push_back( ( a2dPropertyId* ) id );
630 }
631 
632 
633 template< class basetype, class a2dpropertyidtyped, class proptype >
635 {
636  if ( !object )
637  return false;
638  object->Walker( NULL, *this );
639  return true;
640 }
641 
642 template< class basetype, class a2dpropertyidtyped, class proptype >
643 bool a2dWalker_SetProperty< basetype, a2dpropertyidtyped, proptype >::WalkTask( wxObject* WXUNUSED( parent ), wxObject* object, a2dWalkEvent event )
644 {
645  if ( event == a2dWalker_a2dPropertyStart )
646  {
647  SetStopWalking( true );
648  if ( wxDynamicCast( object, proptype ) )
649  {
650  a2dObject* propobj = wxDynamicCast( object, proptype );
651  forEachIn( a2dPropertyIdList, &m_propertyList )
652  {
653  a2dpropertyidtyped* id = ( a2dpropertyidtyped* ) (*iter).Get();
654  id->SetPropertyToObject( propobj, m_valueToSet );
655  }
656  }
657  }
658  if ( event == a2dWalker_a2dPropertyEnd )
659  SetStopWalking( false );
660 
661  return true;
662 }
663 
664 //! set check on a2dObject flag false or true
665 class A2DCANVASDLLEXP a2dWalker_SetCheck: public a2dWalker_SetBoolProperty
666 {
667  DECLARE_CLASS( a2dWalker_SetCheck )
668 
669 public:
670 
671  //! set check on a2dObject flag false or true
672  a2dWalker_SetCheck( bool value ):
673  a2dWalker_SetBoolProperty( PROPID_Check, value )
674  {
675  }
676 };
677 
678 //! set the a2dCanvasObject's view dependent
679 /*!
680  \ingroup docalgo
681 */
682 class A2DCANVASDLLEXP a2dWalker_SetViewDependent: public a2dWalkerIOHandler
683 {
684 public:
685 
686  //! constructor
687  /*!
688  \param drawingPart view for adding next properties on this object and maybe its children.
689  \param viewdependent if true then to add property 'PROPID_viewDependent' to objects
690  that are depend on 'aView' view when it comes to size.
691  Else to remove this property.
692  \param viewspecific if true then to add property 'PROPID_viewSpecific' to objects
693  that are only visible on 'aView' view.
694  Else to remove this property to make visible on all views.
695  \param onlyinternalarea Remove scale in matrix for children objects.
696  */
697  a2dWalker_SetViewDependent( a2dDrawingPart* drawingPart, bool viewdependent, bool viewspecific = false, bool onlyinternalarea = false );
698 
699  //! destructor
701 
702  bool Start( a2dCanvasObject* object );
703 
704  void Initialize();
705 
706  //! called from within a2dDocument
707  virtual bool WalkTask( wxObject* parent, wxObject* object, a2dWalkEvent event );
708 
709  //! which view to set view dependent
711  //! on/off for view dependent updating
713  //! set only visible for this view
715  //! transform without scale for children
717 };
718 
719 //! set the a2dCanvasObject's a2dDrawing root recursive
720 /*!
721  \ingroup docalgo
722 */
723 class A2DCANVASDLLEXP a2dWalker_SetRoot: public a2dWalkerIOHandler
724 {
725 
726  DECLARE_CLASS( a2dWalker_SetRoot )
727 
728 public:
729 
730  //!
731  /*!
732  \param root set the a2dDrawing object to this root
733  */
734  a2dWalker_SetRoot( a2dDrawing* root );
735 
737 
738  //! start setting the root object from here
739  bool Start( a2dCanvasObject* object );
740 
741  //! called from within a2dDocument
742  virtual bool WalkTask( wxObject* parent, wxObject* object, a2dWalkEvent event );
743 
744  //! document to set
746 };
747 
748 //! make the child which fit the mask/filter into a tree structure to a certain level
749 /*!
750  Normally a document structure can have multiple references to the same object.
751  Like branches on a tree which touch eachother. This walker makes all branches unique.
752 
753  \ingroup docalgo
754 */
756 {
757 public:
758 
759  //! constructor with no a2dPropertyId added yet. For that use AddPropertyId()
761 
762  //! constructor with a2dPropertyId added to the propertyIsList to search for.
764 
765  //! constructor with the propertyIdList to search for as input
767 
769 
770  //! start here
771  bool Start( a2dCanvasObject* object );
772 
773  void Initialize();
774 
775  //! called from within a2dCanvasDocument
776  virtual bool WalkTask( wxObject* parent, wxObject* object, a2dWalkEvent event );
777 
778 private:
779 
780  //! detection for start of first level childs
781  bool m_firstLevelChild;
782 };
783 
784 //! remove hierarchy in grouped objects
785 /*!
786  in a2dCanvasObject with children, the children are moved one level.
787  Same for a2dCanvasObjectReference and a2dCanvasObjectArrayReference its m_object.
788 
789  m_depth > 1 will result in smashing all children in an object also nest.
790  m_depth = 1 will result in on level of hierarchy removed.
791 
792  \ingroup docalgo
793 */
795 {
796 public:
797 
798  //! constructor with no a2dPropertyId added yet. For that use AddPropertyId()
800 
801  //! constructor with a2dPropertyId added to the propertyIsList to search for.
803 
804  //! constructor with the propertyIdList to search for as input
806 
808 
809  //! start here
810  bool Start( a2dCanvasObject* object );
811 
812  void Initialize();
813 
814  //! called from within a2dCanvasDocument
815  virtual bool WalkTask( wxObject* parent, wxObject* object, a2dWalkEvent event );
816 
817 private:
818 
819  //! set objects selected after removing hierarchy
820  bool m_selected;
821 
822  //! detection for start of first level childs
823  bool m_firstLevelChild;
824 
825  //! to hold parents passed
826  a2dSmrtPtrList<a2dObject> m_parentList;
827 };
828 
829 
830 //! base algorithm class to work on a2dCanvasObjects in groups of layers
831 /*!
832  groupA and groupB are filled with layer numbers.
833 
834  a2dCanvasObjects with the flag a2dCanvasOFlags::m_ignoreLayer set, will be ignored here.
835 
836  \ingroup docalgo
837 */
839 {
840 public:
841 
842  //! constructor with no a2dPropertyId added yet. For that use AddPropertyId()
844 
845  //! constructor with a2dPropertyId added to the propertyIsList to search for.
847 
848  //! constructor with the propertyIdList to search for as input
850 
851  //! destructor
853 
854  //! used from constructor
855  void Initialize();
856 
857  //! start at this object
858  bool Start( a2dCanvasObject* object );
859 
860  //! objects on layers in group A will be used as first operand
861  void SetGroupA( const a2dLayerGroup& groupA ) { m_groupA = groupA; }
862 
863  //! objects on layers in group B will be used as first operand
864  void SetGroupB( const a2dLayerGroup& groupB ) { m_groupB = groupB; }
865 
866  //! set the layer where the result will be placed
867  void SetTarget( wxUint16 targetlayer );
868 
869  //! set selectedOnlyA in group operations
870  void SetSelectedOnlyA( bool selectedOnlyA ) { m_selectedOnlyA = selectedOnlyA; }
871 
872  //! get selectedOnlyA in group operations
873  bool GetSelectedOnlyA() { return m_selectedOnlyA; }
874 
875  //! set selectedOnlyB in group operations
876  void SetSelectedOnlyB( bool selectedOnlyB ) { m_selectedOnlyB = selectedOnlyB; }
877 
878  //! get selectedOnlyB in group operations
879  bool GetSelectedOnlyB() { return m_selectedOnlyB; }
880 
881 protected:
882 
883  //! group A layers operand
885 
886  //! group B layers operand
888 
889  //! result into this layer
890  wxUint16 m_target;
891 
892  //! work only on selected object in group A
894  //! work only on selected object in group B
896 
897 };
898 
899 //! algorithm to delete a2dCanvasObjects on layers or to move, copy to other layers
900 /*!
901  groupA and groupB are filled with layer numbers.
902  Next one calls a valid operation, which is can be:
903  - moveLayers
904  - copyLayers
905  - deleteLayers
906 
907  a2dCanvasObjects with the flag a2dCanvasOFlags::m_ignoreLayer set, will be ignored here.
908 
909  \ingroup docalgo
910 */
912 {
913 public:
914 
915  typedef long Operation;
916 
917  //! move layers to target
918  static const long moveLayers;
919  //! copy layers to target
920  static const long copyLayers;
921  //! delete layers
922  static const long deleteLayers;
923  //! convert segments in polygon/polyline objects in group A to Arcs where possible
924  static const long ConvertToArcs;
925  //! convert to simple polygons and polylines preserve arcs
927  //! convert to simple polygons and polylines
929  //! convert segments in polygon/polyline with width objects in group A to Arcs where possible
930  static const long ConvertPolygonToArcs;
931  //! convert segments in polyline objects in group A to Arcs where possible
932  static const long ConvertPolylineToArcs;
933  //! convert shapes to vector paths
934  static const long ConvertToVPaths;
935  //! convert shapes to seperate lines and arcs
936  static const long ConvertLinesArcs;
937  //! convert shapes to polylines even if polygons
938  static const long ConvertToPolylines;
939  //! remove redundant segment
940  static const long RemoveRedundant;
941  //! calculate area of objects
942  static const long areaLayers;
943 
944  //! constructor with no a2dPropertyId added yet. For that use AddPropertyId()
946 
947  //! constructor with a2dPropertyId added to the propertyIsList to search for.
949 
950  //! constructor with the propertyIdList to search for as input
952 
953  //! destructor
955 
956  //! used from constructor
957  void Initialize();
958 
959  //! called from within a2dCanvasDocument
960  virtual bool WalkTask( wxObject* parent, wxObject* object, a2dWalkEvent event );
961 
962  //! set type of operation
963  void SetOperation( Operation operation ) { m_operation = operation; }
964 
965  //! Polygon/polyline to Arc Minimum radius to test
966  void SetRadiusMin( double radiusMin ) { m_radiusMin = radiusMin; }
967  //! Polygon/polyline to Arc Maximum radius to test
968  void SetRadiusMax( double radiusMax ) { m_radiusMax = radiusMax; }
969  //! Polygon/polyline to Arc Maximum abberation
970  void SetAberPolyToArc( double aber ) { m_AberPolyToArc = aber; }
971 
972  //! if after polygon conversion to arcs end up as one arc segment forming a circle,
973  //! add a circle object to target and not a polygon.
974  void SetDetectCircle( bool detectCircle ) { m_detectCircle = detectCircle; }
975 
976  //! see SetDetectCircle
977  bool GetDetectCircle() { return m_detectCircle; }
978 
979  //! in areaLayers returns calculated area sofar.
980  double GetCalculatedArea() { return m_calculatedArea; }
981 
982 protected:
983 
984  void AddArea( a2dCanvasObject* getAsPolyObject );
985 
986  //! Polygon/polyline to Arc Minimum radius to test
987  double m_radiusMin;
988  //! Polygon/polyline to Arc Maximum radius to test
989  double m_radiusMax;
990  //! Polygon/polyline to Arc Maximum abberation
992 
993  bool m_detectCircle;
994 
995  double m_calculatedArea;
996 
997  //! id for operation
998  Operation m_operation;
999 };
1000 
1001 //! detection of small objects.
1002 /*! Detect objects, which are smaller than a certain size.
1003 The report is generated as a string containing the CVG output, which can be written to a file.
1004 */
1005 class A2DCANVASDLLEXP a2dWalker_DetectSmall: public a2dWalker_LayerGroup
1006 {
1007 public:
1008 
1009  //! constructor with no a2dPropertyId added yet. For that use AddPropertyId()
1011 
1012  //! constructor with a2dPropertyId added to the propertyIsList to search for.
1014 
1015  //! constructor with the propertyIdList to search for as input
1017 
1018  //! destructor
1020 
1021  //! used from constructor
1022  void Initialize();
1023 
1024  //! set what is seen as small.
1025  void SetSmall( double smallest ) { m_small = smallest; }
1026 
1027  //! set asString
1028  void SetAsString( bool asString ) { m_asString = asString; }
1029 
1030  //! get asString
1031  bool GetAsString() { return m_asString; }
1032 
1033  bool Start( a2dCanvasObject* object );
1034 
1035  //! called from within a2dCanvasDocument
1036  virtual bool WalkTask( wxObject* parent, wxObject* object, a2dWalkEvent event );
1037 
1038 #if wxUSE_STD_IOSTREAM
1039  const wxString& GetString() const
1040  {
1041  static wxString aap = wxString( m_strstream.str().c_str(), wxConvUTF8 );
1042  return aap;
1043  }
1044 #else
1045  const wxString GetString() const { return m_strstream.GetString(); }
1046 #endif
1047 
1048 protected:
1049 
1050  a2dIOHandlerCVGOut m_CVGwriter;
1051  a2dDocumentStringOutputStream m_strstream;
1052  bool m_asString;
1053  double m_small;
1054 };
1055 
1056 //! detection of small objects.
1057 /*! Detect objects, which are smaller than a certain size.
1058 The report is generated as a string containing the CVG output, which can be written to a file.
1059 */
1061 {
1062 public:
1063 
1064  //! constructor with no a2dPropertyId added yet. For that use AddPropertyId()
1066 
1067  //! constructor with a2dPropertyId added to the propertyIsList to search for.
1069 
1070  //! constructor with the propertyIdList to search for as input
1072 
1073  //! destructor
1075 
1076  //! used from constructor
1077  void Initialize();
1078 
1079  //! set what is seen as small.
1080  void SetSmall( double smallest ) { m_small = smallest; }
1081 
1082  //! set asString
1083  void SetAsString( bool asString ) { m_asString = asString; }
1084 
1085  //! get asString
1086  bool GetAsString() { return m_asString; }
1087 
1088  bool Start( a2dCanvasObject* object );
1089 
1090  //! called from within a2dCanvasDocument
1091  virtual bool WalkTask( wxObject* parent, wxObject* object, a2dWalkEvent event );
1092 
1093 #if wxUSE_STD_IOSTREAM
1094  const wxString& GetString() const
1095  {
1096  static wxString aap = wxString( m_strstream.str().c_str(), wxConvUTF8 );
1097  return aap;
1098  }
1099 #else
1100  const wxString GetString() const { return m_strstream.GetString(); }
1101 #endif
1102 
1103 protected:
1104 
1105  a2dIOHandlerCVGOut m_CVGwriter;
1106  a2dDocumentStringOutputStream m_strstream;
1107  bool m_asString;
1108  double m_small;
1109 };
1110 
1111 //! find the a2dcanvasObject, and set the corridor flag on the path to it.
1112 /*!
1113  Corridors are used as event tubes in a a2dCanvasDocument, in order to redirect events directly
1114  to a specific object, but maintaining its position/matrixes correctly as in the document.
1115 
1116  \see a2dIterC::SetCorridorPath
1117  \see a2dCanvasView::ClearCorridorPath
1118 
1119  \ingroup docalgo
1120 */
1122 {
1123 public:
1124 
1125  //! constructor
1126  /*! \see a2dIterC::SetCorridorPath
1127  \see a2dCanvasView::FindAndSetCorridorPath
1128  This function is not used directly, but via a2dCanvasView::FindAndSetCorridorPath
1129 
1130  \param findObject (child) object to be searched for.
1131  \return true if findObject was found
1132  */
1134 
1135  //! destructor
1137 
1138  //! called from within a2dDocument
1139  virtual bool WalkTask( wxObject* parent, wxObject* object, a2dWalkEvent event );
1140 };
1141 
1142 //! filter to string or file
1143 /*!
1144  First filter is ObjectOke(), and next
1145  objects with classnames which are part of the m_classnameMap ( or NOT if m_allowClassList is set ),
1146  are filtered.
1147 
1148 */
1149 class A2DCANVASDLLEXP a2dWalker_AllowedObjects: public a2dWalker_LayerGroup
1150 {
1151 public:
1152 
1153  //! constructor with no a2dPropertyId added yet. For that use AddPropertyId()
1155 
1156  //! constructor with a2dPropertyId added to the propertyIsList to search for.
1158 
1159  //! constructor with the propertyIdList to search for as input
1161 
1162  //! destructor
1164 
1165  //! used from constructor
1166  void Initialize();
1167 
1168  //! set asString
1169  void SetAsString( bool asString ) { m_asString = asString; }
1170 
1171  //! get asString
1172  bool GetAsString() { return m_asString; }
1173 
1174  //! set if result must be stored
1175  void SetStore( bool store ) { m_store = store; }
1176 
1177  //! get store
1178  bool GetStore() { return m_store; }
1179 
1180  bool Start( a2dCanvasObject* object );
1181 
1182  //! called from within a2dCanvasDocument
1183  virtual bool WalkTask( wxObject* parent, wxObject* object, a2dWalkEvent event );
1184 
1185 #if wxUSE_STD_IOSTREAM
1186  const wxString& GetString() const
1187  {
1188  static wxString aap = wxString( m_strstream.str().c_str(), wxConvUTF8 );
1189  return aap;
1190  }
1191 #else
1192  const wxString GetString() const { return m_strstream.GetString(); }
1193 #endif
1194 
1195 protected:
1196 
1197  a2dIOHandlerCVGOut m_CVGwriter;
1198  a2dDocumentStringOutputStream m_strstream;
1199  bool m_asString;
1200  bool m_store;
1201 };
1202 
1203 //! Walker taking iterative context into account.
1204 /*!
1205 
1206  \ingroup docalgo
1207 */
1209 {
1210 public:
1211 
1212  //! constructor
1214 
1215  //! destructor
1217 
1218  //! init
1219  void Initialize();
1220 
1221  //! Start traversing at object, returns true.
1222  bool Start( a2dCanvasObject* object );
1223 
1224  //! called from within a2dCanvasDocument
1225  virtual bool WalkTask( a2dIterC& ic, wxObject* parent, wxObject* object, a2dWalkEvent event ) = 0;
1226 
1227  a2dIterC* m_context;
1228 };
1229 
1230 
1231 //! set a2dCanvasObjects check flag when in view
1232 /*!
1233  \ingroup docalgo
1234 */
1236 {
1237 public:
1238 
1239  //! constructor
1241 
1242  //! destructor
1244 
1245  //! called from within a2dCanvasDocument
1246  virtual bool WalkTask( a2dIterC& ic, wxObject* parent, wxObject* object, a2dWalkEvent event );
1247 
1248  void Render( a2dIterC& ic, a2dCanvasObject* canobj, OVERLAP clipparent );
1249 };
1250 
1251 //! Find pins in view, which can connect to the given pinclass.
1252 /*!
1253 
1254  To provide visual feedback by other objects that might participate in an editing sequence.
1255 
1256  In some situations, e.g. when drawing wires or when draging objects in hierarchies,
1257  it is helpfull if other objects provide visual feedback, that they e.g. would
1258  accept the currently edited objects. If e.g. a wire is drawn, all pins that can
1259  accept the wire can turn green and all other pins can turn red. This class
1260  is usually used from the show object of a a2dCanvasView and goes down recursively.
1261 
1262  \ingroup docalgo
1263 */
1265 {
1266 public:
1267 
1269  a2dConnectTask connectTask, double xpin, double ypin, double margin );
1270 
1272 
1273  void Initialize();
1274 
1275  void StopAtFirst( bool stopAtFirst ) { m_stopAtFirst = stopAtFirst; }
1276 
1277  //! called from within a2dCanvasDocument
1278  bool Start( a2dCanvasObject* object );
1279 
1280  double m_xpin;
1281  double m_ypin;
1282 
1283  a2dPinClass* m_pinclassToConnectTo;
1284 
1285  a2dPinClass* m_returnPinclass;
1286 
1287  //! pins found
1289 
1290 protected:
1291 
1292  double m_margin;
1293  bool m_stopAtFirst;
1294 
1295  a2dConnectTask m_connectTask;
1296 };
1297 
1299 {
1300 public:
1301 
1303  a2dConnectTask connectTask, double margin );
1304 
1306 
1307  void Initialize();
1308 
1309  void StopAtFirst( bool stopAtFirst ) { m_stopAtFirst = stopAtFirst; }
1310 
1311  //! called from within a2dCanvasDocument
1312  bool Start( a2dCanvasObject* object );
1313 
1314  a2dPin* m_pinToConnectTo;
1315 
1316  //! pins found
1318  double m_margin;
1319 
1320  a2dConnectTask m_connectTask;
1321 
1322  bool m_stopAtFirst;
1323 };
1324 
1325 //! Set pins in begin state after wiring up some pins
1326 /*!
1327  This is used to highlight matching pins when drawing a wire
1328 
1329  \ingroup docalgo
1330 */
1332 {
1333 public:
1334 
1336 
1338 
1339  //! Start traversing at object, returns true.
1340  bool Start( a2dCanvasObject* object );
1341 
1342  void Initialize();
1343 };
1344 
1345 
1346 //! Set pins in end state after wiring up some pins
1347 /*!
1348  This is used to delete dynamically create pins and remove highlighting
1349 
1350  \ingroup docalgo
1351 */
1353 {
1354 public:
1355 
1357 
1359 
1360  //! Start traversing at object, returns true.
1361  bool Start( a2dCanvasObject* object );
1362 
1363  void Initialize();
1364 };
1365 
1366 //! Generate pins on objects, which can connect to the given pinclass.
1367 /*!
1368  This is used to dynamically create pins, which can connect to
1369  the pinclass given. When a wire needs to be connected to another wire or object,
1370  this results in generating the pin if non there. The connection is not made yet,
1371  it is only an indication that connection is possible.
1372 
1373  \ingroup docalgo
1374 */
1376 {
1377 public:
1378 
1380  a2dConnectTask connectTask, double xpin, double ypin );
1381 
1383 
1384  void Initialize();
1385 
1386  //! Start sgenerating pins for children of object if ItsChildren is set.
1387  //! Else only for object.
1388  bool Start( a2dIterC& ic, a2dCanvasObject* object, bool ItsChildren = true );
1389 
1390  double m_xpin;
1391  double m_ypin;
1392 
1393  a2dPinClass* m_pinclassToConnectTo;
1394 
1395  a2dIterC* m_ic;
1396 
1397  a2dConnectTask m_connectTask;
1398 };
1399 
1400 //! Generate pins on objects, and test which can connect to the given object.
1401 /*!
1402  Pins in the given canvas object are tested for possible connection to pins on other objects.
1403  Meaning if pins of other objects are at the same position as a pin of the given object,
1404  a test done, to see if a connection can be made.
1405  The connection is not made yet, it is only an indication that connection is possible.
1406  This is done by setting the rendering mode for those pins different.
1407  The will automatically be re-rendered in idle time.
1408 
1409  Some canvas objects can create pins automatically. If the pins of the given object, hit another objects,
1410  and it can generate pins automatically, this will be done first. Next a connection test on those pins is made.
1411  The generated pins are temporary, and if no connection is made, they will be deleted in idle time.
1412 
1413  \ingroup docalgo
1414 */
1416 {
1417 public:
1418 
1420  a2dConnectTask connectTask );
1421 
1423 
1424  void Initialize();
1425 
1426  bool Start( a2dIterC& ic, a2dCanvasObject* object );
1427 
1428  a2dCanvasObject* m_connectObject;
1429  a2dIterC* m_ic;
1430  a2dConnectTask m_connectTask;
1431 };
1432 
1433 
1434 //! Connect objects, which can connect to the given object.
1435 /*!
1436  Pins in the given canvas object are tested for possible connection to pins on other objects.
1437  Meaning if pins of other objects are at the same position as a pin of the given object,
1438  a test done, to see if a connection can be made.
1439  If a connection is allowed, a wire is created to connect the objects at the those pins.
1440 
1441  \ingroup docalgo
1442 */
1444 {
1445 public:
1446 
1448  a2dConnectTask connectTask, double margin );
1449 
1451 
1452  void Initialize();
1453 
1454  bool Start( a2dCanvasObject* top, bool alsoWires = false );
1455 
1456 private:
1457 
1458  bool ConnectAtPin( a2dCanvasObject* top, a2dPin* pintoconnect );
1459 
1460  a2dCanvasObject* m_connectObject;
1461  a2dConnectTask m_connectTask;
1462  double m_margin;
1463 };
1464 
1465 #endif
Display Part of a a2dDrawing, in which a2dCanvasObjects are shown.
Definition: drawer.h:470
set check on a2dObject flag false or true
Definition: algos.h:665
bool m_all
to remove all or only one property on each object found.
Definition: algos.h:586
void SetAsString(bool asString)
set asString
Definition: algos.h:1083
a2dWalker_SetCheck(bool value)
set check on a2dObject flag false or true
Definition: algos.h:672
a2dNamedProperty * m_property
id of property to set
Definition: algos.h:550
(In) Visible property that can be added to Docview Objects.
Definition: gen.h:1785
#define wxDynamicCast(obj, className)
Define wxDynamicCast so that it will give a compiler error for unrelated types.
Definition: gen.h:75
Generate pins on objects, which can connect to the given pinclass.
Definition: algos.h:1375
perform a function on each a2dCanvasObject in the document
Definition: algos.h:57
a2dConnectTask
flags for searching a connecting a2dpinClass, for the connecting task at hand.
Definition: connectgen.h:40
virtual bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dCanvasDocument
Definition: algos.h:643
bool m_viewdependent
on/off for view dependent updating
Definition: algos.h:712
bool m_all
to remove all or only one property on each object found.
Definition: algos.h:217
void SetUniqueSerializationId(wxInt64 id)
if not 0, objects must have this UniqueSerializationId
Definition: algos.h:282
base algorithm class to work on a2dCanvasObjects in groups of layers
Definition: algos.h:838
void SetGroupB(const a2dLayerGroup &groupB)
objects on layers in group B will be used as first operand
Definition: algos.h:864
bool m_viewspecific
set only visible for this view
Definition: algos.h:714
a2dCanvasObjectList m_found
pins found
Definition: algos.h:1317
double m_AberPolyToArc
Polygon/polyline to Arc Maximum abberation.
Definition: algos.h:991
Find pins in view, which can connect to the given pinclass.
Definition: algos.h:1264
bool m_all
to remove all or only one property on each object found.
Definition: algos.h:178
wxString m_objectname
name for object is not empty
Definition: algos.h:312
a2dPin is used in a2dCanvasObject to add pins to it.
Definition: canpin.h:233
This is a class/type description for a2dPin&#39;s.
Definition: canpin.h:628
remove hierarchy in grouped objects
Definition: algos.h:794
Ref Counted base object.
Definition: gen.h:1045
static const long moveLayers
move layers to target
Definition: algos.h:918
a2dIOHandlerCVGIn and a2dIOHandlerCVGOut - XML I/O classes for the CVG format.
void SetOperation(Operation operation)
set type of operation
Definition: algos.h:963
bool GetSelectedOnlyA()
get selectedOnlyA in group operations
Definition: algos.h:873
bool OnNrChilds(const a2dCanvasObjectPtr &x, const a2dCanvasObjectPtr &y)
used to canvas object on number of childs order and if same on name
Definition: algos.cpp:605
a2dPropertyIdList m_propertyList
properties to search for
Definition: algos.h:181
static const long ConvertToArcs
convert segments in polygon/polyline objects in group A to Arcs where possible
Definition: algos.h:924
void AddPropertyId(const a2dpropertyidtyped *id)
add a a2dPropertyId to the list
Definition: algos.h:627
OVERLAP
Result of a a2dBoundingBox intersection or hittest.
Definition: bbox.h:24
static const long deleteLayers
delete layers
Definition: algos.h:922
wxUint16 m_intersectionCondition
test m_bbox against teh object in question for this condition
Definition: algos.h:324
set the a2dCanvasObject&#39;s view dependent
Definition: algos.h:682
void SetSmall(double smallest)
set what is seen as small.
Definition: algos.h:1025
static const long ConvertLinesArcs
convert shapes to seperate lines and arcs
Definition: algos.h:936
void SetRadiusMax(double radiusMax)
Polygon/polyline to Arc Maximum radius to test.
Definition: algos.h:968
static const long ConvertToPolygonPolylinesWithArcs
convert to simple polygons and polylines preserve arcs
Definition: algos.h:926
detection of small objects.
Definition: algos.h:1060
bool GetStore()
get store
Definition: algos.h:1178
const long a2dWalkEvent
Definition: gen.h:3842
bool GetAsString()
get asString
Definition: algos.h:1172
static const long ConvertToVPaths
convert shapes to vector paths
Definition: algos.h:934
a2dLayerGroup m_groupB
group B layers operand
Definition: algos.h:887
a2dCanvasObject is the base class for Canvas Objects.
Definition: canobj.h:371
a2dCanvasObjectList m_found
objects found
Definition: algos.h:384
wxStringOutputStream a2dDocumentStringOutputStream
string output stream based wxStreams
Definition: gen.h:3454
perform a function on each a2dCanvasObject in the document
Definition: algos.h:85
bool GetDetectCircle()
see SetDetectCircle
Definition: algos.h:977
a2dCanvasObjectList m_found
pins found
Definition: algos.h:1288
basetype m_valueToSet
value to set
Definition: algos.h:589
a2dCanvasObjectPtr m_search
object found
Definition: algos.h:479
static const long ConvertPolylineToArcs
convert segments in polyline objects in group A to Arcs where possible
Definition: algos.h:932
output handler for the CVG format.
Definition: xmlpars.h:103
void SetSelectedOnlyA(bool selectedOnlyA)
set selectedOnlyA in group operations
Definition: algos.h:870
defenitions an no more
bool GetAsString()
get asString
Definition: algos.h:1031
set a2dCanvasObjects check flag when in view
Definition: algos.h:1235
bool GetAsString()
get asString
Definition: algos.h:1086
wxUint64 a2dCanvasObjectFlagsMask
mask flags for a2dCanvasObject
Definition: candefs.h:152
set a2dObjects property in a hierarchy of a a2dDocument
Definition: algos.h:563
Io handler to iterate through a a2dDocument.
Definition: gen.h:3911
name of canvasobject reverse
Definition: algos.h:417
void SetAberPolyToArc(double aber)
Polygon/polyline to Arc Maximum abberation.
Definition: algos.h:970
void SetWithChilds(bool check)
if set, objects must have childs
Definition: algos.h:441
collect a2dCanvasObject&#39;s in a hierarchy of a a2dCanvasDocument
Definition: algos.h:363
void SetRadiusMin(double radiusMin)
Polygon/polyline to Arc Minimum radius to test.
Definition: algos.h:966
set a2dCanvasObjects property in a hierarchy of a a2dCanvasDocument
Definition: algos.h:535
bool m_allowClassList
to negate list of classnames to be filtered
Definition: algos.h:336
bool NameSorterReverse(const a2dCanvasObjectPtr &x, const a2dCanvasObjectPtr &y)
used to canvas object on name in reverse order
Definition: algos.cpp:595
#define forEachIn(listtype, list)
easy iteration for a2dlist
Definition: a2dlist.h:111
static const long ConvertToPolygonPolylinesWithoutArcs
convert to simple polygons and polylines
Definition: algos.h:928
Debug handler for output the hierarchy found in a a2dDocument.
Definition: algos.h:35
int m_depth
how deep to recurse into document
Definition: algos.h:226
static const long ConvertToPolylines
convert shapes to polylines even if polygons
Definition: algos.h:938
Operation m_operation
id for operation
Definition: algos.h:998
void SetSkipStart(bool skip)
if set, the start object will be skipped
Definition: algos.h:300
bool m_skipStartObject
the start object itself is not checked
Definition: algos.h:333
void SetAsString(bool asString)
set asString
Definition: algos.h:1169
void SetBoundingBoxCondition(wxUint16 intersectionCondition)
if boundingbox is set, the object is testen against this condition, default _IN
Definition: algos.h:288
static const long copyLayers
copy layers to target
Definition: algos.h:920
find the a2dcanvasObject, and set the corridor flag on the path to it.
Definition: algos.h:1121
a2dWalker_SetPending(a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL)
constructor with no a2dPropertyId added yet. For that use AddPropertyId()
Definition: algos.h:524
collect a2dCanvasObject&#39;s in a hierarchy of a a2dCanvasDocument
Definition: algos.h:408
static const long areaLayers
calculate area of objects
Definition: algos.h:942
Remove from property in a hierarchy of a canvas document.
Definition: algos.h:188
a2dCanvasObject flags as a structure
Definition: candefs.h:164
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dPropertyStart
id for a2dWalkEvent issued from within a2dWalkerIOHandler
set a2dCanvasObjects flags in a hierarchy of a a2dCanvasDocument
Definition: algos.h:486
~a2dWalker_SetProperty()
destructor
Definition: algos.h:622
make the child which fit the mask/filter into a tree structure to a certain level ...
Definition: algos.h:755
a2dWalker_SetProperty(basetype valueToSet, bool all=true)
constructor with no a2dPropertyIdTyped&lt;basetype, proptype&gt; added yet. For that use AddPropertyId() ...
Definition: algos.h:607
a2dLayers * m_layerSetup
availability set for this layer setup
Definition: algos.h:140
bool m_layervisible
if set, the layer must be visible
Definition: algos.h:327
a2dPropertyIdList m_propertyList
properties to search for
Definition: algos.h:220
bool NameSorter(const a2dCanvasObjectPtr &x, const a2dCanvasObjectPtr &y)
used to canvas object on name
Definition: algos.cpp:585
while iterating a a2dCanvasDocument, this holds the context.
Definition: canobj.h:3212
a2dCanvasObjectFlagsMask m_mask
mask required in object
Definition: algos.h:223
bool m_onlyinternalarea
transform without scale for children
Definition: algos.h:716
set layers available in a2dCanvasView as found in document
Definition: algos.h:114
double m_radiusMax
Polygon/polyline to Arc Maximum radius to test.
Definition: algos.h:989
double GetCalculatedArea()
in areaLayers returns calculated area sofar.
Definition: algos.h:980
set< wxString > m_classnameMap
list of classnames to be filtered
Definition: algos.h:309
void SetBoundingBox(const a2dBoundingBox &bbox)
if valid, objects must fit in this boundingbox
Definition: algos.h:285
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dPropertyEnd
id for a2dWalkEvent issued from within a2dWalkerIOHandler
a2dCanvasObjectsSet m_found
objects found
Definition: algos.h:448
void SetObjectName(const wxString &objectname=wxT(""))
if not empty, objects must have this name
Definition: algos.h:279
set pending flag in a drawing
Definition: algos.h:517
Generate pins on objects, and test which can connect to the given object.
Definition: algos.h:1415
bool m_setOrClear
clear or set the flags
Definition: algos.h:513
This is the base class for all kinds of property id&#39;s for a2dObject.
Definition: id.h:154
void SetCheckLayerSelectable(bool check)
if set, layer which the object is on must be selectable
Definition: algos.h:297
Set pins in begin state after wiring up some pins.
Definition: algos.h:1331
bool m_makePending
set object pending when property is removed.
Definition: algos.h:229
list for a2dCanvasObject
a2dLayerGroup m_groupA
group A layers operand
Definition: algos.h:884
bool m_layerselectable
if set, the layer must be selectable
Definition: algos.h:330
Remove from a2dObject in a hierarchy, certain properties.
Definition: algos.h:152
a2dCanvasObjectFlagsMask m_which
mask for which flags to set
Definition: algos.h:510
void SetCheckLayerVisible(bool check)
if set, layer which the object is on must be visible
Definition: algos.h:294
a2dBoundingBox m_bbox
object must be in this box if it the box is valid
Definition: algos.h:321
void SetAllowClassList(bool allow)
Definition: algos.h:272
holds a list of layers numbers
Definition: canglob.h:60
void SetStore(bool store)
set if result must be stored
Definition: algos.h:1175
bool OnNrChildsReverse(const a2dCanvasObjectPtr &x, const a2dCanvasObjectPtr &y)
used to canvas object on number of childs reverse order and if same on name
Definition: algos.cpp:617
void SetGroupA(const a2dLayerGroup &groupA)
objects on layers in group A will be used as first operand
Definition: algos.h:861
bool GetSelectedOnlyB()
get selectedOnlyB in group operations
Definition: algos.h:879
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
Definition: bbox.h:39
void SetSelectedOnlyB(bool selectedOnlyB)
set selectedOnlyB in group operations
Definition: algos.h:876
void SetSmall(double smallest)
set what is seen as small.
Definition: algos.h:1080
void SetDetectCircle(bool detectCircle)
Definition: algos.h:974
a2dDrawingPart * m_drawingPart
visible on this drawingPart
Definition: algos.h:137
int m_depth
wanted depth
Definition: algos.h:318
double m_radiusMin
Polygon/polyline to Arc Minimum radius to test.
Definition: algos.h:987
void SetMakePending(bool makePending)
if set when a property is removed make the canvas object pending.
Definition: algos.h:214
a2dCanvasObjectFlagsMask m_mask
object must fit this mask.
Definition: algos.h:306
algorithm to delete a2dCanvasObjects on layers or to move, copy to other layers
Definition: algos.h:911
set the a2dCanvasObject&#39;s a2dDrawing root recursive
Definition: algos.h:723
a2dDrawingPart * m_drawingPart
which view to set view dependent
Definition: algos.h:710
static const long ConvertPolygonToArcs
convert segments in polygon/polyline with width objects in group A to Arcs where possible ...
Definition: algos.h:930
Walker taking iterative context into account.
Definition: algos.h:1208
static const a2dCanvasObjectFlagsMask ALL
Definition: candefs.h:220
Connect objects, which can connect to the given object.
Definition: algos.h:1443
a2dPropertyIdList m_propertyList
if not empty, object must have the properties in this list
Definition: algos.h:303
filter to string or file
Definition: algos.h:1149
detection of small objects.
Definition: algos.h:1005
document walking to select a2dCanvasObject by filtering against several constraints.
Definition: algos.h:239
Set pins in end state after wiring up some pins.
Definition: algos.h:1352
void SetRecursionDepth(int depth=INT_MAX)
how far we go into nested a2dObject&#39;s
Definition: algos.h:291
wxUint16 m_target
result into this layer
Definition: algos.h:890
void SetAsString(bool asString)
set asString
Definition: algos.h:1028
a2dPropertyIdList m_propertyList
properties to search for
Definition: algos.h:592
bool Start(a2dObject *object)
start removing properties from the object given, and down.
Definition: algos.h:634
Contain one drawing as hierarchical tree of a2dCanvasObject&#39;s.
Definition: drawing.h:434
bool m_selectedOnlyB
work only on selected object in group B
Definition: algos.h:895
bool m_selectedOnlyA
work only on selected object in group A
Definition: algos.h:893
static const long RemoveRedundant
remove redundant segment
Definition: algos.h:940
find a2dCanvasObjects in a hierarchy of a a2dCanvasDocument
Definition: algos.h:462
wxInt64 m_id
wanted id
Definition: algos.h:315
a2dDrawing * m_root
document to set
Definition: algos.h:745
general canvas module declarations and classes
algos.h Source File -- Sun Oct 12 2014 17:04:12 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation