21 #include <wx/wfstream.h>
28 #include "wx/editor/candoc.h"
53 m_drawingPart->SetDrawer2D( drawer2d );
55 m_drawingPart->SetShowObjectAndRender( top );
57 m_scaleonresize =
false;
59 m_lworld.Translate( xc, yc );
65 m_b_is_cached =
false;
68 a2dRenderImage::~a2dRenderImage()
77 m_drawingPart->SetDrawer2D( drawer2d );
81 m_width = other.m_width;
82 m_height = other.m_height;
85 m_b_is_cached =
false;
86 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
88 CurrentSmartPointerOwner =
this;
113 void a2dRenderImage::SetWidth(
double width )
121 void a2dRenderImage::SetHeight(
double height )
137 bbox.
Expand( -m_width / 2, -m_height / 2 );
138 bbox.
Expand( +m_width / 2, +m_height / 2 );
162 void a2dRenderImage::SetMappingUpp(
double vx1,
double vy1,
double xpp,
double ypp )
199 if ( dw == 0 || dh == 0 )
210 if ( m_is_cached && m_cImage.Ok() && ( m_cW == dw ) && ( m_cH == dh ) )
233 m_cImage = m_cImage.Scale( dw, dh );
235 m_cW = m_cImage.GetWidth();
236 m_cH = m_cImage.GetHeight();
237 m_b_is_cached =
false;
242 wxPoint centr( dw / 2, dh / 2 );
void SetMappingUpp(double vx1, double vy1, double xpp, double ypp)
Give the virtual size to be displayed, the mapping matrix will be calculated.
Display Part of a a2dDrawing, in which a2dCanvasObjects are shown.
int WorldToDeviceXRel(double x) const
convert x relative from world to device coordinates
int WorldToDeviceY(double y) const
convert y from world to device coordinates
class to map references to objects stored in XML, in order to make the connection later on...
a2dCanvasOFlags m_flags
holds flags for objects
a2dRenderImage is an a2dCanvasObject that is able to display a complete a2dCanvasDocument as a a2dCan...
double GetBboxMinY()
get minimum Y of the boundingbox in world coordinates relative to its parents
void SetMappingDeviceRect(int mapx, int mapy, int mapWidth, int mapHeight, bool remap=false)
to change the default mapping (to the complete buffer).
virtual bool Update(UpdateMode mode)
Update the state of the object according to its current position etc.
double DeviceToWorldYRel(double y) const
convert y relative from device to world coordinates
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...
UpdateMode
Various mode flags for Update.
void SetMappingWidthHeight(double vx1, double vy1, double width, double height)
virtual void SetPending(bool pending)
set this object pending for update
OVERLAP
Result of a a2dBoundingBox intersection or hittest.
bool GetYaxis() const
get y axis orientation
This class implements drawing functions for wxDC based drawing.
bool m_scaleonresize
are scroll bars active?
The base class for all drawable objects in a a2dCanvasDocument.
double GetBboxMinX()
get minimum X of the boundingbox in world coordinates relative to its parents
virtual void UpdateArea(int x, int y, int width, int height, wxUint8 id=0)
update/redraw part of the buffer, using the given a2dDrawing and ShowObject within that root...
a2dCanvasObject is the base class for Canvas Objects.
double GetBboxMaxY()
get maximum Y of the boundingbox in world coordinates relative to its parents
void TransformPoint(double x, double y, double &tx, double &ty) const
Transform a point.
virtual void DrawCenterRoundedRectangle(double xc, double yc, double width, double height, double radius, bool pixelsize=false)
Draw CenterRoundedRectangle in world coordinates.
bool m_selected
object is selected
a2dDrawStyle GetDrawStyle() const
get drawstyle used for drawing.
a2dAffineMatrix m_lworld
used for positioning the object (x,y,ang,scale etc.)
int WorldToDeviceYRel(double y) const
convert y relative from world to device coordinates
double DeviceToWorldY(double y) const
convert y from device to world coordinates
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
a2dCanvasObject * GetShowObject() const
return pointer of then currently shown object on the canvas.
a2dDrawer2D * GetDrawer2D() const
get current a2dDrawer2D
Drawing context abstraction.
a2dCanvasObject * GetShowObject() const
return pointer of then currently shown object on the drawer.
int GetHeight() const
get buffer/device height
virtual void DrawImage(const wxImage &image, double x, double y, double width, double height, wxUint8 Opacity=255)=0
Draw wxImage in world coordinates.
Contains graphical drawing context specific classes. a2dDcDrawer and derived classes are used for dra...
void SetShowObjectAndRender(a2dCanvasObject *obj)
Used temporarely in rendering bitmas or in printing, to Set the show object and redraw the whole part...
int WorldToDeviceX(double x) const
convert x from world to device coordinates
a2dDrawer2D * GetDrawer2D()
get the internal m_drawer2D that is used for rendering the document
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
void SetMappingAbs(a2dIterC &ic, double vx1, double vy1, double width, double height)
set mapping using absolute world coordinates of parent
while iterating a a2dCanvasDocument, this holds the context.
All updates of these modes force an update (e.g. update non-pending valid bounding boxes) ...
void MapBbox(const a2dAffineMatrix &matrix)
double Get_scaleX() const
return scaling in X
special a2dCanvasObject to make a multi view hierachy.
virtual wxBitmap GetBuffer() const =0
Return the buffer as a bitmap.
double DeviceToWorldX(double x) const
convert x from device to world coordinates
a2dCanvasObject * SetShowObject(const wxString &name)
set object available in the a2dDrawing to be shown on the drawer
void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
a2dCanvasObject * SetShowObject(const wxString &name)
set object available in the a2dCanvasDocument to be shown on the canvas
const a2dStroke * a2dTRANSPARENT_STROKE
global a2dStroke stock object for TRANSPARENT stroking
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
bool DoIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
Does hit test on the object (exclusif child objects)
a2dDrawing * GetDrawing() const
get drawing via top object
double Get_scaleY() const
return scaling in Y
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.
bool DoUpdate(UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
calculate for top the boundingbox's that became invalid.
#define Round(x)
round to integer such that e.g 2.5 < x < 3.5 becomes 3
a2dBoundingBox m_bbox
boundingbox in world coordinates
const a2dAffineMatrix & GetTransform() const
Get the accumulated transform up to and including m_lworld of the current object. ...
double DeviceToWorldXRel(double x) const
convert x relative from device to world coordinates
CloneOptions
options for cloning
virtual void SetMappingWidthHeight(double vx1, double vy1, double width, double height)
Give the virtual size to be displayed, the mapping matrix will be calculated.
structure to give as parameter to member functions of a2dCanvasObject
const a2dFill * a2dTRANSPARENT_FILL
global a2dFill stock object for TRANSPARENT filling