00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef __WXPLOTBOX_H__
00013 #define __WXPLOTBOX_H__
00014
00015 #ifndef WX_PRECOMP
00016 #include "wx/wx.h"
00017 #endif
00018
00019 #include "wx/canvas/canobj.h"
00020 #include "wx/canvas/canprim.h"
00021 #include "wx/canvas/candoc.h"
00022 #include "wx/curves/meta.h"
00023
00024
00025
00026
00027
00028
00029
00030
00031 class A2DCURVESDLLEXP a2dPlot : public a2dCanvasXYDisplayGroup
00032 {
00033 A2D_DECLARE_EVENT_TABLE()
00034
00035 public:
00036
00037 a2dPlot( double x = 0, double y = 0 );
00038
00039 a2dPlot( const a2dPlot &other, CloneOptions options );
00040
00041 a2dObject* Clone( CloneOptions options ) const;
00042
00043 virtual ~a2dPlot();
00044
00045
00046 void SetTitle( const wxString& title);
00047
00048
00049 void SetTitleTextDc( a2dText* title );
00050
00051
00052 void SetMarkerShow( a2dMarkerShow* showm );
00053
00054
00055 void SetXLabel( const wxString& xlabel, const wxColour& color = wxNullColour);
00056
00057
00058 void SetXLabelTextDc( a2dText* xLabelTextDc);
00059
00060
00061 void SetYLabel( const wxString& ylabel, const wxColour& color = wxNullColour) {
00062 SetY1Label(ylabel, color); }
00063
00064 void SetYLabelTextDc( a2dText* yLabelTextDc ) {
00065 SetY1LabelTextDc(yLabelTextDc); }
00066
00067
00068 void SetY1Label( const wxString& ylabel, const wxColour& color = wxNullColour);
00069
00070
00071 void SetY1LabelTextDc( a2dText* yLabelTextDc );
00072
00073
00074 void SetY2Label( const wxString& ylabel, const wxColour& color = wxNullColour);
00075
00076
00077 void SetY2LabelTextDc( a2dText* yLabelTextDc );
00078
00079
00080 void SetAutoPlace( bool autoPlace ) { m_autoPlace = autoPlace; }
00081
00082
00083 void SetAutoYAxesNames(bool autoYNames) {
00084 m_autoYNames = autoYNames; SetPending(true);}
00085
00086
00087 void SetPadding( double leftPadding, double rightPadding, double topPadding, double bottomPadding );
00088
00089 DECLARE_DYNAMIC_CLASS(a2dPlot)
00090
00091 protected:
00092
00093 #if wxART2D_USE_CVGIO
00094 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
00095
00096 void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
00097 #endif //wxART2D_USE_CVGIO
00098
00099 void DoRender( a2dIterC& ic, OVERLAP clipparent );
00100
00101 bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
00102
00103 a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
00104
00105 void SetPosYLabel(a2dText* yLabelTextDc, double x, double y, double tHeight, bool left);
00106
00107 private:
00108
00109
00110 void OnCanvasObjectMouseEvent( a2dCanvasObjectMouseEvent& event );
00111
00112 protected:
00113
00114 double m_leftPadding;
00115
00116 double m_bottomPadding;
00117
00118 double m_topPadding;
00119
00120 double m_rightPadding;
00121
00122 bool m_autoPlace;
00123
00124 bool m_autoYNames;
00125
00126 private:
00127
00128 a2dPlot( const a2dPlot &other );
00129 };
00130
00131 #if defined(WXART2D_USINGDLL)
00132 template class A2DCURVESDLLEXP a2dSmrtPtr<a2dPlot>;
00133 #endif
00134
00135
00136
00137
00138
00139 class A2DCURVESDLLEXP a2dCurveGroupLegend : public a2dCanvasObject
00140 {
00141 public:
00142
00143 a2dCurveGroupLegend( const wxString& format = _T("name = %s") , a2dCanvasXYDisplayGroupAreas* curveGroup = 0,
00144 const a2dFont& font = *a2dDEFAULT_CANVASFONT );
00145
00146 a2dCurveGroupLegend( const a2dCurveGroupLegend &other, CloneOptions options );
00147
00148 virtual ~a2dCurveGroupLegend();
00149
00150 virtual a2dObject* Clone( CloneOptions options ) const;
00151
00152 void SetCurveGroup( a2dCanvasXYDisplayGroupAreas* curveGroup ) { m_curveGroup = curveGroup; }
00153
00154 a2dCanvasXYDisplayGroupAreas* GetCurveGroup() const { return m_curveGroup; }
00155
00156 void SetFont( const a2dFont& font) { m_font = font; SetPending(true);}
00157
00158
00159 inline void SetLineSpacing( double linespace )
00160 { m_linespace = linespace; SetPending(true); }
00161
00162 inline double GetLineSpacing() const { return m_linespace; }
00163
00164
00165 inline double GetLineHeight() const { return m_font.GetLineHeight(); }
00166
00167 DECLARE_DYNAMIC_CLASS(a2dCurveGroupLegend)
00168
00169 A2D_DECLARE_EVENT_TABLE()
00170
00171 protected:
00172
00173
00174 void OnChar(wxKeyEvent& event);
00175
00176 void DoWalker( wxObject* parent, a2dWalkerIOHandler& handler );
00177
00178 void DoAddPending( a2dIterC& ic );
00179
00180
00181
00182
00183
00184 void OnCanvasObjectMouseEvent( a2dCanvasObjectMouseEvent& event );
00185
00186 #if wxART2D_USE_CVGIO
00187 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
00188
00189 void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
00190 #endif //wxART2D_USE_CVGIO
00191
00192 void DependencyPending( a2dWalkerIOHandler* WXUNUSED(handler) );
00193
00194 a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
00195
00196 bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
00197
00198 void DoRender( a2dIterC& ic, OVERLAP WXUNUSED(clipparent) );
00199
00200 bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
00201
00202 a2dSmrtPtr<a2dCanvasXYDisplayGroupAreas> m_curveGroup;
00203
00204 wxString m_format;
00205
00206
00207 a2dFont m_font;
00208
00209
00210 double m_linespace;
00211
00212 private:
00213
00214 a2dCurveGroupLegend( const a2dCurveGroupLegend &other );
00215 };
00216
00217
00218
00219 #endif
00220
00221