wxArt2D
connectgen.h
Go to the documentation of this file.
1 /*! \file wx/canvas/connectgen.h
2  \brief Classes for generating connection between pins in canvas objects
3 
4  \author Klaas Holwerda
5 
6  Copyright: 2000-2011 (c) Klaas Holwerda
7 
8  Licence: wxWidgets Licence
9 
10  RCS-ID: $Id: connectgen.h,v 1.85 2009/07/10 19:23:13 titato Exp $
11 */
12 
13 #ifndef __WXCONNECTGEN_H__
14 #define __WXCONNECTGEN_H__
15 
16 #ifndef WX_PRECOMP
17 #include "wx/wx.h"
18 #endif
19 
20 #include "wx/general/genmod.h"
21 #include "wx/canvas/candefs.h"
22 #include "wx/canvas/route.h"
23 
24 class A2DCANVASDLLEXP a2dPinClass;
25 class A2DCANVASDLLEXP a2dCanvasObject;
26 class A2DCANVASDLLEXP a2dPin;
27 class A2DCANVASDLLEXP a2dCanvasObjectList;
28 class A2DCANVASDLLEXP a2dHabitat;
29 
30 //! flags for searching a connecting a2dpinClass, for the connecting task at hand.
31 /*!
32  The format is:
33 
34  a2d_PinClassWanted_ForPinClassGiven_DirectionFlags
35 
36  ObjectPinClass is the object to which we want to connect
37  ToConnectPinClass is pinclass from where we want to connect to an object
38 
39 */
41 {
42  a2d_FeedBackWireStartPin, //!< Return pinclass and pin
43  a2d_StartWire, //!< find wire/connect pinclass, given start pinclass of start pin
44  a2d_StartWire_BasedOnClassStartPin,
45  a2d_StartWire_BasedOnWireClassRequired,
46  a2d_StartWire_BasedOnObjectClassRequired,
47 
48  a2d_GeneratePinsForStartWire, //!< generate pins, given Connect/wire pinclass
49  a2d_GeneratePinsForFinishWire, //!< generate pins, given Connect/wire pinclass
50 
51  a2d_SearchPinForFinishWire, //!< find normal object pinclass, given Connect/wire pinclass
52  a2d_FinishWire, //!< find normal object pinclass, given Connect/wire pinclass
53 
54  a2d_PinToPin, //! connect pins
55 
56  a2d_GeneratePinsForPinClass, //! generate pins on object given a a2dPinClass
57 };
58 
59 //! when a new wire or other connection object needs to be created,
60 /*! this class or a derived one, will deliver the right connection object.
61  In other situations it will tell which objects are connectable on two pins, and the wire needed for that.
62 
63  The idea is that objects do not only decide themselfs if they can connect to other objects and which.
64  Instead this job is centralized to this class. Because of that, an object does not need to know himself
65  to which objects it can connect, and what wire to use for that. The a2dConnectionGenerator knows which objects
66  can connect to others. Actually in the default situation it is not the canvas object which decides, what can
67  be connected to it. Instead the pinclass of a pin on the canvas object, is the input for the a2dConnectionGenerator.
68  So one asks the a2dConnectionGenerator if a pinclass of a pin on a certain object, can connect to something else.
69 
70  This class here can restrict what is the default way of allowing connections, or implement its own rules.
71  When you want to limit the possible connection you can switch to a derived a2dConnectionGenerator.
72  An a2dConnectionGenerator is shared by a set of a2dPinClass Objects, and this is how one finds the
73  a2dConnectionGenerator for a connection task at hand.
74 
75  As an example of a derived a2dConnectionGenerator:
76  if you want to limit a wire tool to only draw lines from objects which have pins
77  of a specific pin class, overriding GeneratePossibleConnections() can do the job.
78 
79  a2dPinClass itself has information on which other a2dPinClass it may connect to, and two
80  pin classes can only connect if they both agree.
81  a2dPinClass even knows which type of wire/connect object is required to connect the pin to a pin on a wire.
82  So when starting a new wire, at a certain pin, the object and wire its a2dPinClass must be able
83  to connect to one another. A wiretool is only able to connect two pins of objects if
84  the pinclasses in its connect lists are compatible, meaning the one pin contains the other as connectable.
85  If the pin is oke, the found PinClassMap defines what type of wire needs to be created now.
86  This information is stored in the a2dPinClass, as a template wire/connect object.
87  The tool therefore is able to generate a2dCanvasObject connections ( e.g. a2dWirePolylineL wires )
88  of different types, and which type is created depends on the pin that is hit when starting a wire.
89 
90  In the above one canvas object was normal and the connecting canvas object was a wire.
91  Another situation is when two normal canvas objects
92  are dragged appart and a wire needs to be created in between. Again pinclasses of the two a2dPin's that will be
93  disconnected, will be searched in its connect lists, for a wire pincclass, which can connect to both pins.
94  When a wire pinclass is found which can connect to both pins, the type of wire will be created via that same
95  pinclass its template object for a wire. This is achieved CreateConnectObject().
96 
97  To understand the principle, imagine 3 a2dCanvasObject's with pins which have Pin classes.
98  - one with a2dPinClass A
99  - the second with a2dPinClass B
100  - the third with a2dPinClass C
101  Now when A connects to B we want a wire of type X, if A connects to C, we want wire Y,
102  at last when C connects to B we want wire Z.
103  On top of this the direction of the connection can be defined, A to C can be different from C to A.
104  The information on which pin can connect to which other pin, is stored in the a2dPinClass of the a2dPin.
105  Here one can find which other a2dPinClass object can connect to this one, and if it is for a wire, a template object
106  to create that wire.
107 
108  If more B objects are connected to an A object, via multiple wires, the connection of wires to wires must be defined too
109  To conclude we are not only defining the relations between A-B-C, but also the wire begin and end relations towards eachother.
110  In our case here, we create wires which are extensions of the pin where they are connected to, meaning the end pin of the wire
111  is the same as the pinclass to which the begin pin is connected.
112  All this to connect one object pin with pinclass to other objects at a pin with a certain pin class.
113  If we define 3 pinclasses for pins on the object A,B,C and three extra pinclasses WA WB WC for wire between those objects,
114  we get the following connection tables.
115 
116  For the pinclasses which can be connected to each other:
117 
118  - (A-PinClass) -> (B-PinClass) (C-PinClass) (WB-PinClass) (WC-PinClass)
119  - (B-PinClass) -> (A-PinClass) (C-PinClass) (WA-PinClass) (WC-PinClass)
120  - (C-PinClass) -> (A-PinClass) (B-PinClass) (WA-PinClass) (WB-PinClass)
121 
122  We get for wires which start at A or C:
123 
124  - (A-PinClass) -> (WB-PinClass) Wire X (WA-PinClass) -> (B-PinClass)
125  - (A-PinClass) -> (WC-PinClass) Wire Y (WA-PinClass) -> (C-PinClass)
126  - (C-PinClass) -> (WB-PinClass) Wire Z (WC-PinClass) -> (B-PinClass)
127 
128  And if bidirectional wires which start at B or C:
129 
130  - (B-PinClass) -> (WA-PinClass) Wire X (WB-PinClass) -> (A-PinClass)
131  - (C-PinClass) -> (WA-PinClass) Wire Y (WC-PinClass) -> (A-PinClass)
132  - (B-PinClass) -> (WC-PinClass) Wire Z (WB-PinClass) -> (C-PinClass)
133 
134  Interesting in this table is that one can not start a wire on an object, whithout knowing its type, since always two are possible.
135  So a wire tool needs to define for which pinclass a wire is needed, before asking this a2dConnectionGenerator to tell if
136  the object is oke with that. Another option is to start a wire on a starting pin, and only when finishing the wire decide what
137  type of wire is really needed for the begin and end pin of the wire.
138  It is best to give wires other pinclasses then normal objects, since that makes it easier to know if one can start a wire
139  on a certain pin, and what type of wire it needs to be.
140 
141  As an example, drawing a wire using a tool.
142  If the user clicks on an object type pin, the corresponding pin
143  in the newly created wire will be a Non object type pin.
144 
145  At last in the above, there were three objects, but in fact they are of no interest, since the pins its pinclasses define all.
146  This way it is possible to define several "flows" in a group of objects. E.g. You can define in and output pinclasses for each
147  flow you require. Multiple flow pins can be added to the same object, connecting a set of flow pins by one type of wire.
148  You end up with several flows within a group of objects ( control flow - data flow ).
149 
150  Where need a2dConnectionGenerator takes settings from the currently active a2dHabitat: a2dCanvasGlobals->GetHabitat()
151  So if not set already by the currently active view/drawingpart, set it first ( a2dDrawingPart::SetShowObject() ).
152 */
153 class A2DCANVASDLLEXP a2dConnectionGenerator : public a2dObject
154 {
155 
156 
157 public:
158 
160  {
161  StraightSegment, //!< Remove original and replace with one straight segment, dynamic pins move with segment
162  StraightEndSegment, //!< Reuse last straight segment at begin or end of line, dynamic pins move with segment
163  GridRouting, //!< Reroute using Lee routing
164  StraightEndSegmentUnlessPins, //!< Same as StraightEndSegment, unless there are dynamic pins on segment
165  StraightSegmentUnlessPins, //!< Same as StraightSegment, unless there are dynamic pins on segment
166  ManhattanSegments, //!< Remove original and replace with manhattan lines
167  ManhattanEndSegments, //!< Add manhattan lines to end.
168  ManhattanEndSegmentsStay, //!< Keep manhattan lines at end intact.
169  ManhattanEndSegmentsConvertAndStay //!< Convert straight segments to manhattan lines and keep manhattan lines at end intact.
170  };
171 
172  //! constructor
174  //! destructor
176 
177  //! create connection object based on two pins which need to be connected.
178  /*!
179  Called from the default a2dCanvasObject::CreateConnectObject(), in order to easily change the behaviour
180  of standard objects concerning possible connections.
181  The returned object is a (connection) object (e.g. a2dWirePolylineL ), with correct pins at the
182  position of pinThis and pinOther. The pins are connected already.
183  When undo is true, the right commands are sent to the document its command processor.
184  In general this means those commands are part of a group of commands in a a2dCommandGroup,
185  which internal resulted in a connection being created. For example as a result of dragging an object.
186  */
187  virtual a2dCanvasObject* CreateConnectObject( a2dCanvasObject* parent, a2dPin* pinThis, a2dPin* pinOther, bool undo = false ) const;
188 
189  //! create connection object based on two pin classes, which (may) need to be connected.
190  /*!
191  The default just returns m_tmplObject.
192  */
193  virtual a2dCanvasObject* GetConnectTemplate( const a2dCanvasObject* object, a2dPinClass* thisPinClass, const a2dCanvasObject* other, a2dPinClass* otherPinClass ) const;
194 
195  //! set begin state of pins, before a tools starts asking feedback or after tool is finsihed
196  virtual void SetPinsToBeginState( a2dCanvasObject* root, a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::VISIBLE );
197 
198  //! set end state of pins after tool is finsihed
199  virtual void SetPinsToEndState( a2dCanvasObject* root, a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::VISIBLE );
200 
201  //! generate temporary pins to which objects can connect
202  /*!
203  When drawing wires object, other object are asked to display pin position,
204  to which the wire may connect. See a2dCanvasObject::GeneratePinsPossibleConnections(). This process is called by the tools,
205  and is called editing Feedback. The pins created are only temporary, and will be removed at the end of a tool its busy cycle
206  or when needed.
207 
208  The default implementation uses pinClass->GetConnectionGenerator()
209  to ask this object to generate a pin in a2dCanvasObject::GeneratePins(). The reason for this, is that there may be more involved
210  to allow a pin to connect. Like the pin class.
211 
212  \param object The object on which to create temporary pins
213  \param pinClass The pinclass to which the generated pins must be able to connect, if NULL any pinclass
214  \param task for what purpose is the connection needed
215  \param x only connect at this position
216  \param y only connect at this position
217 
218  */
219  virtual bool GeneratePossibleConnections( a2dCanvasObject* object, a2dPinClass* pinClass, a2dConnectTask task, double x, double y, double margin ) const;
220 
221  //! return a a2dPinClass which should be used to connect to the input a2dPinClass.
222  /*!
223  The connection generator searches for a possible connection to the input a2dPinClass in combination
224  with the canvasobject obj if needed.
225 
226  \param pinClass pin class for which to search a connecting PinClass
227  \param task for what purpose is the connection needed
228  \param obj object for which pins are checked / needed.
229 
230  \return If a a2dPinClass is not found NULL is returned.
231  */
232  virtual a2dPinClass* GetPinClassForTask( a2dPinClass* pinClass, a2dConnectTask task, a2dCanvasObject* obj = NULL, a2dPinClass* pinClassTo = NULL, a2dPin* pinFrom = NULL ) const;
233 
234  //! return the pin class for GetPinClassForTask( a2dPinClass::Any )
235  /*!
236  Basic object can generate pins by a2dPinclass, but i8n case of a2dPinClass::Any
237  it will generate pins of this pinclass.
238  */
239  a2dPinClass* GetAnyPinClass() const { return m_anypinclass; }
240 
241  //! see GetAnyPinClass()
242  void SetAnyPinClass( a2dPinClass* pinClass ) { m_anypinclass = pinClass; }
243 
244  a2dPinClass* GetReturnPinClass() const { return m_returnPinClass; }
245 
246  a2dCanvasObject* GetReturnConnect() const { return m_returnConnect; }
247 
248  //! when a wire was created, this return the direction is was created ( first to last pin or visa versa ).
249  bool GetLastConnectCreationDirection() const { return m_reverseCreate; }
250 
251  virtual bool GeneratePinsToConnect( a2dDrawingPart* part, a2dCanvasObject* root, a2dPinClass* pinClassToConnectTo, a2dConnectTask task, double xpin, double ypin, a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::VISIBLE );
252 
253  /*!
254 
255  \param root search in children fromt this.
256  \param pin The pin to which the generated pins must connect
257  \param pinClass The pinclass to which the generated pins must be able to connect, if NULL any pinclass
258  \param margin how close to pinToConnectTo, must the searched pins be.
259  \param mask search only objects with this mask
260 
261  */
262  virtual a2dPin* SearchPinForFinishWire( a2dCanvasObject* root, a2dPin* pinToConnectTo, a2dPinClass* pinClassToConnectTo, double margin, a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::VISIBLE );
263 
264  /*!
265 
266  \param root search in children fromt this.
267  \param xpin The pin x to which the generated pins must connect
268  \param ypin The pin y to which the generated pins must connect
269  \param pinClass The pinclass to which the generated pins must be able to connect, if NULL any pinclass
270  \param margin how close to pinToConnectTo, must the searched pins be.
271  \param mask search only objects with this mask
272 
273  */
274  virtual a2dPin* SearchPinForStartWire( a2dCanvasObject* root, double xpin, double ypin, a2dPinClass* pinClassToConnectTo, double margin, a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::VISIBLE );
275 
276  //! Generate pins on objects, and test which can connect to the given object.
277  /*!
278  Pins in the given canvas object are tested for possible connection to pins on other objects.
279  Meaning if pins of other objects are at the same position as a pin of the given object,
280  a test done, to see if a connection can be made.
281  The connection is not made yet, it is only an indication that connection is possible.
282  This is done by setting the rendering mode for those pins different.
283  The will automatically be re-rendered in idle time.
284 
285  Some canvas objects can create pins automatically. If the pins of the given object, hit another objects,
286  and it can generate pins automatically, this will be done first. Next a connection test on those pins is made.
287  The generated pins are temporary, and if no connection is made, they will be deleted in idle time.
288 
289  \ingroup docalgo
290  */
291  virtual bool GeneratePinsToConnectObject( a2dDrawingPart* part, a2dCanvasObject* root, a2dCanvasObject* connectObject, a2dPinClass* pinClassToConnectTo = NULL, a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::VISIBLE );
292 
293  virtual bool ConnectToPinsObject( a2dCanvasObject* root, a2dCanvasObject* connectObject, double margin, a2dPinClass* pinClassToConnectTo = NULL, a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::VISIBLE );
294 
295  //! the template object is used as a template for creating new wires between pins.
296  /*! You can use it for other purposes as well if needed.
297  This is a template for a new wire.
298  */
299  void SetConnectObject( a2dCanvasObject* tmplObject );
300 
301  //! return connect object.
302  a2dCanvasObject* GetConnectObject() const;
303 
304  void AddRerouteWires( a2dCanvasObjectList* wires, a2dCanvasObject* parentOfWires );
305 
306  void AddRerouteWire( a2dCanvasObject* wire, a2dCanvasObject* parentOfWires );
307 
308  void PrepareForRewire( a2dCanvasObject* parent, a2dCanvasObjectList& dragList, bool walkWires = true, bool selected = false, bool stopAtSelectedWire = false, bool CreateExtraWires = true, a2dBaseTool* tool = NULL, a2dRefMap* refs = NULL );
309 
310  //! create wires on pins which do not have wires, but directly are connected to other objects.
311  /*!
312  This prepares the object for dragging/moving, while preserving the connection, since then wires will
313  be rerouted when dragging.
314  */
315  void CreateWiresOnPins( a2dCanvasObject* parent, const a2dCanvasObjectList& objectsToDrag, bool undo, bool onlyNonSelected = false );
316 
317  void OptimizeRerouteWires( bool removeZero = false );
318 
319  //! Reset clonebrothers
320  /*
321  All clonebrothers in pins are reset to NULL.
322  */
323  void ResetCloneBrother();
324 
325  void ResetPositionsToOrignals();
326 
327  /*! prepare a set of wires for rerouting them.
328 
329 
330  \param tool ointer to the tool it was called from
331  \param resetCloneBrothers if true all clonebrothers in pins are reset to NULL.
332  */
333  void PrepareForRerouteWires( a2dBaseTool* tool = NULL, a2dRefMap* refs = NULL );
334 
335  void RerouteWires( bool final = false, bool fromOriginal = true );
336 
337  //! route also while dragging object
338  void SetRouteWhenDrag( bool routeWhenDrag ) { m_routeWhenDrag = routeWhenDrag; }
339 
340  //! route also while dragging object
341  bool GetRouteWhenDrag() { return m_routeWhenDrag; }
342 
343  //! set the way routing will be done
344  void SetRouteMethod( RouteMethod routing ) { m_routeMethod = routing; }
345 
346  RouteMethod GetRouteMethod() { return m_routeMethod; }
347 
348  wxString GetRouteMethodAsString();
349 
350  //! cycle through routing methods
351  void RotateRouteMethod();
352 
353  //! when optimizing wires, and wire direction (end and begin pins) is not important, this can be set true.
354  //! When true, joining wires which are not in same direction, are redirected.
355  void SetAllowRedirect( bool allowredirect ) { m_allowredirect = allowredirect; }
356 
357  //! see SetAllowRedirect()
358  bool GetAllowRedirect() { return m_allowredirect; }
359 
360  void SetGeneratePins( bool onOff ) { m_generatePins = onOff; }
361 
362  bool GetGeneratePins() const { return m_generatePins; }
363 
364  void SetNoEditCopy( bool noEditCopy ) { m_noEditCopy = noEditCopy; }
365 
366  bool GetNoEditCopy() { return m_noEditCopy; }
367 
368  void SetOffSet( double offset ) { m_offset = offset; }
369  double GetOffSet() const { return m_offset; }
370 
371 protected:
372 
373  void EndManhattanRoute( a2dPin* pin, a2dLineSegment* seg1, a2dLineSegment* seg2, a2dLineSegment* seg3, a2dVertexList* points, bool reverse );
374 
375  a2dCanvasObjectList* m_wires;
376  a2dCanvasObjectList* m_wiresEditCopies;
377 
378  bool m_routeWhenDrag;
379  RouteMethod m_routeMethod;
380 
381  //! Template for created object which represents a connection. e.g a2dWirePolylineL.
383 
384  a2dPinClass* m_returnPinClass;
385 
386  a2dCanvasObject* m_returnConnect;
387 
388  //! template pinclass
390 
391  //! how to create a connection
392  mutable bool m_reverseCreate;
393 
394  bool m_allowredirect;
395 
396  bool m_generatePins;
397 
398  double m_offset;
399 
400 private:
401 
402  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const { return NULL; };
403 
404  a2dSmrtPtr< a2dRouteData > m_routedata;
405 
406  a2dCanvasObject* m_parent;
407 
408  void RerouteWire( a2dWirePolylineL* wire, bool& again );
409  void PrepareGridRoute();
410  void AutoConnect( a2dWirePolylineL* wire, bool allowreconnectbegin, bool allowreconnectend );
411 
412  bool m_noEditCopy;
413 
414 #if wxART2D_USE_CVGIO
415  virtual void DoSave( wxObject* WXUNUSED( parent ), a2dIOHandlerXmlSerOut& WXUNUSED( out ), a2dXmlSer_flag WXUNUSED( xmlparts ), a2dObjectList* WXUNUSED( towrite ) ) { wxASSERT( 0 ); }
416  virtual void DoLoad( wxObject* WXUNUSED( parent ), a2dIOHandlerXmlSerIn& WXUNUSED( parser ), a2dXmlSer_flag WXUNUSED( xmlparts ) ) { wxASSERT( 0 ); }
417 #endif //wxART2D_USE_CVGIO
418 
419 };
420 
421 //! Smart pointer type for a2dConnectionGenerator
422 template class A2DCANVASDLLEXP a2dSmrtPtr<a2dConnectionGenerator>;
423 typedef a2dSmrtPtr<a2dConnectionGenerator> a2dConnectionGeneratorPtr;
424 
425 //! specialized generator for flow on one a2dcanvasObject using wires
426 /*!
427  This a2dConnectionGenerator can be set to a a2dPinClass, and will be called from there.
428 */
430 {
431 
432 public:
433 
434  //! constructor
436  //! destructor
438 
439  virtual a2dPinClass* GetPinClassForTask( a2dPinClass* pinClass, a2dConnectTask task, a2dCanvasObject* obj = NULL, a2dPinClass* pinClassTo = NULL, a2dPin* pinFrom = NULL ) const;
440 
441  //! Pins of this class can only connect to Output pins
443  //! Pins of this class can only connect to Input pins
444  static a2dPinClass* Output;
445 
446 protected:
447 
448  //! Some stuff needed by the ref counting base class
449  virtual a2dObject* Clone( CloneOptions WXUNUSED( options ) ) const { wxASSERT( 0 ); return 0; }
450 
451 private:
452 
453 #if wxART2D_USE_CVGIO
454  virtual void DoSave( wxObject* WXUNUSED( parent ), a2dIOHandlerXmlSerOut& WXUNUSED( out ), a2dXmlSer_flag WXUNUSED( xmlparts ), a2dObjectList* WXUNUSED( towrite ) ) { wxASSERT( 0 ); }
455  virtual void DoLoad( wxObject* WXUNUSED( parent ), a2dIOHandlerXmlSerIn& WXUNUSED( parser ), a2dXmlSer_flag WXUNUSED( xmlparts ) ) { wxASSERT( 0 ); }
456 #endif //wxART2D_USE_CVGIO
457 
458 };
459 
460 //! specialized generator for flow on one a2dcanvasObject using wires
461 /*!
462  This a2dConnectionGenerator can be set to a a2dPinClass, and will be called from there.
463 */
465 {
466 
467 public:
468 
469  //! constructor
471  //! destructor
473 
474  virtual a2dPinClass* GetPinClassForTask( a2dPinClass* pinClass, a2dConnectTask task, a2dCanvasObject* obj = NULL, a2dPinClass* pinClassTo = NULL, a2dPin* pinFrom = NULL ) const;
475 
476  //! Pins of this class can only connect to Wire pins
478  //! Pins of this class can only connect to Object pins
479  static a2dPinClass* Wire;
480 
481 protected:
482 
483  //! Some stuff needed by the ref counting base class
484  virtual a2dObject* Clone( CloneOptions WXUNUSED( options ) ) const { wxASSERT( 0 ); return 0; }
485 
486 private:
487 
488 #if wxART2D_USE_CVGIO
489  virtual void DoSave( wxObject* WXUNUSED( parent ), a2dIOHandlerXmlSerOut& WXUNUSED( out ), a2dXmlSer_flag WXUNUSED( xmlparts ), a2dObjectList* WXUNUSED( towrite ) ) { wxASSERT( 0 ); }
490  virtual void DoLoad( wxObject* WXUNUSED( parent ), a2dIOHandlerXmlSerIn& WXUNUSED( parser ), a2dXmlSer_flag WXUNUSED( xmlparts ) ) { wxASSERT( 0 ); }
491 #endif //wxART2D_USE_CVGIO
492 
493 };
494 
495 //! specialized generator for flow on one a2dcanvasObject using wires
496 /*!
497  This a2dConnectionGenerator can be set to a a2dPinClass, and will be called from there.
498 */
500 {
501 
502 
503 public:
504 
505  //! constructor
507  //! destructor
509 
510  virtual a2dPinClass* GetPinClassForTask( a2dPinClass* pinClass, a2dConnectTask task, a2dCanvasObject* obj = NULL, a2dPinClass* pinClassTo = NULL, a2dPin* pinFrom = NULL ) const;
511 
512  //! Pins of this class can only connect to WireInput pins
514  //! Pins of this class can only connect to WireOutput pins
516  //! Pins of this class can only connect to ObjectInput pins
518  //! Pins of this class can only connect to ObjectOutput pins
520 
521 protected:
522 
523  //! Some stuff needed by the ref counting base class
524  virtual a2dObject* Clone( CloneOptions WXUNUSED( options ) ) const { wxASSERT( 0 ); return 0; }
525 
526 private:
527 
528 #if wxART2D_USE_CVGIO
529  virtual void DoSave( wxObject* WXUNUSED( parent ), a2dIOHandlerXmlSerOut& WXUNUSED( out ), a2dXmlSer_flag WXUNUSED( xmlparts ), a2dObjectList* WXUNUSED( towrite ) ) { wxASSERT( 0 ); }
530  virtual void DoLoad( wxObject* WXUNUSED( parent ), a2dIOHandlerXmlSerIn& WXUNUSED( parser ), a2dXmlSer_flag WXUNUSED( xmlparts ) ) { wxASSERT( 0 ); }
531 #endif //wxART2D_USE_CVGIO
532 
533 };
534 
535 //! specialized generator for two flow on one a2dcanvasObject
536 /*!
537  This a2dConnectionGenerator can be set to a a2dPinClass, and will be called from there.
538 */
540 {
541 
542 
543 public:
544 
545  //! constructor
547 
548  //! destructor
550 
551  virtual a2dPinClass* GetPinClassForTask( a2dPinClass* pinClass, a2dConnectTask task, a2dCanvasObject* obj = NULL, a2dPinClass* pinClassTo = NULL, a2dPin* pinFrom = NULL ) const;
552 
553  virtual a2dCanvasObject* CreateConnectObject( a2dCanvasObject* parent, a2dPin* pinThis, a2dPin* pinOther, bool undo = false ) const;
554 
555  //! Pins of this class can only connect to FlowAWireOutput and FlowAOutput pins
557  //! Pins of this class can only connect to FlowAWireInput and FlowAInput pins
559  //! Pins of this class can only connect to FlowAWireOutput and FlowAOutput pins
561  //! Pins of this class can only connect to FlowAInput and FlowAWireInput pins
563 
564  //! Pins of this class can only connect to FlowBWireOutput and FlowBOutput pins
566  //! Pins of this class can only connect to FlowBWireInput and FlowBInput pins
568  //! Pins of this class can only connect to FlowBWireOutput and FlowBOutput pins
570  //! Pins of this class can only connect to FlowBInput and FlowBWireInput pins
572 
573  //! the template object is used as a template for creating new wires between pins.
574  /*! You can use it for other purposes as well if needed.
575  This is a template for a new wire in FlowB.
576  */
577  void SetConnectObjectFlowB( a2dCanvasObject* tmplObject );
578 
579  //! return connect object.
580  a2dCanvasObject* GetConnectObjectFlowB() const;
581 
582 protected:
583 
584  //! Template for created object which represents a connection. e.g a2dWirePolylineL.
586 
587  //! Some stuff needed by the ref counting base class
588  virtual a2dObject* Clone( CloneOptions WXUNUSED( options ) ) const { wxASSERT( 0 ); return 0; }
589 
590 private:
591 
592 #if wxART2D_USE_CVGIO
593  virtual void DoSave( wxObject* WXUNUSED( parent ), a2dIOHandlerXmlSerOut& WXUNUSED( out ), a2dXmlSer_flag WXUNUSED( xmlparts ), a2dObjectList* WXUNUSED( towrite ) ) { wxASSERT( 0 ); }
594  virtual void DoLoad( wxObject* WXUNUSED( parent ), a2dIOHandlerXmlSerIn& WXUNUSED( parser ), a2dXmlSer_flag WXUNUSED( xmlparts ) ) { wxASSERT( 0 ); }
595 #endif //wxART2D_USE_CVGIO
596 
597 };
598 
599 #endif // WXCANOBJ
600 
601 
Display Part of a a2dDrawing, in which a2dCanvasObjects are shown.
Definition: drawer.h:470
bool GetLastConnectCreationDirection() const
when a wire was created, this return the direction is was created ( first to last pin or visa versa )...
Definition: connectgen.h:249
The a2dBaseTool is used to derive tools from that are controlled by.
Definition: tools.h:379
a2dConnectTask
flags for searching a connecting a2dpinClass, for the connecting task at hand.
Definition: connectgen.h:40
static a2dPinClass * WireOutput
Pins of this class can only connect to ObjectOutput pins.
Definition: connectgen.h:519
a2dCanvasObjectPtr m_tmplObjectFlowB
Template for created object which represents a connection. e.g a2dWirePolylineL.
Definition: connectgen.h:585
Remove original and replace with one straight segment, dynamic pins move with segment.
Definition: connectgen.h:161
generate pins, given Connect/wire pinclass
Definition: connectgen.h:49
class to map references to objects stored in XML, in order to make the connection later on...
Definition: gen.h:3462
static a2dPinClass * Output
Pins of this class can only connect to Input pins.
Definition: connectgen.h:444
Add manhattan lines to end.
Definition: connectgen.h:167
void SetAnyPinClass(a2dPinClass *pinClass)
see GetAnyPinClass()
Definition: connectgen.h:242
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
Ref Counted base object.
Definition: gen.h:1045
static a2dPinClass * Input
Pins of this class can only connect to Output pins.
Definition: connectgen.h:442
generate pins, given Connect/wire pinclass
Definition: connectgen.h:48
static a2dPinClass * Object
Pins of this class can only connect to Wire pins.
Definition: connectgen.h:477
Input and output handler for the XmlSer format.
Definition: genxmlpars.h:819
static a2dPinClass * FlowAWireInput
Pins of this class can only connect to FlowAWireOutput and FlowAOutput pins.
Definition: connectgen.h:560
specialized generator for two flow on one a2dcanvasObject
Definition: connectgen.h:539
Remove original and replace with manhattan lines.
Definition: connectgen.h:166
specialized generator for flow on one a2dcanvasObject using wires
Definition: connectgen.h:464
a2dCanvasObject is the base class for Canvas Objects.
Definition: canobj.h:371
bool GetRouteWhenDrag()
route also while dragging object
Definition: connectgen.h:341
routing of wires.
vertex list of line and arc segments.
Definition: polyver.h:600
defenitions an no more
specialized generator for flow on one a2dcanvasObject using wires
Definition: connectgen.h:499
static a2dPinClass * ObjectInput
Pins of this class can only connect to WireInput pins.
Definition: connectgen.h:513
static a2dPinClass * FlowBWireInput
Pins of this class can only connect to FlowBWireOutput and FlowBOutput pins.
Definition: connectgen.h:569
virtual a2dObject * Clone(CloneOptions options) const
Some stuff needed by the ref counting base class.
Definition: connectgen.h:588
static a2dPinClass * FlowBWireOutput
Pins of this class can only connect to FlowBInput and FlowBWireInput pins.
Definition: connectgen.h:571
find wire/connect pinclass, given start pinclass of start pin
Definition: connectgen.h:43
Return pinclass and pin.
Definition: connectgen.h:42
wxUint64 a2dCanvasObjectFlagsMask
mask flags for a2dCanvasObject
Definition: candefs.h:152
a2dWirePolylineL is a polyline that adjusts itself when the objects it connects move ...
Definition: wire.h:42
a2dPinClass * GetAnyPinClass() const
return the pin class for GetPinClassForTask( a2dPinClass::Any )
Definition: connectgen.h:239
a2dCanvasObjectPtr m_tmplObject
Template for created object which represents a connection. e.g a2dWirePolylineL.
Definition: connectgen.h:382
void SetRouteMethod(RouteMethod routing)
set the way routing will be done
Definition: connectgen.h:344
virtual a2dObject * Clone(CloneOptions options) const
Some stuff needed by the ref counting base class.
Definition: connectgen.h:484
Normal straight line segment in a2dVertexList and a2dVertexArray.
Definition: polyver.h:163
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
Save settings.
Definition: gen.cpp:1657
static a2dPinClass * FlowAInput
Pins of this class can only connect to FlowAWireOutput and FlowAOutput pins.
Definition: connectgen.h:556
Input and output handler for the XmlSer format.
Definition: genxmlpars.h:862
static a2dPinClass * FlowBOutput
Pins of this class can only connect to FlowBWireInput and FlowBInput pins.
Definition: connectgen.h:567
Keep manhattan lines at end intact.
Definition: connectgen.h:168
defines common settinsg for a habitat for a set of a2dCameleons.
Definition: canglob.h:439
Same as StraightSegment, unless there are dynamic pins on segment.
Definition: connectgen.h:165
static a2dPinClass * FlowAWireOutput
Pins of this class can only connect to FlowAInput and FlowAWireInput pins.
Definition: connectgen.h:562
bool m_reverseCreate
how to create a connection
Definition: connectgen.h:392
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
Load settings.
Definition: gen.cpp:1699
general modules header files all together.
Reuse last straight segment at begin or end of line, dynamic pins move with segment.
Definition: connectgen.h:162
static const a2dCanvasObjectFlagsMask VISIBLE
Definition: candefs.h:186
a2dPinClass * m_anypinclass
template pinclass
Definition: connectgen.h:389
virtual a2dObject * Clone(CloneOptions options) const
Some stuff needed by the ref counting base class.
Definition: connectgen.h:524
Same as StraightEndSegment, unless there are dynamic pins on segment.
Definition: connectgen.h:164
specialized generator for flow on one a2dcanvasObject using wires
Definition: connectgen.h:429
static a2dPinClass * FlowAOutput
Pins of this class can only connect to FlowAWireInput and FlowAInput pins.
Definition: connectgen.h:558
void SetAllowRedirect(bool allowredirect)
Definition: connectgen.h:355
find normal object pinclass, given Connect/wire pinclass
Definition: connectgen.h:51
virtual a2dObject * Clone(CloneOptions options) const
Some stuff needed by the ref counting base class.
Definition: connectgen.h:449
static a2dPinClass * ObjectOutput
Pins of this class can only connect to WireOutput pins.
Definition: connectgen.h:515
void SetRouteWhenDrag(bool routeWhenDrag)
route also while dragging object
Definition: connectgen.h:338
Reroute using Lee routing.
Definition: connectgen.h:163
static a2dPinClass * Wire
Pins of this class can only connect to Object pins.
Definition: connectgen.h:479
list of a2dObject&#39;s
Definition: gen.h:3157
static a2dPinClass * FlowBInput
Pins of this class can only connect to FlowBWireOutput and FlowBOutput pins.
Definition: connectgen.h:565
CloneOptions
options for cloning
Definition: gen.h:1200
find normal object pinclass, given Connect/wire pinclass
Definition: connectgen.h:52
bool GetAllowRedirect()
see SetAllowRedirect()
Definition: connectgen.h:358
when a new wire or other connection object needs to be created,
Definition: connectgen.h:153
static a2dPinClass * WireInput
Pins of this class can only connect to ObjectInput pins.
Definition: connectgen.h:517
connectgen.h Source File -- Sun Oct 12 2014 17:04:15 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation