37 #define text_HEIGHT_FACTOR (1.0/40)
38 #define padding_FACTOR (1.0/100)
59 a2dPlot::a2dPlot(
const a2dPlot& other, CloneOptions options,
a2dRefMap* refs )
66 m_autoPlace = other.m_autoPlace;
67 m_autoYNames = other.m_autoYNames;
72 return new a2dPlot( *
this, options, refs );
75 void a2dPlot::SetPadding(
double leftPadding,
double rightPadding,
double topPadding,
double bottomPadding )
86 if ( title.IsEmpty() )
97 textobj->
SetName( _T(
"__TITLE__" ) );
107 if ( xlabel.IsEmpty() )
117 textobj->
SetName( _T(
"__XLABEL__" ) );
121 if( color != wxNullColour )
129 if ( ylabel.IsEmpty() )
139 textobj->
SetName( _T(
"__Y1LABEL__" ) );
143 if( color != wxNullColour )
151 if ( ylabel.IsEmpty() )
161 textobj->
SetName( _T(
"__Y2LABEL__" ) );
165 if( color != wxNullColour )
174 title->
SetName( _T(
"__TITLE__" ) );
191 showm->
SetName( _T(
"__SHOWM__" ) );
207 xLabelTextDc->
SetName( _T(
"__XLABEL__" ) );
224 yLabelTextDc->
SetName( _T(
"__Y1LABEL__" ) );
241 yLabelTextDc->
SetName( _T(
"__Y2LABEL__" ) );
328 if( !axisName.IsEmpty() )
337 if( !axisName.IsEmpty() )
424 xLabelTextDc->
SetPosXY( minx + width / 2,
446 SetPosYLabel( y1LabelTextDc, minx -
m_leftPadding, miny + height / 2, height,
true );
466 SetPosYLabel( y2LabelTextDc, maxx +
m_rightPadding, miny + height / 2, height,
false );
491 markerShow->
SetPosXY( minx + width / 2.0, miny );
505 void a2dPlot::SetPosYLabel(
a2dText* yLabelTextDc,
double x,
double y,
double tHeight,
bool left )
509 int alignment = wxMIDX;
511 alignment |= left ? wxMAXX : wxMINX;
512 else if ( yangle == -90 )
513 alignment |= left ? wxMAXY : wxMINY;
515 alignment |= left ? wxMINY : wxMAXY;
553 hittext = titleTextDc->
IsHitWorld( iclocal, hitevent );
555 if ( !hittext && xLabelTextDc )
556 hittext = xLabelTextDc->
IsHitWorld( iclocal, hitevent );
558 if ( !hittext && y1LabelTextDc )
559 hittext = y1LabelTextDc->
IsHitWorld( iclocal, hitevent );
561 if ( !hittext && y2LabelTextDc )
562 hittext = y2LabelTextDc->
IsHitWorld( iclocal, hitevent );
564 if( !hittext && markerShow )
565 hittext = markerShow->
IsHitWorld( iclocal, hitevent );
569 #if wxART2D_USE_EDITOR
576 #else //wxART2D_USE_EDITOR
577 wxMessageBox( wxT(
"Need editor module enabled for this" ) );
578 #endif //wxART2D_USE_EDITOR
593 #if wxART2D_USE_CVGIO
597 if ( xmlparts == a2dXmlSer_attrib )
599 out.WriteAttribute( _T(
"autoPlace" ) , m_autoPlace );
600 out.WriteAttribute( _T(
"topPadding" ) ,
m_topPadding );
614 if ( xmlparts == a2dXmlSer_attrib )
626 #endif //wxART2D_USE_CVGIO
639 m_curveGroup->
Walker(
this, handler );
646 EVT_CHAR( a2dCurveGroupLegend::OnChar )
656 void a2dCurveGroupLegend::OnChar( wxKeyEvent& event )
663 m_curveGroup = curveGroup;
669 a2dCurveGroupLegend::~a2dCurveGroupLegend()
673 a2dCurveGroupLegend::a2dCurveGroupLegend(
const a2dCurveGroupLegend& other, CloneOptions options,
a2dRefMap* refs )
676 m_curveGroup = other.m_curveGroup;
678 m_format = other.m_format;
684 return new a2dCurveGroupLegend( *
this, options, refs );
708 for(
size_t i = 0; i < areaList.GetCount(); i++ )
718 form.Printf( m_format, item->
GetName().c_str() );
743 #if wxART2D_USE_CVGIO
748 if ( xmlparts == a2dXmlSer_attrib )
750 out.WriteAttribute( wxT(
"curvegroupname" ) , m_curveGroup->
GetName() );
760 if ( xmlparts == a2dXmlSer_attrib )
769 #endif //wxART2D_USE_CVGIO
773 if( !m_format.IsEmpty() )
782 for(
size_t i = 0; i < areaList.GetCount(); i++ )
792 form.Printf( m_format, item->
GetName().c_str() );
a2dHit m_how
return in which way the object was hit (stroke, fill, ...)
Display Part of a a2dDrawing, in which a2dCanvasObjects are shown.
wxPoint2DDouble a2dPoint2D
this to define if coordinate numbers are integer or doubles
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...
double m_relx
(world coordinates) hit point x relative to the canvas object its parent object(s) ...
double GetHeight() const
returns height of the boundingbox
double GetSize() const
Get the font size.
Higher level of data plotting, adding title and legends.
#define wxDynamicCast(obj, className)
Define wxDynamicCast so that it will give a compiler error for unrelated types.
void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
void SetXLabelTextDc(a2dText *xLabelTextDc)
set X label on axis as text object, NULL removes it
bool GetEditable() const
get if the object may be edited
mouse event sent from a2dCanvasObject to itself
void SetY1Label(const wxString &ylabel, const wxColour &color=wxNullColour)
set Y label on axis, empty string removes it
void SetAlignment(int alignment)
Set the position of the anchor point w.r.t the text.
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 wxString GetName() const
Returns the name of this object, if no name is given the internal id will be returned.
const a2dAffineMatrix & GetTransformMatrix() const
get the matrix used to position the object
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
bool RequireAttributeValueBool(const wxString &attrib)
Forces an attribute and returns its boolean value.
class to map references to objects stored in XML, in order to make the connection later on...
a2dCanvasOFlags m_flags
holds flags for objects
a2dSmrtPtr< a2dCurvesArea > m_rightAxisY
the curve area to display the right Y axis
a2dSmrtPtr< a2dCurvesArea > m_leftAxisY
the curve area to display the left Y axis
bool GetPending() const
is this object pending for update?
bool SwitchChildNamed(const wxString &objectname, a2dCanvasObject *newobject)
the object with the given name is released and switched in place to newobject
bool m_pending
set when a2dCanvasObject needs an update (redraw).
virtual bool Update(UpdateMode mode)
Update the state of the object according to its current position etc.
void SetY1LabelTextDc(a2dText *yLabelTextDc)
set Y label on axis as text object, NULL removes it
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 void SetPending(bool pending)
set this object pending for update
OVERLAP
Result of a a2dBoundingBox intersection or hittest.
void SetY2LabelTextDc(a2dText *yLabelTextDc)
set Y label on axis as text object, NULL removes it
double m_linespace
space between the lines
For Showing Marker position of Markers on a Curve.
void SetFont(const a2dFont &font)
set font to use for drawing text
wxUint16 m_layer
layer of object, default wxLAYER_DEFAULT
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
plot a group of curves on a given area in world coordinates.
a2dCanvasObject is the base class for Canvas Objects.
a2dFont m_font
legend font
void SetTitle(const wxString &title)
set title above plot, empty string removes it
wxString GetAxisText() const
get text to display for axis label
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dDerivedCanvasObjectStart
id for a2dWalkEvent issued from within a2dWalkerIOHandler
void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
a2dCanvasObjectList * GetChildObjectList()
get the list where the child objects are stored in.
a2dCanvas uses a2dCanvasView for displaying a view on a a2dCanvasDocument.
double GetRotation() const
return rotation
a2dSmrtPtr< a2dCurvesAreaList > m_axesarealist
internal object used to display the curves in internal coordinates
a2dBoundingBox GetTextExtent(const wxString &string, int alignment=wxMINX|wxMINY, double *w=NULL, double *h=NULL, double *descent=NULL, double *externalLeading=NULL) const
Get the dimensions in world coordinates of the string.
simple curve group with just one a2dCurvesArea in use
void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
void SetPadding(double leftPadding, double rightPadding, double topPadding, double bottomPadding)
extra distance around plot
virtual void SetName(const wxString &name)
Creates the a2dStringProperty PROPID_Name.
bool DoUpdate(UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
Update derived Object specific things ( mainly boundingbox)
a2dCurveObject for objects needing to know its parent a2dCurvesArea.
int ReleaseChild(a2dCanvasObject *obj, bool backwards=false, bool all=false, bool now=false, bool undoCommands=false)
remove the given object from the childobjects
a2dAffineMatrix m_lworld
used for positioning the object (x,y,ang,scale etc.)
void SetDrawerFill(const a2dFill &fill)
Used to set the current fill.
Io handler to iterate through a a2dDocument.
double GetLineHeight() const
Height in world coordinates of one line.
double m_bottomPadding
padding.
void WriteNewLine()
Writes a new line and takes care of indentation.
list for a2dCurvesArea objects
void SetXLabel(const wxString &xlabel, const wxColour &color=wxNullColour)
set X label on axis, empty string removes it
a2dText is an abstract base class.
bool GetValid() const
returns true if boundingbox is calculated properly and therefore its valid flag is set...
void Expand(const a2dPoint2D &, const a2dPoint2D &)
expand boundingbox width two points
const a2dBoundingBox & Translate(a2dPoint2D &)
translate with given vector
double GetMinX() const
get minimum X of the boundingbox
const a2dFont * a2dNullFONT
global a2dFont stock object for NO font
void Walker(wxObject *parent, a2dWalkerIOHandler &handler)
This is used to recursively walk through an object tree.
The point is in the fill area.
a2dDrawer2D * GetDrawer2D() const
get current a2dDrawer2D
#define wxStaticCast(obj, className)
The wxWindows 2.4.2 wxStaticCast is buggy. It evaluates its argument twice.
const wxColour & GetColor() const
get color of axis text
void DoAddPending(a2dIterC &ic)
called by addPending
void SetSpecificFlags(bool setOrClear, a2dCanvasObjectFlagsMask which)
set all bit flags in object that or true in mask to true or false
double m_topPadding
padding.
#define EVT_CANVASOBJECT_MOUSE_EVENT(func)
static event table macro for a2dCanvasObject mouse event
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
Special object group to plot a2dCurve Objects but also any other a2dCanvasObject. ...
void SetMin(double px, double py)
set the bounding box its maximum
Input and output handler for the XmlSer format.
double GetTextHeight() const
get text height in world coordinates
void SetTitleTextDc(a2dText *title)
set title above plot using a text object, NULL removes it
virtual void DrawText(const wxString &text, double x, double y, int alignment=wxMINX|wxMINY, bool Background=true)
Draw text in user coordinates.
wxMouseEvent & GetMouseEvent()
return the original mouse event that was redirected to the a2dCanvasObject
void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
double GetMaxX() const
get maximum X of the boundingbox
static const a2dCanvasObjectFlagsMask DRAGGABLE
void SetMax(double px, double py)
set the bounding box its minimum
bool DoUpdate(UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
Update derived Object specific things ( mainly boundingbox)
while iterating a a2dCanvasDocument, this holds the context.
const a2dCurvesAreaList & GetCurvesAreaList() const
return reference to list of all a2dCurveArea objects used
void MapBbox(const a2dAffineMatrix &matrix)
legend for a group of curves.
void SetStroke(const wxColour &strokecolor, double width=0, a2dStrokeStyle style=a2dSTROKE_SOLID)
Set a stroke for the object which will be used instead of the layer stroke.
void SetText(const wxString &text)
set the text for the object ' ' in string means new line
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.
editing tool for a2dCanvasObject's
double GetMaxY() const
get maximum Y of the boundingbox
double GetWidth() const
returns width of the boundingbox
An object of this class will update a a2dIterC with the required information.
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
void DependencyPending(a2dWalkerIOHandler *handler)
called by to check if this object becomes pending as a result of other objects
void DoWalker(wxObject *parent, a2dWalkerIOHandler &handler)
iterate over this object and its children
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
void SetLayer(wxUint16 layer)
set the layer that is to be rendered
void SetPosXY(double x, double y, bool restrict=false)
set position to x,y
void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
bool m_editingCopy
true if the object needs to be rendered in edit mode.
double m_leftPadding
padding.
a2dCanvasObject * IsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
If the position (x,y) is within the object return this.
bool DoIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
Does hit test on the object (exclusif child objects)
void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
void EnlargeXY(const double MargeX, const double MargeY)
enlarge with the given amount
virtual bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dObject's and derived classes
double GetMinY() const
get minimum Y of the boundingbox
the a2dDrawingPart is a a2dView specially designed for displaying parts of a a2dDrawing. It uses a a2dDrawer2D to actually redraw things from the document, by giving that a2dDrawer2D as drawing context to the document, and telling the document to redraw a certain rectangular area. At that last is what this class is for. It optimizes the areas to be redrawn after object in the document were changed. To do that it combines redraw areas to a minimal set of redrawing areas. All the administration for this and the way things will be redrawn is from this view.
basetype GetPropertyValue(const a2dObject *obj) const
Get the property value in obj.
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dDerivedCanvasObjectEnd
id for a2dWalkEvent issued from within a2dWalkerIOHandler
double m_rightPadding
padding.
bool DoUpdate(UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
Update derived Object specific things ( mainly boundingbox)
a2dDrawingPart * GetDrawingPart() const
get current a2dDrawingPart
a2dBoundingBox m_bbox
boundingbox in world coordinates
double RequireAttributeValueDouble(const wxString &attrib)
Forces an attribute and returns its double value.
a2dCanvasObject * Find(const wxString &objectname, const wxString &classname=wxT(""), a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL, const a2dPropertyId *propid=NULL, const wxString &valueAsString=wxT(""), wxUint32 id=0) const
return the object which fits the filter.
void Append(a2dCanvasObject *obj)
append a a2dCanvasObject to the childobjects
double m_rely
(world coordinates) hit point y relative to the canvas object its parent object(s) ...
CloneOptions
options for cloning
void SetY2Label(const wxString &ylabel, const wxColour &color=wxNullColour)
set Y label on axis, empty string removes it
void SetCorridorPath(bool OnOff, a2dCanvasObject *captureObject=NULL)
to set corridor path ( also to captured object), its a2dCanvasOFlags::IsOnCorridorPath flag is set on...
static a2dPropertyIdRefObject * PROPID_ViewDependent
used for objects that depend on 'aView' view when it comes to size.
structure to give as parameter to member functions of a2dCanvasObject
a2dBoundingBox & GetBbox()
get boundingbox in world coordinates exclusive stroke width relative to its parent ...
void SetMarkerShow(a2dMarkerShow *showm)
set markerShow under plot using a a2dMarkerShow object, NULL removes it
virtual void DoWalker(wxObject *parent, a2dWalkerIOHandler &handler)
iterate over this object and its children
const a2dFill * a2dTRANSPARENT_FILL
global a2dFill stock object for TRANSPARENT filling
base class for curve area in a a2dCurvesAreaList, like used in a2dCanvasXYDisplayGroups ...
static const a2dCanvasObjectFlagsMask PRERENDERASCHILD