13 #ifndef __WXCANPIN_H__
14 #define __WXCANPIN_H__
51 a2dHandle(
a2dCanvasObject* parent,
double xc,
double yc,
const wxString& name = wxT(
"" ),
double w = 0,
double h = 0,
double angle = 0 ,
double radius = 0 );
56 wxString
GetName()
const {
return m_name; }
59 void SetName(
const wxString& name ) { m_name = name; }
70 void Set(
double xc,
double yc,
double w,
double h,
double angle = 0 ,
double radius = 0 );
78 void Set2(
double xc,
double yc,
const wxString& name = wxT(
"" ) );
102 static void SetWorldBased(
bool worldBased ) { m_worldBased = worldBased; }
104 static bool GetWorldBased() {
return m_worldBased; }
106 #if wxART2D_USE_CVGIO
109 #endif //wxART2D_USE_CVGIO
129 a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
152 static
bool m_worldBased;
162 const static
long sm_HandleNoHit;
163 const static
long sm_HandleHit;
173 #if (defined(__WXMSW__) && defined(WXUSINGDLL) )
182 #if (defined(__WXMSW__) && defined(WXUSINGDLL) )
183 template class A2DCANVASDLLEXP std::allocator<a2dPinClass*>;
184 template class A2DCANVASDLLEXP std::allocator< std::_List_nod<a2dPinClass*, std::allocator<a2dPinClass* > >::_Node >;
185 template class A2DCANVASDLLEXP std::allocator< std::_List_ptr<a2dPinClass*, std::allocator<a2dPinClass* > >::_Nodeptr >;
186 template class A2DCANVASDLLEXP std::list< a2dPinClass* >;
191 #define a2dAnyPin NULL
236 DECLARE_EVENT_TABLE()
240 typedef wxUint16 a2dPinFlagsMask;
260 temporaryObjectPin = temporary | objectPin,
270 a2dPin(
a2dCanvasObject* parent,
const wxString& name,
a2dPinClass* pinclass,
double xc,
double yc,
double angle = 0 ,
double w = 0,
double h = 0,
double radius = 0 );
325 void SetName(
const wxString& name ) { m_name = name; }
335 void Set(
double xc,
double yc,
double angle = 0 ,
const wxString& name = wxT(
"" ),
bool dynamic =
false );
341 double GetAbsX()
const;
344 double GetAbsY()
const;
347 void SetAbsXY(
double x,
double y );
353 double GetAbsAngle()
const;
368 virtual bool MayConnectTo(
a2dPin* connectto );
377 bool Disconnect(
a2dPin* pin = a2dAnyPin,
bool forceErase =
false );
380 void ConnectTo(
a2dPin* connectto );
407 a2dPin* IsDislocated()
const;
410 bool IsSameLocation(
a2dPin* other,
double margin = 0 )
const;
455 a2dPinFlagsMask GetPinFlags()
const;
457 void SetPinFlags( a2dPinFlagsMask which,
bool value );
459 void SetPinFlags( a2dPinFlagsMask which );
465 wxUint32 GetConnectedPinsNr()
const;
469 void CleanUpNonConnected();
472 void DuplicateConnectedToOtherPins(
bool undo =
false );
475 void DuplicateConnectedPins(
a2dPin* other,
bool undo =
false );
478 void RemoveDuplicateConnectedPins(
a2dPin* other );
481 static void SetDoRender(
bool doRender ) { m_doRender = doRender; }
484 static bool GetDoRender() {
return m_doRender; }
490 DECLARE_DYNAMIC_CLASS(
a2dPin )
497 const static
long sm_PinUnConnected;
499 const static
long sm_PinConnected;
501 const static
long sm_PinCanConnect;
503 const static
long sm_PinCannotConnect;
505 const static
long sm_PinCanConnectToPinClass;
513 #if wxART2D_USE_CVGIO
516 #endif //wxART2D_USE_CVGIO
533 virtual void DoDump(
int indent, wxString* line );
565 bool m_dynamicPin: 1;
569 bool m_temporaryPin: 1;
572 bool m_RenderConnected: 1;
595 #if (defined(__WXMSW__) && defined(WXUSINGDLL) )
638 PC_ALLSET = 0xFFFFFFFF
657 static void InitializeStockPinClasses();
660 static void DeleteStockPinClasses();
662 const wxString&
GetName()
const {
return m_name; }
665 bool HasAngleLine()
const {
return ( m_flags & PC_angle ) == PC_angle; }
670 value ? ( m_flags = m_flags | PC_angle ) :
671 m_flags = m_flags & ( PC_ALLSET ^ PC_angle );
691 static a2dPinClass* GetClassByName(
const wxString& name );
694 void SetPin(
a2dPin* newpin );
700 void SetPinCanConnect(
a2dPin* newpin );
704 a2dPin* GetPinCanConnect();
707 void SetPinCannotConnect(
a2dPin* newpin );
711 a2dPin* GetPinCannotConnect();
726 {
return m_connectionGenerator->GetPinClassForTask( const_cast<a2dPinClass*>(
this ), task, obj, pinClassTo, pinFrom ); }
wxPoint2DDouble a2dPoint2D
this to define if coordinate numbers are integer or doubles
void SetConnectionGenerator(a2dConnectionGenerator *connectionGenerator)
Set class for generating new connection objects between object and pins.
virtual bool DoIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
Does hit test on the object (exclusif child objects)
void OnEnterObject(a2dCanvasObjectMouseEvent &event)
called when the mouse enters the object
virtual void SetParent(a2dCanvasObject *parent)
set parent object of the pin or some other objects that needs a parent
wxString m_name
name of the handle
a2dHandle is used inside editing versions of a certain objects.
virtual bool IsTemporary_DontSave() const
Check if this is a temporary object, which should not be saved.
mouse event sent from a2dCanvasObject to itself
a2dConnectTask
flags for searching a connecting a2dpinClass, for the connecting task at hand.
virtual wxString GetName() const
Returns the name of this object, if no name is given the internal id will be returned.
void OnCanvasObjectMouseEvent(a2dCanvasObjectMouseEvent &event)
default handler for mouse events, sent to the object from the a2dDrawingPart.
class to map references to objects stored in XML, in order to make the connection later on...
void SetName(const wxString &name)
set the name of the handle (must be unique)
a2dCanvasOFlags m_flags
holds flags for objects
int GetMode() const
get current mode
a2dPin is used in a2dCanvasObject to add pins to it.
This is a class/type description for a2dPin's.
void AddConnect(a2dPinClass *pinClass)
add a connection pinclass, to which this pin can connect
double GetRadius() const
return radius
virtual bool AlwaysWriteSerializationId() const
If true, always write an id.
static bool m_worldBased
pins are world based or not.
a2dPinClass * m_pinclass
The class defines to which other pins this pin can connect.
Input and output handler for the XmlSer format.
UpdateMode
Various mode flags for Update.
virtual void SetPending(bool pending)
set this object pending for update
OVERLAP
Result of a a2dBoundingBox intersection or hittest.
wxUint32 m_flags
pinclass specific flags
a2dParPin points to a2dPort
The base class for all drawable objects in a a2dCanvasDocument.
#define DECLARE_PROPERTIES()
check if class has the given id as a valid id for this object
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
double m_height
height in pixels
a2dCanvasObject is the base class for Canvas Objects.
a2dCanvasObject * m_parent
what is the a2dCanvasObject that i am part of
wxString GetName() const
get the name given to the handle.
virtual void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
double GetHeight() const
return height
bool HasAngleLine() const
is there an angle line on the pin
wxUint64 a2dCanvasObjectFlagsMask
mask flags for a2dCanvasObject
void SetInternal(bool internal)
set when pin is within the border of its parent
void SetTemporaryPin(bool temporaryPin)
wxString m_name
name of pin class
std::list< a2dPinClass * > & GetConnectList()
return list of connectable pin class objects.
bool GetRenderConnected()
a2dlist< a2dDumbPtr< a2dPin > > m_connectedPins
to which a2dPin is this pin connected with other canvas objects its pins.
double GetHeight() const
return height
void SetMode(int mode)
default used to modify rendering
bool IsObjectPin() const
return true if the pin is on object instead of wire/connects
a2dSmrtPtr< a2dHandle > a2dHandlePtr
smart pointer for a2dHandle
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
static std::list< a2dPinClass * > m_allPinClasses
a linked lists of all a2dPinClass'es, so that one can get a class by name
void OnLeaveObject(a2dCanvasObjectMouseEvent &event)
called when the mouse leaves the object
Input and output handler for the XmlSer format.
double m_radius
radius of rectangle that will be rendered
bool IsInternal() const
see SetInternal()
double m_width
width in pixels
void SetObjectPin(bool objectPin)
set when pin is an object pin
void SetMode(int mode)
you may use it to modify rendering of the object depending on setting
static void SetWorldBased(bool worldBased)
set if pins its size is in world coordinates, else it is in pixels.
bool IsTemporaryPin() const
return true if this pin is a temporary pin
bool IsDynamicPin() const
return true if this pin is a dynamic pin
a2dPinClass * GetPinClass() const
return the pin class of this pin
while iterating a a2dCanvasDocument, this holds the context.
virtual void DrawHighLighted(a2dIterC &ic)
called by Render() if m_flags.m_HighLight is set
a2dlist< a2dDumbPtr< a2dPin > > & GetConnectedPins()
Return list fo connected pins.
a2dCanvasObject * GetParent() const
get parent object of the pin
wxString GetName() const
get the name given to the pin.
void SetRenderConnected(bool RenderConnected)
flag to render connected pin
a2dConnectionGenerator * GetConnectionGenerator() const
Get class for generating new connection objects between object and pins.
int GetMode() const
get the rendering mode of the object.
static a2dPinClass * Standard
Pins of this class can only connect to pins of the same class.
double GetWidth() const
return width
static bool m_doRender
when set disables rending of pin objects
double GetRadius() const
return radius
virtual bool LinkReference(a2dObject *other)
link a reference in the object to the given value
void SetPinClass(a2dPinClass *pinClass)
Set the pin class.
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
void SetDynamicPin(bool dynamicPin)
set when pin is a dynamic pin
wxUint32 GetFlags()
get all flags
virtual 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...
int m_mode
modifies rendering
Classes for generating connection between pins in canvas objects.
static bool GetWorldBased()
get if pin sizes are in world coordinates, else it is in pixels.
static a2dPinClass * Any
used to ask for a new default pin on an object.
virtual bool DoUpdate(UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
Update derived Object specific things ( mainly boundingbox)
This template class is for property ids with a known data type.
a2dConnectionGeneratorPtr m_connectionGenerator
Use this connection generator for wires and pins.
static const a2dCanvasObjectFlagsMask ALL
void SetName(const wxString &name)
set the name of the pin (must be unique)
a2dCanvasObject * GetParent() const
get parent object of the pin
std::list< a2dPinClass * > m_canConnectTo
void SetAngleLine(bool value)
is there an angle line on the pin
double GetWidth() const
return width
CloneOptions
options for cloning
when a new wire or other connection object needs to be created,
structure to give as parameter to member functions of a2dCanvasObject