00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef __WXRENDIMG_H__
00012 #define __WXRENDIMG_H__
00013
00014 #ifndef WX_PRECOMP
00015 #include "wx/wx.h"
00016 #endif
00017
00018 #include "wx/canvas/canobj.h"
00019
00020 class A2DCANVASDLLEXP a2dCanvasDocument;
00021
00022 #include "wx/canvas/drawer.h"
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 class A2DEDITORDLLEXP a2dRenderImage: public a2dCanvasObject
00043 {
00044 public:
00045
00046 a2dRenderImage( a2dCanvasDocument* root, a2dCanvasObject* top, double xc, double yc, double w, double h );
00047
00048 virtual ~a2dRenderImage();
00049
00050 a2dRenderImage( const a2dRenderImage &other, CloneOptions options );
00051
00052 virtual a2dObject* Clone( CloneOptions options ) const;
00053
00054 a2dCanvasView* GetCanvasView() { return m_drawer; }
00055
00056
00057 inline bool GetYaxis() const { return m_drawer->GetDrawer2D()->GetYaxis(); }
00058
00059
00060 virtual void SetYaxis(bool up) { m_drawer->GetDrawer2D()->SetYaxis( up ); }
00061
00062
00063 void SetBackgroundFill( const a2dFill& backgroundfill ) { m_drawer->SetBackgroundFill( backgroundfill ); }
00064
00065
00066 a2dFill& GetBackgroundFill() { return m_drawer->GetBackgroundFill(); }
00067
00068
00069 void SetGridAtFront(bool gridatfront) { m_drawer->SetGridAtFront( gridatfront ); }
00070
00071
00072 bool GetGridAtFront(){ return m_drawer->GetGridAtFront(); }
00073
00074
00075 void SetGridStroke( const a2dStroke& gridstroke) { m_drawer->SetGridStroke( gridstroke ); }
00076
00077
00078 void SetGridSize(int gridsize) { m_drawer->SetGridSize( gridsize ); };
00079
00080
00081 void SetGridFill( const a2dFill& gridfill) { m_drawer->SetGridFill( gridfill ); }
00082
00083
00084 double GetGridX(){return m_drawer->GetGridX();}
00085
00086
00087 void SetGridX(double gridx) { m_drawer->SetGridX( gridx); }
00088
00089
00090 double GetGridY(){ return m_drawer->GetGridY(); }
00091
00092
00093 void SetGridY(double gridy) { m_drawer->SetGridY( gridy); }
00094
00095
00096 void SetGrid(bool grid) { m_drawer->SetGrid( grid ); }
00097
00098
00099 bool GetGrid() { return m_drawer->GetGrid(); }
00100
00101
00102 void SetGridLines(bool gridlines) { m_drawer->SetGridLines( gridlines ); }
00103
00104
00105 bool GetGridLines() { return m_drawer->GetGridLines(); }
00106
00107
00108 void SetShowOrigin(bool show) { m_drawer->SetShowOrigin( show); };
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120 void SetMappingWidthHeight( double vx1, double vy1, double width, double height );
00121
00122 void SetMappingUpp( double vx1, double vy1, double xpp, double ypp);
00123
00124
00125 void SetMappingAbs( a2dIterC& ic, double vx1, double vy1, double width, double height );
00126
00127
00128 void SetRenderCanvasDocument(a2dCanvasDocument* aroot);
00129
00130 a2dCanvasDocument* GetCanvasDocument();
00131
00132
00133
00134
00135
00136
00137 a2dCanvasObject* SetShowObject(const wxString& name);
00138
00139
00140
00141
00142
00143 bool SetShowObject(a2dCanvasObject* obj);
00144
00145
00146
00147
00148
00149 a2dCanvasObject* GetShowObject() const;
00150
00151
00152
00153
00154
00155 bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
00156
00157
00158 void SetScaleOnResize(bool val) { m_scaleonresize=val; }
00159
00160
00161 virtual bool GetScaleOnResize() { return m_scaleonresize; }
00162
00163 void SetWidth(double width);
00164 double GetWidth() { return m_width; }
00165
00166 void SetHeight(double height);
00167 double GetHeight() { return m_height; }
00168
00169 a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
00170
00171 protected:
00172
00173 void DoRender( a2dIterC& ic, OVERLAP clipparent );
00174 bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
00175
00176
00177 a2dFill m_backgroundfill;
00178
00179
00180 bool m_showorigin;
00181
00182
00183 bool m_scaleonresize;
00184
00185 double m_width;
00186 double m_height;
00187
00188
00189 private:
00190
00191 a2dSmrtPtr<a2dCanvasView> m_drawer;
00192
00193
00194 bool m_is_cached;
00195 wxImage m_cImage;
00196 bool m_b_is_cached;
00197 wxBitmap m_cBitmap;
00198 int m_cW;
00199 int m_cH;
00200 double m_cR;
00201
00202 DECLARE_CLASS(a2dRenderImage)
00203
00204 private:
00205
00206 a2dRenderImage( const a2dRenderImage &other );
00207 };
00208
00209
00210 #endif
00211
00212