wxArt2D
cameleon.h
Go to the documentation of this file.
1 /*! \file wx/canvas/cameleon.h
2  \brief special a2dCanvasObject to make a multi view hierachy.
3 
4  Hierarchy is normally created by adding child a2dCanvasObject's to the root object of the a2dDrawing,
5  and those a2dCanvasObject's again can have child objects.
6  A different way is to create a hierarchy of a2dDrawing's.
7  The objects here have multiple appearances, where each appearance can be rendered differently.
8  Some use a a2dDrawing to store and render information.
9  The object defined here are all derived from a2dCanvasObject, and therefore can be placed in
10  a a2dDrawing themselfs.
11 
12  \author Klaas Holwerda
13 
14  Copyright: 2000-2004 (c) Klaas Holwerda
15 
16  Licence: wxWidgets Licence
17 
18  RCS-ID: $Id: recur.h,v 1.17 2009/09/26 20:40:32 titato Exp $
19 */
20 
21 #ifndef __WXCAMELEON_H__
22 #define __WXCAMELEON_H__
23 
24 #ifndef WX_PRECOMP
25 #include "wx/wx.h"
26 #endif
27 
28 #include "wx/canvas/candefs.h"
29 #include "wx/canvas/canobj.h"
30 #include "wx/canvas/canprim.h"
31 #include "wx/canvas/objlist.h"
32 #include "wx/canvas/drawing.h"
33 #include "wx/canvas/recur.h"
34 
35 class A2DCANVASDLLEXP a2dCameleon;
36 class A2DCANVASDLLEXP a2dDiagram;
37 class A2DCANVASDLLEXP a2dSymbol;
38 class A2DCANVASDLLEXP a2dParameters;
39 class A2DCANVASDLLEXP a2dCameleonInst;
40 class A2DCANVASDLLEXP a2dCameleonSymbolicRef;
41 
42 #include <map>
43 typedef std::map< a2dPropertyIdPtr, a2dNamedPropertyPtr > a2dParameterMap;
44 
45 
46 //! Port to be used in a diagram for connecting to symbol
47 /*!
48  This port object is used to create hierarchical diagrams, where a parent diagram can contains a sub diagram.
49  This subdiagram is shown as a a2dSymbol or as a the a2dDiagram itself. The a2dCameleonInst instance in the
50  parent diagram, defines a reference to an a2dAppearance in an a2dCameleon, which can be an a2dSymbol or a2dDiagram.
51  a2dPort is used within a2dSymbol or a2dDiagram, to define the connecting pins at the parent level.
52  The a2dPort is translated into an a2dParPin within each placed a2dCameleonInst instance.
53 */
54 class a2dPort : public a2dCanvasObject
55 {
56 public:
57 
58  //! Constructor.
59  a2dPort();
60 
61  //! Constructor.
62  a2dPort( double x, double y, const wxString& name = wxEmptyString, a2dPinClass* pinclass = a2dPinClass::Standard, a2dPinClass* parPinclass = a2dPinClass::Standard );
63 
64  //! Copy constructor
65  a2dPort( const a2dPort& other, CloneOptions options, a2dRefMap* refs );
66 
67  ~a2dPort();
68 
69  //! get absolute angle of the pin ( after applying the parent its matrix and it own matrix )
70  double GetAngle() const { return m_lworld.GetRotation(); }
71 
72  a2dPin* GetPin() const;
73 
74  wxString GetName() { return m_name; }
75 
76  void SetName( const wxString& name ) { m_name = name; }
77 
78  static void Set( double l1, double l2, double l3, double b );
79 
80  // to temporarily disable rendering ( like when rendering from a2dCameleonInst )
81  static void SetDoRender( bool doRender ) { m_doRender = doRender; }
82 
83  //! set pinclass to be used for a2dParPin to generate when making instances from a2dCameleons using this port
84  void SetParPinClass( a2dPinClass* parPinClass ) { m_parPinClass = parPinClass; }
85 
86  //! get pinclass to be used for a2dParPin to generate when making instances from a2dCameleons using this port
87  a2dPinClass* GetParPinClass() const { return m_parPinClass; }
88 
89 protected:
90 
91  // Documented in base class
92  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
93 
94  void DoRender( a2dIterC& ic, OVERLAP clipparent );
95 
96  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
97 
98  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
99 
100  wxString m_name;
101 
102  //! length from top of arrow to outside points in X
103  static double m_l1;
104 
105  //! length from top of arrow to inside point in X
106  static double m_l2;
107 
108  //! length from top of arrow to inside point in X
109  static double m_l3;
110 
111  //! base of arrow
112  static double m_b;
113 
114  static bool m_doRender;
115 
116  a2dPinClass* m_parPinClass;
117 
118 private:
119  DECLARE_DYNAMIC_CLASS( a2dPort )
120 };
121 
122 //! class to define a set of properties/parameters on derived classes.
124 {
125 public:
126  //! Constructor.
127  a2dHasParameters( double x = 0, double y = 0 );
128 
129  //! Copy constructor
130  a2dHasParameters( const a2dHasParameters& other, CloneOptions options, a2dRefMap* refs );
131 
132  ~a2dHasParameters();
133 
134  void AddStringParameter( const wxString& name, const wxString& value );
135 
136  void AddIntegerParameter( const wxString& name, wxInt32 value );
137 
138  void AddBoolParameter( const wxString& name, bool value );
139 
140  void AddDoubleParameter( const wxString& name, double value );
141 
142  void TakeParameters( a2dHasParameters* parInst ) const;
143 
144  void SetParameter( a2dPropertyId *dynproperty, a2dNamedProperty* namedproperty );
145 
146  a2dPropertyId* GetParameterId( const wxString &idName ) const;
147 
148  a2dNamedProperty* GetParameter( const wxString &idName ) const;
149 
150  a2dNamedProperty* GetParameter( a2dPropertyIdPtr id ) const;
151 
152  a2dParameterMap& GetParameters() { return m_parametermap; }
153 
154 protected:
155 
156  // Documented in base class
157  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
158 
159  a2dParameterMap m_parametermap;
160 
161 private:
162  DECLARE_DYNAMIC_CLASS( a2dHasParameters )
163 };
164 
165 //! a2dParPin points to a2dPort
166 /*!
167  This pin is part of a a2dCameleonInst, and used to connect canvasobject with a2dPin's.
168  The a2dParPin is synchronized with a a2dPort on a a2dSymbol or a2dDiagram.
169  The a2dParPin refers to an a2dPort, and if the a2dPort is shifted or removed, the a2dCameleonInst is
170  updated to reflect the change.
171 */
172 class a2dParPin : public a2dPin
173 {
174 public:
175 
176  //! Constructor.
177  a2dParPin();
178 
179  a2dParPin( a2dCameleonInst* parent, a2dPort* portPin, a2dPinClass* parPinClass );
180 
181  a2dParPin( a2dPinClass* parPinClass, double w, double h );
182 
183  //! Copy constructor
184  a2dParPin( const a2dParPin& other, CloneOptions options, a2dRefMap* refs );
185 
186  ~a2dParPin();
187 
188  void SetPort( a2dPort* portPin ) { m_port = portPin; }
189 
190  a2dPort* GetPort() { return m_port; }
191 
192  bool LinkReference( a2dObject* other );
193 
194 protected:
195 
196  // Documented in base class
197  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
198 
199 #if wxART2D_USE_CVGIO
200  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
201  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
202 #endif //wxART2D_USE_CVGIO
203 
204  a2dSmrtPtr<a2dPort> m_port;
205 
206 private:
207 
208  DECLARE_DYNAMIC_CLASS( a2dParPin )
209 };
210 
211 //! Base class for adding to the list of appearances in a a2dCameleon
212 /*!
213  An a2dCameleon can have various ways to look at it ( appearance ).
214  Derive an appearance from here, to add to the a2dCameleon appearances list.
215  An a2dCameleonInst, will point to one of the appearances in the a2dCameleon.
216 */
218 {
219 public:
220  //! Constructor.
221  a2dAppear( a2dCameleon* cameleon, double x = 0, double y = 0 );
222 
223  //! Copy constructor
224  a2dAppear( const a2dAppear& other, CloneOptions options, a2dRefMap* refs );
225 
226  ~a2dAppear();
227 
228  //! this appearance is for the returned a2dCameleon here.
230 
231  //! this appearance is from this a2dCameleon
232  void SetCameleon( a2dCameleon* cam ) { m_cameleon = cam; }
233 
234  //! next line is higher in Y if true or lower if false
235  static void SetNextLineDirection( bool up ) { m_nextLine = up; }
236  //! next line is higher in Y if true or lower if false
237  static bool GetNextLineDirection() { return m_nextLine; }
238 
239 protected:
240 
241  // Documented in base class
242  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
243 
244 #if wxART2D_USE_CVGIO
245  // Documented in base class
246  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
247  // Documented in base class
248  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
249 #endif //wxART2D_USE_CVGIO
250 
251 protected:
252 
253  //! point to the a2dCameleon of which this appearance is a part.
255  static bool m_nextLine;
256 
257  DECLARE_CLASS( a2dAppear )
258 };
259 
260 
261 //! a2dCameleonInst to show one appearance of an a2dCameleon.
262 /*!
263  Holds a pointer to an instance of an a2dCameleon object.
264  The a2dCameleon is the template for creating this instance.
265  The appearance chosen of the a2dCameleon defines how the instance is shown.
266  If the input is a a2dSymbol, the symbol of the a2dCameleon is used etc.
267  The pins are of type a2dParPin, which will be automatically created from an a2dSymbol of the a2dCameleon,
268  In case of a a2dDiagram refernce, they are based upon the a2dDiagram its a2dPort's.
269  The rendering is done using the same a2dSymbol, or when referencing a diagram, rendering is
270  as the a2dDiagram.
271 */
273 {
274 public:
275 
276  a2dCameleonInst( double x = 0, double y = 0, a2dSymbol* symbol = NULL );
277 
278  //! Constructor.
279  a2dCameleonInst( double x , double y , a2dDiagram* diagram );
280 
281  a2dCameleonInst( double x , double y , const wxString& appearanceName );
282 
283  //! Copy constructor
284  a2dCameleonInst( const a2dCameleonInst& other, CloneOptions options, a2dRefMap* refs );
285 
286  ~a2dCameleonInst();
287 
288  void SetAppearanceName( const wxString& appearanceName );
289 
290  void SetAppearance( a2dAppear* appearance );
291 
292  //! get referenced a2dCameleon
294 
295  //! get referenced a2dCameleon
297 
298  //! find equivalent a2dParPin voor the given a2dPort.
300 
301  //! when resolving this refrence via a a2dIOHandler, this is used.
302  virtual bool LinkReference( a2dObject* other );
303 
304  void MakeReferencesUnique();
305 
306  bool IsRecursive() { return true; }
307 
308  virtual a2dCanvasObject* PushInto( a2dCanvasObject* parent );
309 
310  //! gives time when an update on the a2dCameleon was processed
311  /*!
312  Comparing this time with a a2dCameleon its own update time, one can easily keep them up to date.
313  */
314  wxDateTime& GetCameleonUpdateTime() { return m_CameleonUpdateTime; }
315 
316  //! make the update time Now
317  void TriggerCameleonUpdateTime() { m_CameleonUpdateTime = wxDateTime::Now(); }
318 
319  void DependencyPending( a2dWalkerIOHandler* handler );
320 
321  a2dPort* HasPort( a2dDrawing* drawing, a2dParPin* parPin );
322 
323  //! synchronize pins here to the a2dPorts in the drawing.
324  void SyncPinsTo( a2dDrawing* drawing );
325 
326  //! bring the contents in a2dSymbol or a2dDiagram to parent.
327  void Flatten( a2dCanvasObject* parent );
328 
329 protected:
330 
331  // Documented in base class
332  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
333 
334  virtual void DoWalker( wxObject* parent, a2dWalkerIOHandler& handler );
335 
336  void DoRender( a2dIterC& ic, OVERLAP clipparent );
337 
338  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
339 
340  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
341 
342  bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
343 
344 #if wxART2D_USE_CVGIO
345  void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
346 
347  void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
348 #endif //wxART2D_USE_CVGIO
349 
350  //! points to an appearance in a2dCameleon
352 
354 
355  //! if m_appearance is not set, this is used to establish link
357 
358  //! gives time when a change was made to the object which effects others
359  /*!
360  */
362 
363 private:
364  DECLARE_DYNAMIC_CLASS( a2dCameleonInst )
365 };
366 
367 //! diagram is an appearance for a2dCameleon
368 /*!
369  An a2dDiagram appearance needs to be added to a a2dCameleon.
370  A diagram appearance is in itself a drawing, which defines a diagram in its childobjects.
371  It can have a2dPorts, to connect the diagram at a higher level.
372 
373  In a typical diagram application, the a2dDiagram drawing would be used to draw a diagram.
374  The a2dDiagram in a2dCameleon dfined the diagra, while an a2dSymbol in the same a2dCameleon, defines
375  the appearance at a higher level.
376  At a higher level a2dSymbol is used to present the a2dCameleon using an a2dCameleonInst instance.
377  A higher level diagram can consist of connected a2dSymbol's. Connections made by a2dParPin objects.
378  But any other a2dCanvasObject object can be part of the drawing.
379  In a hierarchycal diagram, each diagram has in and out a2dPort objects,
380  which are synchronized with the a2dSymbol being part of the same a2dCameleon.
381 */
382 class a2dDiagram : public a2dAppear
383 {
384  DECLARE_EVENT_TABLE()
385 
386 public:
387 
388  a2dDiagram();
389 
390  //! Constructor.
391  a2dDiagram( a2dCameleon* cameleon, double x = 0, double y = 0 );
392 
393  //! Copy constructor
394  a2dDiagram( const a2dDiagram& other, CloneOptions options, a2dRefMap* refs );
395 
396  ~a2dDiagram();
397 
398  //! a2dPort objects result in pins for the instance
399  void TakePortsTo( a2dCameleonInst* parInst );
400 
401  //! find the port in the diagram that is most left up.
402  /*!
403  This port will be used to modify origin to this port its point diagram drawing.
404  */
405  a2dPort* FindLeftUp() const;
406 
407  //! origin of drawing is shifted to the pos given.
408  void TranslateTo( double dx, double dy );
409 
410  //! search a2dPort in this a2dDiagram with same name as input a2dPort (coming from e.g a a2dSymbol)
411  a2dPort* FindPort( a2dPort* symPin ) const;
412 
413  //! search a2dPort in a2dDiagram with same name in a2dParPin (coming from a a2dCameleonInst)
414  a2dPort* FindPort( a2dParPin* parPin ) const;
415 
416  //! find a2dPort with given name.
417  a2dPort* FindPortByName( const wxString& parPinName ) const;
418 
419  a2dDrawing* GetDrawing() const { return m_diagramDrawing; }
420 
422 
423  void AppendToDrawing( a2dCanvasObject* obj ) { m_diagramDrawing->GetRootObject()->Append( obj ); }
424 
425  virtual void DependencyPending( a2dWalkerIOHandler* handler );
426 
427  a2dBoundingBox GetUnTransformedBboxNoPorts() const;
428 
429  //! take visible parameters instances into a pameterized instance, to make them unique per instance.
430  void TakeVisibleParameters( a2dCameleonInst* parInst );
431 
432 protected:
433 
434  // Documented in base class
435  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
436 
437  void DoWalker( wxObject* parent, a2dWalkerIOHandler& handler );
438 
439  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
440 
441  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
442 
443  void DoRender( a2dIterC& ic, OVERLAP clipparent );
444 
445  void OnUpdateFromDrawing( a2dDrawingEvent& event );
446 
447 #if wxART2D_USE_CVGIO
448  // Documented in base class
449  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
450  // Documented in base class
451  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
452 #endif //wxART2D_USE_CVGIO
453 
454  a2dSmrtPtr<a2dDrawing> m_diagramDrawing;
455 
456 private:
457  DECLARE_DYNAMIC_CLASS( a2dDiagram )
458 };
459 
460 typedef a2dDiagram a2dLayout;
461 
462 //! Symbolic appearance for a2dCameleon
463 /*!
464  Symbolic appearance to be added to a a2dCameleon.
465  A symbolic appearance is in itself a drawing, defined in its childobjects.
466  It can have a2dPorts, which will become pins in a a2dCameleonInst.
467  In a typical diagram application, this a2dSymbol drawing would be used to present the a2dCameleon
468  using a a2dCameleonInst instance in a drawing.
469 */
470 class a2dSymbol : public a2dDiagram
471 {
472 public:
473 
474  //! Constructor.
475  a2dSymbol();
476 
477  ~a2dSymbol();
478 
479  //! Constructor.
480  a2dSymbol( a2dCameleon* cameleon, double x = 0, double y = 0 );
481 
482  //! Copy constructor
483  a2dSymbol( const a2dSymbol& other, CloneOptions options, a2dRefMap* refs );
484 
485 protected:
486 
487  // Documented in base class
488  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
489 
490  void DoRender( a2dIterC& ic, OVERLAP clipparent );
491 
492 
493 private:
494  DECLARE_DYNAMIC_CLASS( a2dSymbol )
495 };
496 
497 //!
498 /*!
499 */
500 class a2dBuildIn : public a2dAppear
501 {
502  DECLARE_EVENT_TABLE()
503 
504 public:
505 
506  a2dBuildIn();
507 
508  //! Constructor.
509  a2dBuildIn( a2dCameleon* cameleon, double x = 0, double y = 0, a2dCanvasObject* buildIn = NULL );
510 
511  //! Copy constructor
512  a2dBuildIn( const a2dBuildIn& other, CloneOptions options, a2dRefMap* refs );
513 
514  ~a2dBuildIn();
515 
516  a2dCanvasObject* GetBuildIn() const;
517 
518  void SetBuildIn( a2dCanvasObject* buildIn );
519 
521 
522 protected:
523 
524  // Documented in base class
525  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
526 
527  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
528 
529  virtual void DoWalker( wxObject* parent, a2dWalkerIOHandler& handler );
530 
531  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
532 
533  void DoRender( a2dIterC& ic, OVERLAP clipparent );
534 
535  void OnUpdateFromDrawing( a2dDrawingEvent& event );
536 
537 #if wxART2D_USE_CVGIO
538  // Documented in base class
539  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
540  // Documented in base class
541  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
542 #endif //wxART2D_USE_CVGIO
543 
544  a2dSmrtPtr<a2dDrawing> m_drawing;
545 
546 private:
547  DECLARE_DYNAMIC_CLASS( a2dBuildIn )
548 };
549 
550 
551 //! parameters appearance for a2dCameleon
552 /*!
553  parameters appearance to be added to a a2dCameleon.
554  It can edit and show the parameters as stored in a a2dCameleon.
555 */
556 class a2dParameters : public a2dAppear
557 {
558 public:
559  //! Constructor.
560  a2dParameters( a2dCameleon* cameleon = NULL, double x = 0, double y = 0 );
561 
562  //! Copy constructor
563  a2dParameters( const a2dParameters& other, CloneOptions options, a2dRefMap* refs );
564 
565 protected:
566 
567  // Documented in base class
568  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
569 
570 #if wxART2D_USE_CVGIO
571  // Documented in base class
572  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
573  // Documented in base class
574  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
575 #endif //wxART2D_USE_CVGIO
576 
577 private:
578  DECLARE_DYNAMIC_CLASS( a2dParameters )
579 };
580 
581 //! user interface appearance for a2dCameleon
582 /*!
583  To define a Graphical user interface to set parameters on a a2dCameleon.
584 */
585 class a2dGui : public a2dAppear
586 {
587 public:
588  //! Constructor.
589  a2dGui( a2dCameleon* cameleon = NULL, double x = 0, double y = 0 );
590 
591  //! Copy constructor
592  a2dGui( const a2dGui& other, CloneOptions options, a2dRefMap* refs );
593 
594 protected:
595 
596  // Documented in base class
597  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
598 
599 #if wxART2D_USE_CVGIO
600  // Documented in base class
601  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
602  // Documented in base class
603  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
604 #endif //wxART2D_USE_CVGIO
605 
606 private:
607  DECLARE_DYNAMIC_CLASS( a2dGui )
608 };
609 
610 //! object to show several appearance views on what it contains
611 /*!
612  Like a cameleon, this object changes with its environment.
613  Its appearance differs depending on the context in which it is used.
614 
615  An a2dCameleonInst is used to refernce a a2dCameleon in a higher level drawing.
616  The a2dCameleonInst will reference a specific appearance within the a2dCameleon.
617 
618  The parameters is a list of properties, defining the input parameters to a a2dCameleon.
619  The appearances of an a2dCameleon may depend on its parameters.
620 
621  Visible parameters are displayed in an a2dSymbol, and synchronized with the a2dSymbol
622  being part of the same a2dCameleon.
623 
624  a2dCameleon itself can also be placed in a drawing, but the rendering will be as defined in DoRender().
625  The a2dAppear objects are placed in the a2dDrawing m_appearances.
626  Pushing into a a2dCameleon, will show that drawing.
627 
628  \ingroup canvasobject
629 */
630 class A2DCANVASDLLEXP a2dCameleon: public a2dHasParameters
631 {
632 public:
633  DECLARE_EVENT_TABLE()
634  DECLARE_DYNAMIC_CLASS( a2dCameleon )
635 
636  a2dCameleon( const wxString& name = wxT(""), double x = 0, double y = 0, a2dHabitat* habitat = NULL );
637 
638  a2dCameleon( const a2dCameleon& other, CloneOptions options, a2dRefMap* refs );
639 
640  void DoWalker( wxObject* parent, a2dWalkerIOHandler& handler );
641 
642  ~a2dCameleon();
643 
644  a2dHabitat* GetHabitat() const { return m_habitat; }
645 
646  void SetHabitat( a2dHabitat* habitat ) { m_habitat = habitat; }
647 
648  a2dDrawing* GetAppearances() const { return m_appearances; }
649 
650  void AddAppearance( a2dAppear* appearance );
651 
653 
654  OVERLAP GetClipStatusData( a2dAppear* appearance, a2dIterC& ic, OVERLAP clipparent ) const;
655 
656  void RenderData( a2dAppear* appearance, a2dIterC& ic, OVERLAP clipparent );
657 
658  bool IsHitWorldData( a2dAppear* appearance, a2dIterC& ic, a2dHitEvent& hitEvent );
659 
660  a2dBoundingBox GetUnTransformedBboxData( a2dAppear* appearance, a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
661 
662  bool UpdateData( a2dAppear* appearance, UpdateMode mode );
663 
664  //! Get a specific a2dAppear derived class instance from here.
665  template < typename Tappear >
666  Tappear* GetAppearance( bool autoCreate = false )
667  {
668  Tappear* find;
669  a2dCanvasObjectList::iterator iter = m_appearances->GetRootObject()->GetChildObjectList()->begin();
670  while ( iter != m_appearances->GetRootObject()->GetChildObjectList()->end() )
671  {
672  find = wxDynamicCast( ( *iter ).Get(), Tappear );
673  if ( find )
674  return find;
675  iter++;
676  }
677 
678  // No locallib page present yet, so create it.
679  if ( autoCreate )
680  {
681  find = new Tappear( this );
682  find->SetPosXyPoint( GetSuitblePointForNewAppearance() );
683  m_appearances->GetRootObject()->Append( find );
684  }
685  return find;
686  }
687 
688  //! get appearance by its name
689  a2dAppear* GetAppearanceByName( const wxString& name ) const;
690 
691  //! get appearance by its Classname
692  a2dAppear* GetAppearanceByClassName( const wxString& appearranceClassName ) const;
693 
694  a2dDiagram* GetDiagram( bool autoCreate = false );
695  a2dSymbol* GetSymbol( bool autoCreate = false );
696  a2dBuildIn* GetBuildIn( bool autoCreate = false );
697  a2dGui* GetGui( bool autoCreate = false );
698 
699  //! gives time when a change was made to the cameleon which may effect rendering at a higher level
700  /*!
701  Comparing this time in a2dCameleonInst its own update time, one can easily keep them up to date.
702 
703  e.g. set in SetUpdatesPending()
704  */
705  wxDateTime& GetInternalChangedTime() { return m_changedInternalAccesstime; }
706 
707  //! make the changed time Now
708  void TriggerChangedTime() { m_changedInternalAccesstime = wxDateTime::Now(); }
709 
710  //! return the root where all a2dCameleon's are stored
711  static a2dCanvasObject* GetCameleonRoot() { return ms_centralCameleonRoot; }
712 
713  //! set the root where all a2dCameleon's are stored
714  static void SetCameleonRoot( a2dCanvasObject* cameleonRoot ) { ms_centralCameleonRoot = cameleonRoot; }
715 
716  //! add this to ms_centralCameleonRoot at a suitable position
717  void AddToRoot( bool autoPlace = true );
718 
719  //! x + dx position of next a2dCameleon;
720  static void SetLocationDeltaX( double dx ) { ms_dx = dx; }
721 
722  //! y + dy position of next a2dCameleon;
723  static void SetLocationDeltaY( double dy ) { ms_dy = dy; }
724 
725  //! Get a suitable location for a new a2dCameleon();
726  static a2dPoint2D GetSuitblePoint();
727 
728  a2dPoint2D GetSuitblePointForNewAppearance() const;
729 
730  //! next line is higher in Y if true or lower if false
731  static void SetNextLineDirection( bool up ) { m_nextLine = up; }
732  //! next line is higher in Y if true or lower if false
733  static bool GetNextLineDirection() { return m_nextLine; }
734 
736 
737 protected:
738 
739  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
740 
741  //! track modification of document
742  void OnDoEvent( a2dCommandProcessorEvent& event );
743 
744  //! track modification of document
745  void OnRedoEvent( a2dCommandProcessorEvent& event );
746 
747  //! track modification of document
748  void OnUndoEvent( a2dCommandProcessorEvent& event );
749 
750  //! called when a drawing in a document did change.
751  void OnChangeDrawings( a2dDrawingEvent& event );
752 
753  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
754 
755  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
756 
757  void DoRender( a2dIterC& ic, OVERLAP clipparent );
758 
759 #if wxART2D_USE_CVGIO
760  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
761 
762  void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
763 #endif //wxART2D_USE_CVGIO
764 
765  a2dSmrtPtr<a2dDrawing> m_appearances;
766 
767  a2dParameterMap m_parametermap;
768 
769  //! gives time when a change was made to the object which effects others e.g. a2dCameleonInst
770  /*!
771  */
773 
774  //! when set, a new a2dCameleon object will be added here also.
775  //! In a document framework setting, it is normally set to m_rootObject of the a2dDrawing in the current a2dCanvasDocument.
776  //! All a2dCameleons can be accessed from the a2dCanvasDocument directly.
778 
779  static double ms_y;
780  //! dx position for next a2dCameleon;
781  static double ms_dx;
782  //! dy position for next a2dCameleon;
783  static double ms_dy;
784 
785  static bool m_nextLine;
786 
787  a2dHabitat* m_habitat;
788 };
789 
791 
792 //!(In)Visible parameters that can be added to Canvas Objects.
793 /*!
794  This a2dCanvasObject makes it possible to display and edit parameters, which are normally
795  not visible as part of a a2dCameleon its parameters map.
796  It has a a2dPropertyId member which points to a unique parameter in a a2dCameleon.
797  Normally this object is added as a child to the a a2dCanvasObject.
798 
799  Rendering is done using a2dText object internal, and the text is taken from the parameter as
800  its GetName() + " = " + StringValueRepresentation();
801 */
802 class A2DCANVASDLLEXP a2dVisibleParameter: public a2dText
803 {
804  DECLARE_EVENT_TABLE()
805 
806 public:
807 
808  //! constructor
810 
811  //! constructor copy
812  a2dVisibleParameter( const a2dVisibleParameter& other, CloneOptions options, a2dRefMap* refs );
813 
814  //! constructor to set prop at x,y and angle
815  a2dVisibleParameter( a2dHasParameters* parent, a2dPropertyIdPtr property, double x, double y, double angle = 0 );
816 
817  //! constructor to set font and visibility also.
818  a2dVisibleParameter( a2dHasParameters* parent, a2dPropertyIdPtr property, double x, double y, bool visible = true,
819  const a2dFont& font = *a2dDEFAULT_CANVASFONT, double angle = 0 );
820 
821  virtual ~a2dVisibleParameter();
822 
823  //! Show both name and value of the property or just the value.
824  void ShowName( bool show = false );
825 
826  //! to set the parent where the m_propId is searched for.
827  void SetParent( a2dHasParameters* parent );
828 
829  //! to get the parent where the m_propId is searched for.
830  inline a2dHasParameters* GetParent( void ) const { return m_parent; }
831 
832  //! get the id of the property displayed by this object
833  inline const a2dPropertyId* GetPropId() { return m_propId; }
834 
835 #if wxART2D_USE_CVGIO
836  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
837 
838  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
839 #endif //wxART2D_USE_CVGIO
840 
841  void OnChar( wxKeyEvent& event );
842 
843  void OnMouseEvent( a2dCanvasObjectMouseEvent& event );
844 
845  void OnPropertyChanged( a2dComEvent& event );
846 
847  DECLARE_DYNAMIC_CLASS( a2dVisibleParameter );
848 
849 protected:
850 
851  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
852 
853  void DoEndEdit();
854 
855  virtual bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
856 
857  //! object which contains m_propId
859 
860  //! the property id for which the value needs to be displayed.
862 
863  //! Indicates if both name and value of the property are visible, or just the value.
865 
866 private:
867  //!this is a not implemented copy constructor that avoids automatic creation of one
869 };
870 
871 //! a2dCameleonSymbolicRef
872 /*!
873 */
875 {
876 public:
877 
878  a2dCameleonSymbolicRef( double x, double y, a2dCameleon* cameleon );
879 
880  a2dCameleonSymbolicRef( double x, double y, a2dSymbol* symbol );
881 
882  //! Constructor.
883  a2dCameleonSymbolicRef( double x , double y , a2dDiagram* diagram );
884 
885  a2dCameleonSymbolicRef( double x=0 , double y=0 , const wxString& appearanceName = wxEmptyString );
886 
887  //! Copy constructor
889 
891 
892  void SetAppearanceName( const wxString& appearanceName );
893 
894  //! get referenced a2dCameleon
896 
897  //! get referenced a2dCameleon
899 
900  virtual a2dCanvasObject* PushInto( a2dCanvasObject* parent );
901 
902  virtual void DoWalker( wxObject* parent, a2dWalkerIOHandler& handler );
903 
904  bool LinkReference( a2dObject* linkto );
905 
906  //! next line is higher in Y if true or lower if false
907  static void SetNextLineDirection( bool up ) { m_nextLine = up; }
908  //! next line is higher in Y if true or lower if false
909  static bool GetNextLineDirection() { return m_nextLine; }
910 
911 protected:
912 
913  // Documented in base class
914  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
915 
916  a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
917 
918  bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
919 
920  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
921 
922  void DoRender( a2dIterC& ic, OVERLAP clipparent );
923 
924 #if wxART2D_USE_CVGIO
925  void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
926 
927  void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
928 #endif //wxART2D_USE_CVGIO
929 
930  //! points to an appearance in a2dCameleon
932 
934 
935  //! if m_appearance is not set, this is used to establish link
937  wxString m_appearanceClassName;
938 
939  static bool m_nextLine;
940 
941 private:
942  DECLARE_DYNAMIC_CLASS( a2dCameleonSymbolicRef )
943 };
944 
945 
946 //!===================== commands for cameleons =========================
947 
948 //! objects which fit the mask are grouped into a new object
949 /*!
950  \ingroup commands
951 */
952 class A2DCANVASDLLEXP a2dCommand_CreateCameleonMask: public a2dCommand
953 {
954 public:
955  static const a2dCommandId Id;
956 
957  a2dCommand_CreateCameleonMask( a2dCanvasObject* parent, const wxString& name = wxEmptyString, a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED, bool symbol = true ): a2dCommand( true, Id )
958  {
959  m_name = name;
960  m_symbol = symbol;
961  m_parent = parent;
962  m_mask = mask;
963  m_objects = wxNullCanvasObjectList;
964  }
965 
967  {
968  if ( m_objects != wxNullCanvasObjectList )
969  delete m_objects;
970  }
971 
972  bool Do( void );
973 
974  bool Undo( void );
975 
976  inline a2dCanvasCommandProcessor* GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor ); }
977 
978  wxString m_name;
979  bool m_symbol;
981  a2dCanvasObjectPtr m_parent;
982  a2dCanvasObjectList* m_objects;
983  a2dSmrtPtr<a2dCameleon> m_groupobject;
985  a2dlist< long > m_objectsIndex;
986 
987 protected:
988 
989  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
990  {
991  return new a2dCommand_CreateCameleonMask( m_parent, m_name, m_mask );
992  }
993 
994 };
995 
996 //! objects which fit the mask are grouped into a new object
997 /*!
998  \ingroup commands
999 */
1000 class A2DCANVASDLLEXP a2dCommand_FlattenCameleonMask: public a2dCommand
1001 {
1002 public:
1003  static const a2dCommandId Id;
1004 
1006  {
1007  m_parent = parent;
1008  m_mask = mask;
1009  m_deep = deep;
1010  m_objects = wxNullCanvasObjectList;
1011  }
1012 
1014  {
1015  if ( m_objects != wxNullCanvasObjectList )
1016  delete m_objects;
1017  }
1018 
1019  bool Do( void );
1020 
1021  bool Undo( void );
1022 
1023  inline a2dCanvasCommandProcessor* GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor ); }
1024 
1025  a2dCanvasObjectFlagsMask m_mask;
1026  bool m_deep;
1027  a2dCanvasObjectPtr m_parent;
1028  a2dCanvasObjectList* m_objects;
1029  a2dlist< long > m_objectsIndex;
1030 
1031 protected:
1032 
1033  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
1034  {
1035  return new a2dCommand_FlattenCameleonMask( m_parent, m_deep, m_mask );
1036  }
1037 
1038 };
1039 
1040 //! objects which fit the mask are grouped into a new object
1041 /*!
1042  \ingroup commands
1043 */
1045 {
1046 public:
1047  static const a2dCommandId Id;
1048 
1050  {
1051  m_parent = parent;
1052  m_mask = mask;
1053  m_objects = wxNullCanvasObjectList;
1054  m_newobjects = wxNullCanvasObjectList;
1055  }
1056 
1058  {
1059  if ( m_objects != wxNullCanvasObjectList )
1060  delete m_objects;
1061  if ( m_newobjects != wxNullCanvasObjectList )
1062  delete m_newobjects;
1063  }
1064 
1065  bool Do( void );
1066 
1067  bool Undo( void );
1068 
1069  inline a2dCanvasCommandProcessor* GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor ); }
1070 
1071  a2dCanvasObjectFlagsMask m_mask;
1072  a2dCanvasObjectPtr m_parent;
1073  a2dCanvasObjectList* m_objects;
1074  a2dCanvasObjectList* m_newobjects;
1075 
1076 protected:
1077 
1078  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
1079  {
1080  return new a2dCommand_CloneCameleonFromInstMask( m_parent, m_mask );
1081  }
1082 };
1083 
1084 
1085 
1086 BEGIN_DECLARE_EVENT_TYPES()
1087  //!see a2dCameleonEvent \ingroup eventid
1088  DECLARE_EXPORTED_EVENT_TYPE( A2DCANVASDLLEXP, wxEVT_NEW_CAMELEON, 1 )
1089 END_DECLARE_EVENT_TYPES()
1090 
1091 //! used to report a2dCameleon events
1092 /*!
1093  The event Object is a a2dCameleon.
1094 
1095  \ingroup events
1096 
1097 */
1098 class A2DCANVASDLLEXP a2dCameleonEvent : public a2dEvent
1099 {
1100 public:
1101 
1102  //! for event types
1103  /*!
1104  ::wxEVT_REPORT_VIEWS
1105  Sent from a2dDocument to a2dView's. a2dView will add itself to the reportlist of the event, but only
1106  when this document is indeed used by the a2dView.
1107  Register your wxEvtHandler to recieve it.
1108  */
1110  : a2dEvent( 0, wxEVT_NEW_CAMELEON )
1111  {
1112  SetEventObject( cameleon );
1113  }
1114 
1115  //! constructor
1117  : a2dEvent( event )
1118  {
1119  }
1120 
1121  virtual wxEvent* Clone() const { return new a2dCameleonEvent( *this ); }
1122 
1123  a2dCameleon* GetCameleon() { return (a2dCameleon*) GetEventObject(); }
1124 
1125 };
1126 
1127 typedef void ( wxEvtHandler::*a2dCameleonEventFunction )( a2dCameleonEvent& );
1128 #define a2dCameleonEventHandler(func) \
1129  (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(a2dCameleonEventFunction, &func)
1130 
1131 //! event from a document when its views need to be updated
1132 #define EVT_NEW_CAMELEON(func) wx__DECLARE_EVT0( wxEVT_NEW_CAMELEON, a2dCameleonEventHandler( func ))
1133 
1134 
1135 #endif
bool DoUpdate(UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
Update derived Object specific things ( mainly boundingbox)
Definition: cantext.cpp:822
a2dParameters(a2dCameleon *cameleon=NULL, double x=0, double y=0)
Constructor.
Definition: cameleon.cpp:1056
wxPoint2DDouble a2dPoint2D
this to define if coordinate numbers are integer or doubles
Definition: artglob.h:47
see a2dCameleonEvent
Definition: cameleon.h:1098
virtual bool Undo()=0
Override this to undo a command.
user interface appearance for a2dCameleon
Definition: cameleon.h:585
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: cameleon.cpp:51
parameters appearance for a2dCameleon
Definition: cameleon.h:556
(In) Visible property that can be added to Docview Objects.
Definition: gen.h:1785
a2dGui(a2dCameleon *cameleon=NULL, double x=0, double y=0)
Constructor.
Definition: cameleon.cpp:1089
all basic primitives derived from a2dCanvasObject
#define wxDynamicCast(obj, className)
Define wxDynamicCast so that it will give a compiler error for unrelated types.
Definition: gen.h:75
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
Definition: cameleon.cpp:697
a2dHasParameters * GetParent(void) const
to get the parent where the m_propId is searched for.
Definition: cameleon.h:830
virtual void DoWalker(wxObject *parent, a2dWalkerIOHandler &handler)
iterate over this object and its children
Definition: cameleon.cpp:2282
virtual void SetParent(a2dCanvasObject *parent)
set parent object of the pin or some other objects that needs a parent
Definition: canobj.h:2122
diagram is an appearance for a2dCameleon
Definition: cameleon.h:382
see a2dDrawingEvent
Definition: drawing.h:933
mouse event sent from a2dCanvasObject to itself
Definition: canglob.h:223
Port to be used in a diagram for connecting to symbol.
Definition: cameleon.h:54
void Flatten(a2dCanvasObject *parent)
bring the contents in a2dSymbol or a2dDiagram to parent.
Definition: cameleon.cpp:2192
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
Definition: cameleon.cpp:432
a2dPort * FindPortByName(const wxString &parPinName) const
find a2dPort with given name.
Definition: cameleon.cpp:648
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: cameleon.cpp:814
class to map references to objects stored in XML, in order to make the connection later on...
Definition: gen.h:3462
a2dCameleon * GetCameleon()
get referenced a2dCameleon
Definition: cameleon.cpp:2185
bool m_showname
Indicates if both name and value of the property are visible, or just the value.
Definition: cameleon.h:864
virtual bool Do()=0
Override this to perform a command.
a2dCanvasObject * GetRootObject() const
get the root object, which holds the objects in the document
Definition: drawing.h:521
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
Definition: cameleon.cpp:367
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
a2dCameleonEvent(const a2dCameleonEvent &event)
constructor
Definition: cameleon.h:1116
a2dPort * FindPort(a2dPort *symPin) const
search a2dPort in this a2dDiagram with same name as input a2dPort (coming from e.g a a2dSymbol) ...
Definition: cameleon.cpp:620
===================== commands for cameleons =========================
Definition: cameleon.h:952
Ref Counted base object.
Definition: gen.h:1045
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: cameleon.cpp:891
void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
Load object specific CVG data.
Definition: cantext.cpp:536
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: cameleon.cpp:490
bool DoUpdate(UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
Update derived Object specific things ( mainly boundingbox)
Definition: cameleon.cpp:2428
Base class for adding to the list of appearances in a a2dCameleon.
Definition: cameleon.h:217
Defines a font to be set to a2dDrawer2D or stored in a2dCanvsObject etc.
Definition: stylebase.h:779
Input and output handler for the XmlSer format.
Definition: genxmlpars.h:819
UpdateMode
Various mode flags for Update.
Definition: canobj.h:1091
virtual bool LinkReference(a2dObject *other)
when resolving this refrence via a a2dIOHandler, this is used.
Definition: cameleon.cpp:2223
a command processor specially designed to work with a a2dCanvasDocument
Definition: drawing.h:1046
OVERLAP
Result of a a2dBoundingBox intersection or hittest.
Definition: bbox.h:24
a2dParPin points to a2dPort
Definition: cameleon.h:172
static bool GetNextLineDirection()
next line is higher in Y if true or lower if false
Definition: cameleon.h:909
a2dCameleon * m_cameleon
point to the a2dCameleon of which this appearance is a part.
Definition: cameleon.h:254
static void SetLocationDeltaX(double dx)
x + dx position of next a2dCameleon;
Definition: cameleon.h:720
(In)Visible parameters that can be added to Canvas Objects.
Definition: cameleon.h:802
The base class for all drawable objects in a a2dCanvasDocument.
a2dCameleonSymbolicRef
Definition: cameleon.h:874
#define DECLARE_PROPERTIES()
check if class has the given id as a valid id for this object
Definition: gen.h:835
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
Definition: canobj.cpp:5728
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: cameleon.cpp:1876
static double m_l2
length from top of arrow to inside point in X
Definition: cameleon.h:106
a2dParPin()
Constructor.
Definition: cameleon.cpp:294
object to show several appearance views on what it contains
Definition: cameleon.h:630
a2dCanvasObject is the base class for Canvas Objects.
Definition: canobj.h:371
virtual void DoWalker(wxObject *parent, a2dWalkerIOHandler &handler)
iterate over this object and its children
Definition: cameleon.cpp:1007
a2dPort * FindLeftUp() const
find the port in the diagram that is most left up.
Definition: cameleon.cpp:589
wxString m_appearanceName
if m_appearance is not set, this is used to establish link
Definition: cameleon.h:356
void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
Definition: cameleon.cpp:756
a2dBoundingBox DoGetUnTransformedBbox(a2dBboxFlags flags=a2dCANOBJ_BBOX_NON) const
In derived object this should be overriden to calculate the boundingbox of the object without its chi...
Definition: cameleon.cpp:997
Definition: gen.h:276
void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
Definition: cameleon.cpp:254
defenitions an no more
static bool GetNextLineDirection()
next line is higher in Y if true or lower if false
Definition: cameleon.h:237
a2dAppear(a2dCameleon *cameleon, double x=0, double y=0)
Constructor.
Definition: cameleon.cpp:405
special a2dCanvasObject which are used to create hierarchy different from the standard a2dCanvasObjec...
double GetRotation() const
return rotation
Definition: afmatrix.cpp:799
a2dCameleonEvent(a2dCameleon *cameleon)
for event types
Definition: cameleon.h:1109
static double m_l1
length from top of arrow to outside points in X
Definition: cameleon.h:103
bool DoUpdate(UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
Update derived Object specific things ( mainly boundingbox)
Definition: cameleon.cpp:1906
a2dPinClass * GetParPinClass() const
get pinclass to be used for a2dParPin to generate when making instances from a2dCameleons using this ...
Definition: cameleon.h:87
a2dAffineMatrix m_lworld
used for positioning the object (x,y,ang,scale etc.)
Definition: canobj.h:2559
static void SetNextLineDirection(bool up)
next line is higher in Y if true or lower if false
Definition: cameleon.h:235
a2dBoundingBox DoGetUnTransformedBbox(a2dBboxFlags flags=a2dCANOBJ_BBOX_NON) const
In derived object this should be overriden to calculate the boundingbox of the object without its chi...
Definition: cameleon.cpp:245
wxUint64 a2dCanvasObjectFlagsMask
mask flags for a2dCanvasObject
Definition: candefs.h:152
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: cameleon.h:1078
Io handler to iterate through a a2dDocument.
Definition: gen.h:3911
static void SetNextLineDirection(bool up)
next line is higher in Y if true or lower if false
Definition: cameleon.h:731
void OnPropertyChanged(a2dComEvent &event)
Definition: canobj.cpp:2762
a2dBoundingBox DoGetUnTransformedBbox(a2dBboxFlags flags=a2dCANOBJ_BBOX_NON) const
In derived object this should be overriden to calculate the boundingbox of the object without its chi...
Definition: cameleon.cpp:2291
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: cameleon.h:989
a2dText is an abstract base class.
Definition: cantext.h:93
a2dCanvasObjectList * wxNullCanvasObjectList
define a NON a2dCanvasObjectList
Definition: objlist.cpp:53
static a2dCanvasObject * GetCameleonRoot()
return the root where all a2dCameleon&#39;s are stored
Definition: cameleon.h:711
static double ms_dy
dy position for next a2dCameleon;
Definition: cameleon.h:783
a2dBoundingBox DoGetUnTransformedBbox(a2dBboxFlags flags=a2dCANOBJ_BBOX_NON) const
In derived object this should be overriden to calculate the boundingbox of the object without its chi...
Definition: cameleon.cpp:1897
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: cameleon.cpp:421
void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
Definition: cameleon.cpp:2499
a2dCameleon * GetCameleon()
this appearance is for the returned a2dCameleon here.
Definition: cameleon.h:229
a2dSmrtPtr< a2dAppear > m_appearance
points to an appearance in a2dCameleon
Definition: cameleon.h:351
wxDateTime & GetInternalChangedTime()
gives time when a change was made to the cameleon which may effect rendering at a higher level ...
Definition: cameleon.h:705
bool DoIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
Does hit test on the object (exclusif child objects)
Definition: cameleon.cpp:1035
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
Definition: cameleon.cpp:1110
a2dCameleonInst to show one appearance of an a2dCameleon.
Definition: cameleon.h:272
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
Definition: cameleon.cpp:1105
a2dSmrtPtr< a2dAppear > m_appearance
points to an appearance in a2dCameleon
Definition: cameleon.h:931
void DependencyPending(a2dWalkerIOHandler *handler)
called by to check if this object becomes pending as a result of other objects
Definition: cameleon.cpp:2405
#define wxStaticCast(obj, className)
The wxWindows 2.4.2 wxStaticCast is buggy. It evaluates its argument twice.
Definition: gen.h:123
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: cameleon.cpp:2166
a2dCameleon * GetCameleon()
get referenced a2dCameleon
Definition: cameleon.cpp:1888
void TriggerChangedTime()
make the changed time Now
Definition: cameleon.h:708
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
Definition: canobj.cpp:5569
wxDateTime m_changedInternalAccesstime
gives time when a change was made to the object which effects others e.g. a2dCameleonInst ...
Definition: cameleon.h:772
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
Definition: cameleon.cpp:718
void TranslateTo(double dx, double dy)
origin of drawing is shifted to the pos given.
Definition: cameleon.cpp:575
static bool GetNextLineDirection()
next line is higher in Y if true or lower if false
Definition: cameleon.h:733
a2dCanvasObject * PushInto(a2dCanvasObject *parent)
when wanting to traverse hierarchy what level is down here.
Definition: cameleon.cpp:1045
Input and output handler for the XmlSer format.
Definition: genxmlpars.h:862
static const a2dCanvasObjectFlagsMask SELECTED
Definition: candefs.h:180
bool DoIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
Does hit test on the object (exclusif child objects)
Definition: cameleon.cpp:772
void TriggerCameleonUpdateTime()
make the update time Now
Definition: cameleon.h:317
return full boundingbox of derived object
Definition: canobj.h:665
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
Definition: cameleon.cpp:379
Tappear * GetAppearance(bool autoCreate=false)
Get a specific a2dAppear derived class instance from here.
Definition: cameleon.h:666
Symbolic appearance for a2dCameleon.
Definition: cameleon.h:470
a2dAppear * GetAppearance()
get referenced a2dCameleon
Definition: cameleon.h:895
Contains a2dDrawing Class to hold a drawing.
a2dPort()
Constructor.
Definition: cameleon.cpp:181
a2dBoundingBox DoGetUnTransformedBbox(a2dBboxFlags flags=a2dCANOBJ_BBOX_NON) const
In derived object this should be overriden to calculate the boundingbox of the object without its chi...
Definition: cameleon.cpp:746
Each a2dCommand is given a command id at construction.
Definition: comevt.h:99
bool DoIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
Does hit test on the object (exclusif child objects)
Definition: cameleon.cpp:2483
defines common settinsg for a habitat for a set of a2dCameleons.
Definition: canglob.h:439
bool LinkReference(a2dObject *other)
link a reference in the object to the given value
Definition: cameleon.cpp:344
a2dCommand(bool canUndo=false, const a2dCommandId &commandId=sm_noCommandId, const a2dCommandId &commandTypeId=sm_noCommandTypeId, const wxString &menuString=wxEmptyString)
constructor
Definition: comevt.cpp:103
static void SetLocationDeltaY(double dy)
y + dy position of next a2dCameleon;
Definition: cameleon.h:723
a2dPropertyIdPtr m_propId
the property id for which the value needs to be displayed.
Definition: cameleon.h:861
a2dParPin * HasParPinForPort(a2dPort *pin)
find equivalent a2dParPin voor the given a2dPort.
Definition: cameleon.cpp:2322
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
Definition: cameleon.cpp:1073
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: cameleon.h:1033
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: cameleon.cpp:1066
wxDateTime m_CameleonUpdateTime
gives time when a change was made to the object which effects others
Definition: cameleon.h:361
while iterating a a2dCanvasDocument, this holds the context.
Definition: canobj.h:3212
void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
Definition: cameleon.cpp:2525
virtual a2dCanvasObject * PushInto(a2dCanvasObject *parent)
when wanting to traverse hierarchy what level is down here.
Definition: cameleon.cpp:1956
void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
Definition: cameleon.cpp:2034
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: cantext.cpp:169
a2dSymbol()
Constructor.
Definition: cameleon.cpp:789
objects which fit the mask are grouped into a new object
Definition: cameleon.h:1000
const a2dFont * a2dDEFAULT_CANVASFONT
global a2dFont stock object for default font
a2dHasParameters * m_parent
object which contains m_propId
Definition: cameleon.h:858
static double m_l3
length from top of arrow to inside point in X
Definition: cameleon.h:109
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
Write object specific CVG data.
Definition: cantext.cpp:568
void DoWalker(wxObject *parent, a2dWalkerIOHandler &handler)
iterate over this object and its children
Definition: cameleon.cpp:688
void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
Definition: cameleon.cpp:2006
bool LinkReference(a2dObject *linkto)
link a reference in the object to the given value
Definition: cameleon.cpp:1917
void TakePortsTo(a2dCameleonInst *parInst)
a2dPort objects result in pins for the instance
Definition: cameleon.cpp:550
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: cameleon.cpp:1099
virtual a2dCanvasObject * PushInto(a2dCanvasObject *parent)
when wanting to traverse hierarchy what level is down here.
Definition: cameleon.cpp:2271
bool IsRecursive()
returns if this object does have nested objects
Definition: cameleon.h:306
static void SetNextLineDirection(bool up)
next line is higher in Y if true or lower if false
Definition: cameleon.h:907
bool DoIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
Does hit test on the object (exclusif child objects)
Definition: cameleon.cpp:272
virtual void DoWalker(wxObject *parent, a2dWalkerIOHandler &handler)
iterate over this object and its children
Definition: cameleon.cpp:1977
This is the base class for all kinds of property id&#39;s for a2dObject.
Definition: id.h:154
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
Definition: cameleon.cpp:957
list for a2dCanvasObject
static a2dPinClass * Standard
Pins of this class can only connect to pins of the same class.
Definition: canpin.h:766
void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
Definition: cameleon.cpp:1015
a2dAppear * GetAppearance()
get referenced a2dCameleon
Definition: cameleon.h:293
a2dHasParameters(double x=0, double y=0)
Constructor.
Definition: cameleon.cpp:37
virtual void DependencyPending(a2dWalkerIOHandler *handler)
called by to check if this object becomes pending as a result of other objects
Definition: cameleon.cpp:679
Event sent to a2dCommandProcessor.
Definition: comevt.h:701
void SetName(const wxString &name)
Creates the a2dStringProperty PROPID_Name.
Definition: cameleon.h:76
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: cameleon.cpp:215
class to define a set of properties/parameters on derived classes.
Definition: cameleon.h:123
see a2dComEvent
Definition: gen.h:371
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
Definition: cameleon.cpp:1078
void SetParPinClass(a2dPinClass *parPinClass)
set pinclass to be used for a2dParPin to generate when making instances from a2dCameleons using this ...
Definition: cameleon.h:84
void TakeVisibleParameters(a2dCameleonInst *parInst)
take visible parameters instances into a pameterized instance, to make them unique per instance...
Definition: cameleon.cpp:662
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
Definition: bbox.h:39
void SyncPinsTo(a2dDrawing *drawing)
synchronize pins here to the a2dPorts in the drawing.
Definition: cameleon.cpp:2338
virtual a2dCanvasObject * PushInto(a2dCanvasObject *parent)
when wanting to traverse hierarchy what level is down here.
Definition: canobj.cpp:2577
double GetAngle() const
get absolute angle of the pin ( after applying the parent its matrix and it own matrix ) ...
Definition: cameleon.h:70
const a2dPropertyId * GetPropId()
get the id of the property displayed by this object
Definition: cameleon.h:833
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
Definition: cameleon.cpp:427
wxDateTime & GetCameleonUpdateTime()
gives time when an update on the a2dCameleon was processed
Definition: cameleon.h:314
void MakeReferencesUnique()
All direct a2dCanvasObject which are part of this one are made unique.
Definition: cameleon.cpp:2262
static void SetCameleonRoot(a2dCanvasObject *cameleonRoot)
set the root where all a2dCameleon&#39;s are stored
Definition: cameleon.h:714
void Append(a2dCanvasObject *obj)
append a a2dCanvasObject to the childobjects
Definition: canobj.cpp:6224
a2dCanvasObject * PushInto(a2dCanvasObject *parent)
when wanting to traverse hierarchy what level is down here.
Definition: cameleon.cpp:545
static double m_b
base of arrow
Definition: cameleon.h:112
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
Definition: cameleon.cpp:933
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Definition: cameleon.cpp:338
bool DoIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
Does hit test on the object (exclusif child objects)
Definition: cameleon.cpp:2067
void SetCameleon(a2dCameleon *cam)
this appearance is from this a2dCameleon
Definition: cameleon.h:232
list of a2dObject&#39;s
Definition: gen.h:3157
void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
Definition: cameleon.cpp:2445
wxString m_appearanceName
if m_appearance is not set, this is used to establish link
Definition: cameleon.h:936
void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
Definition: cameleon.cpp:1985
CloneOptions
options for cloning
Definition: gen.h:1200
virtual void DoEndEdit()
only used for editable objects and under control of a editing tool.
Definition: cantext.cpp:1026
structure to give as parameter to member functions of a2dCanvasObject
Definition: canobj.h:252
Contain one drawing as hierarchical tree of a2dCanvasObject&#39;s.
Definition: drawing.h:434
void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
Definition: cameleon.cpp:823
objects which fit the mask are grouped into a new object
Definition: cameleon.h:1044
static double ms_dx
dx position for next a2dCameleon;
Definition: cameleon.h:781
static a2dCanvasObject * ms_centralCameleonRoot
Definition: cameleon.h:777
virtual void DoWalker(wxObject *parent, a2dWalkerIOHandler &handler)
iterate over this object and its children
Definition: canobj.cpp:5504
a base command for the a2dCommandProcessor
Definition: comevt.h:140
cameleon.h Source File -- Sun Oct 12 2014 17:04:13 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation