21 #ifndef __WXCAMELEON_H__
22 #define __WXCAMELEON_H__
43 typedef std::map< a2dPropertyIdPtr, a2dNamedPropertyPtr > a2dParameterMap;
74 wxString GetName() {
return m_name; }
76 void SetName(
const wxString& name ) { m_name = name; }
78 static void Set(
double l1,
double l2,
double l3,
double b );
81 static void SetDoRender(
bool doRender ) { m_doRender = doRender; }
114 static bool m_doRender;
119 DECLARE_DYNAMIC_CLASS(
a2dPort )
134 void AddStringParameter(
const wxString& name,
const wxString& value );
136 void AddIntegerParameter(
const wxString& name, wxInt32 value );
138 void AddBoolParameter(
const wxString& name,
bool value );
140 void AddDoubleParameter(
const wxString& name,
double value );
146 a2dPropertyId* GetParameterId(
const wxString &idName )
const;
152 a2dParameterMap& GetParameters() {
return m_parametermap; }
159 a2dParameterMap m_parametermap;
188 void SetPort(
a2dPort* portPin ) { m_port = portPin; }
190 a2dPort* GetPort() {
return m_port; }
199 #if wxART2D_USE_CVGIO
202 #endif //wxART2D_USE_CVGIO
244 #if wxART2D_USE_CVGIO
249 #endif //wxART2D_USE_CVGIO
255 static bool m_nextLine;
281 a2dCameleonInst(
double x ,
double y ,
const wxString& appearanceName );
288 void SetAppearanceName(
const wxString& appearanceName );
290 void SetAppearance(
a2dAppear* appearance );
344 #if wxART2D_USE_CVGIO
348 #endif //wxART2D_USE_CVGIO
384 DECLARE_EVENT_TABLE()
419 a2dDrawing* GetDrawing()
const {
return m_diagramDrawing; }
447 #if wxART2D_USE_CVGIO
452 #endif //wxART2D_USE_CVGIO
502 DECLARE_EVENT_TABLE()
537 #if wxART2D_USE_CVGIO
542 #endif //wxART2D_USE_CVGIO
570 #if wxART2D_USE_CVGIO
575 #endif //wxART2D_USE_CVGIO
599 #if wxART2D_USE_CVGIO
604 #endif //wxART2D_USE_CVGIO
607 DECLARE_DYNAMIC_CLASS(
a2dGui )
633 DECLARE_EVENT_TABLE()
636 a2dCameleon(
const wxString& name = wxT(
""),
double x = 0,
double y = 0,
a2dHabitat* habitat = NULL );
644 a2dHabitat* GetHabitat()
const {
return m_habitat; }
646 void SetHabitat(
a2dHabitat* habitat ) { m_habitat = habitat; }
648 a2dDrawing* GetAppearances()
const {
return m_appearances; }
650 void AddAppearance(
a2dAppear* appearance );
660 a2dBoundingBox GetUnTransformedBboxData(
a2dAppear* appearance, a2dBboxFlags flags = a2dCANOBJ_BBOX_NON )
const;
665 template <
typename Tappear >
669 a2dCanvasObjectList::iterator iter = m_appearances->GetRootObject()->GetChildObjectList()->begin();
670 while ( iter != m_appearances->GetRootObject()->GetChildObjectList()->end() )
681 find =
new Tappear(
this );
682 find->SetPosXyPoint( GetSuitblePointForNewAppearance() );
683 m_appearances->GetRootObject()->Append( find );
689 a2dAppear* GetAppearanceByName(
const wxString& name )
const;
692 a2dAppear* GetAppearanceByClassName(
const wxString& appearranceClassName )
const;
694 a2dDiagram* GetDiagram(
bool autoCreate =
false );
695 a2dSymbol* GetSymbol(
bool autoCreate =
false );
696 a2dBuildIn* GetBuildIn(
bool autoCreate =
false );
697 a2dGui* GetGui(
bool autoCreate =
false );
717 void AddToRoot(
bool autoPlace =
true );
728 a2dPoint2D GetSuitblePointForNewAppearance()
const;
753 a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
759 #if wxART2D_USE_CVGIO
763 #endif //wxART2D_USE_CVGIO
767 a2dParameterMap m_parametermap;
785 static bool m_nextLine;
804 DECLARE_EVENT_TABLE()
824 void ShowName(
bool show =
false );
835 #if wxART2D_USE_CVGIO
839 #endif //wxART2D_USE_CVGIO
841 void OnChar( wxKeyEvent& event );
892 void SetAppearanceName(
const wxString& appearanceName );
924 #if wxART2D_USE_CVGIO
928 #endif //wxART2D_USE_CVGIO
937 wxString m_appearanceClassName;
939 static bool m_nextLine;
1062 delete m_newobjects;
1086 BEGIN_DECLARE_EVENT_TYPES()
1088 DECLARE_EXPORTED_EVENT_TYPE( A2DCANVASDLLEXP, wxEVT_NEW_CAMELEON, 1 )
1089 END_DECLARE_EVENT_TYPES()
1110 : a2dEvent( 0, wxEVT_NEW_CAMELEON )
1112 SetEventObject( cameleon );
1127 typedef void ( wxEvtHandler::*a2dCameleonEventFunction )(
a2dCameleonEvent& );
1128 #define a2dCameleonEventHandler(func) \
1129 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(a2dCameleonEventFunction, &func)
1132 #define EVT_NEW_CAMELEON(func) wx__DECLARE_EVT0( wxEVT_NEW_CAMELEON, a2dCameleonEventHandler( func ))
bool DoUpdate(UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
Update derived Object specific things ( mainly boundingbox)
a2dParameters(a2dCameleon *cameleon=NULL, double x=0, double y=0)
Constructor.
wxPoint2DDouble a2dPoint2D
this to define if coordinate numbers are integer or doubles
virtual bool Undo()=0
Override this to undo a command.
user interface appearance for a2dCameleon
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
parameters appearance for a2dCameleon
(In) Visible property that can be added to Docview Objects.
a2dGui(a2dCameleon *cameleon=NULL, double x=0, double y=0)
Constructor.
all basic primitives derived from a2dCanvasObject
#define wxDynamicCast(obj, className)
Define wxDynamicCast so that it will give a compiler error for unrelated types.
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
a2dHasParameters * GetParent(void) const
to get the parent where the m_propId is searched for.
virtual void DoWalker(wxObject *parent, a2dWalkerIOHandler &handler)
iterate over this object and its children
virtual void SetParent(a2dCanvasObject *parent)
set parent object of the pin or some other objects that needs a parent
diagram is an appearance for a2dCameleon
mouse event sent from a2dCanvasObject to itself
Port to be used in a diagram for connecting to symbol.
void Flatten(a2dCanvasObject *parent)
bring the contents in a2dSymbol or a2dDiagram to parent.
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
a2dPort * FindPortByName(const wxString &parPinName) const
find a2dPort with given name.
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
class to map references to objects stored in XML, in order to make the connection later on...
a2dCameleon * GetCameleon()
get referenced a2dCameleon
bool m_showname
Indicates if both name and value of the property are visible, or just the value.
virtual bool Do()=0
Override this to perform a command.
a2dCanvasObject * GetRootObject() const
get the root object, which holds the objects in the document
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
a2dPin is used in a2dCanvasObject to add pins to it.
This is a class/type description for a2dPin's.
a2dCameleonEvent(const a2dCameleonEvent &event)
constructor
a2dPort * FindPort(a2dPort *symPin) const
search a2dPort in this a2dDiagram with same name as input a2dPort (coming from e.g a a2dSymbol) ...
===================== commands for cameleons =========================
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
Load object specific CVG data.
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
bool DoUpdate(UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
Update derived Object specific things ( mainly boundingbox)
Base class for adding to the list of appearances in a a2dCameleon.
Defines a font to be set to a2dDrawer2D or stored in a2dCanvsObject etc.
Input and output handler for the XmlSer format.
UpdateMode
Various mode flags for Update.
virtual bool LinkReference(a2dObject *other)
when resolving this refrence via a a2dIOHandler, this is used.
a command processor specially designed to work with a a2dCanvasDocument
OVERLAP
Result of a a2dBoundingBox intersection or hittest.
a2dParPin points to a2dPort
static bool GetNextLineDirection()
next line is higher in Y if true or lower if false
a2dCameleon * m_cameleon
point to the a2dCameleon of which this appearance is a part.
static void SetLocationDeltaX(double dx)
x + dx position of next a2dCameleon;
(In)Visible parameters that can be added to Canvas Objects.
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
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
static double m_l2
length from top of arrow to inside point in X
object to show several appearance views on what it contains
a2dCanvasObject is the base class for Canvas Objects.
virtual void DoWalker(wxObject *parent, a2dWalkerIOHandler &handler)
iterate over this object and its children
a2dPort * FindLeftUp() const
find the port in the diagram that is most left up.
wxString m_appearanceName
if m_appearance is not set, this is used to establish link
void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
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...
void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
static bool GetNextLineDirection()
next line is higher in Y if true or lower if false
a2dAppear(a2dCameleon *cameleon, double x=0, double y=0)
Constructor.
special a2dCanvasObject which are used to create hierarchy different from the standard a2dCanvasObjec...
double GetRotation() const
return rotation
a2dCameleonEvent(a2dCameleon *cameleon)
for event types
static double m_l1
length from top of arrow to outside points in X
bool DoUpdate(UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
Update derived Object specific things ( mainly boundingbox)
a2dPinClass * GetParPinClass() const
get pinclass to be used for a2dParPin to generate when making instances from a2dCameleons using this ...
a2dAffineMatrix m_lworld
used for positioning the object (x,y,ang,scale etc.)
static void SetNextLineDirection(bool up)
next line is higher in Y if true or lower if false
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...
wxUint64 a2dCanvasObjectFlagsMask
mask flags for a2dCanvasObject
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Io handler to iterate through a a2dDocument.
static void SetNextLineDirection(bool up)
next line is higher in Y if true or lower if false
void OnPropertyChanged(a2dComEvent &event)
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...
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
a2dText is an abstract base class.
a2dCanvasObjectList * wxNullCanvasObjectList
define a NON a2dCanvasObjectList
static a2dCanvasObject * GetCameleonRoot()
return the root where all a2dCameleon's are stored
static double ms_dy
dy position for next a2dCameleon;
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...
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
a2dCameleon * GetCameleon()
this appearance is for the returned a2dCameleon here.
a2dSmrtPtr< a2dAppear > m_appearance
points to an appearance in a2dCameleon
wxDateTime & GetInternalChangedTime()
gives time when a change was made to the cameleon which may effect rendering at a higher level ...
bool DoIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
Does hit test on the object (exclusif child objects)
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
a2dCameleonInst to show one appearance of an a2dCameleon.
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
a2dSmrtPtr< a2dAppear > m_appearance
points to an appearance in a2dCameleon
void DependencyPending(a2dWalkerIOHandler *handler)
called by to check if this object becomes pending as a result of other objects
#define wxStaticCast(obj, className)
The wxWindows 2.4.2 wxStaticCast is buggy. It evaluates its argument twice.
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
a2dCameleon * GetCameleon()
get referenced a2dCameleon
void TriggerChangedTime()
make the changed time Now
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
wxDateTime m_changedInternalAccesstime
gives time when a change was made to the object which effects others e.g. a2dCameleonInst ...
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
void TranslateTo(double dx, double dy)
origin of drawing is shifted to the pos given.
static bool GetNextLineDirection()
next line is higher in Y if true or lower if false
a2dCanvasObject * PushInto(a2dCanvasObject *parent)
when wanting to traverse hierarchy what level is down here.
Input and output handler for the XmlSer format.
static const a2dCanvasObjectFlagsMask SELECTED
bool DoIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
Does hit test on the object (exclusif child objects)
void TriggerCameleonUpdateTime()
make the update time Now
return full boundingbox of derived object
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
Tappear * GetAppearance(bool autoCreate=false)
Get a specific a2dAppear derived class instance from here.
Symbolic appearance for a2dCameleon.
a2dAppear * GetAppearance()
get referenced a2dCameleon
Contains a2dDrawing Class to hold a drawing.
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...
Each a2dCommand is given a command id at construction.
bool DoIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
Does hit test on the object (exclusif child objects)
defines common settinsg for a habitat for a set of a2dCameleons.
bool LinkReference(a2dObject *other)
link a reference in the object to the given value
a2dCommand(bool canUndo=false, const a2dCommandId &commandId=sm_noCommandId, const a2dCommandId &commandTypeId=sm_noCommandTypeId, const wxString &menuString=wxEmptyString)
constructor
static void SetLocationDeltaY(double dy)
y + dy position of next a2dCameleon;
a2dPropertyIdPtr m_propId
the property id for which the value needs to be displayed.
a2dParPin * HasParPinForPort(a2dPort *pin)
find equivalent a2dParPin voor the given a2dPort.
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
wxDateTime m_CameleonUpdateTime
gives time when a change was made to the object which effects others
while iterating a a2dCanvasDocument, this holds the context.
void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
virtual a2dCanvasObject * PushInto(a2dCanvasObject *parent)
when wanting to traverse hierarchy what level is down here.
void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
objects which fit the mask are grouped into a new object
const a2dFont * a2dDEFAULT_CANVASFONT
global a2dFont stock object for default font
a2dHasParameters * m_parent
object which contains m_propId
static double m_l3
length from top of arrow to inside point in X
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
Write object specific CVG data.
void DoWalker(wxObject *parent, a2dWalkerIOHandler &handler)
iterate over this object and its children
void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
bool LinkReference(a2dObject *linkto)
link a reference in the object to the given value
void TakePortsTo(a2dCameleonInst *parInst)
a2dPort objects result in pins for the instance
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
virtual a2dCanvasObject * PushInto(a2dCanvasObject *parent)
when wanting to traverse hierarchy what level is down here.
bool IsRecursive()
returns if this object does have nested objects
static void SetNextLineDirection(bool up)
next line is higher in Y if true or lower if false
bool DoIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
Does hit test on the object (exclusif child objects)
virtual void DoWalker(wxObject *parent, a2dWalkerIOHandler &handler)
iterate over this object and its children
This is the base class for all kinds of property id's for a2dObject.
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
static a2dPinClass * Standard
Pins of this class can only connect to pins of the same class.
void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
a2dAppear * GetAppearance()
get referenced a2dCameleon
a2dHasParameters(double x=0, double y=0)
Constructor.
virtual void DependencyPending(a2dWalkerIOHandler *handler)
called by to check if this object becomes pending as a result of other objects
Event sent to a2dCommandProcessor.
void SetName(const wxString &name)
Creates the a2dStringProperty PROPID_Name.
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
class to define a set of properties/parameters on derived classes.
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
void SetParPinClass(a2dPinClass *parPinClass)
set pinclass to be used for a2dParPin to generate when making instances from a2dCameleons using this ...
void TakeVisibleParameters(a2dCameleonInst *parInst)
take visible parameters instances into a pameterized instance, to make them unique per instance...
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
void SyncPinsTo(a2dDrawing *drawing)
synchronize pins here to the a2dPorts in the drawing.
virtual a2dCanvasObject * PushInto(a2dCanvasObject *parent)
when wanting to traverse hierarchy what level is down here.
double GetAngle() const
get absolute angle of the pin ( after applying the parent its matrix and it own matrix ) ...
const a2dPropertyId * GetPropId()
get the id of the property displayed by this object
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
wxDateTime & GetCameleonUpdateTime()
gives time when an update on the a2dCameleon was processed
void MakeReferencesUnique()
All direct a2dCanvasObject which are part of this one are made unique.
static void SetCameleonRoot(a2dCanvasObject *cameleonRoot)
set the root where all a2dCameleon's are stored
void Append(a2dCanvasObject *obj)
append a a2dCanvasObject to the childobjects
a2dCanvasObject * PushInto(a2dCanvasObject *parent)
when wanting to traverse hierarchy what level is down here.
static double m_b
base of arrow
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
bool DoIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
Does hit test on the object (exclusif child objects)
void SetCameleon(a2dCameleon *cam)
this appearance is from this a2dCameleon
void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
wxString m_appearanceName
if m_appearance is not set, this is used to establish link
void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
CloneOptions
options for cloning
virtual void DoEndEdit()
only used for editable objects and under control of a editing tool.
structure to give as parameter to member functions of a2dCanvasObject
Contain one drawing as hierarchical tree of a2dCanvasObject's.
void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
objects which fit the mask are grouped into a new object
static double ms_dx
dx position for next a2dCameleon;
static a2dCanvasObject * ms_centralCameleonRoot
virtual void DoWalker(wxObject *parent, a2dWalkerIOHandler &handler)
iterate over this object and its children
a base command for the a2dCommandProcessor