a2dCanvasView Class Reference

View on a a2dCanvasDocument, in which a2dCanvasObjects are shown. More...

#include <drawer.h>

Inheritance diagram for a2dCanvasView:

Inheritance graph
[legend]
Collaboration diagram for a2dCanvasView:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 a2dCanvasView (int width=1000, int height=1000)
 constructor
 a2dCanvasView (int width, int height, a2dDrawer2D *drawer2D)
 constructor
 a2dCanvasView (a2dDrawer2D *drawer)
 constructor
 a2dCanvasView (const wxSize &size)
 constructor
 a2dCanvasView (const a2dCanvasView &other)
 copy constructor
virtual void SetDisplayWindow (wxWindow *display)
 next to the base its m_display, this also sets m_drawer2d to this display
a2dCanvasGetCanvas () const
 Get the Display window of the a2dView. But casted to a a2dCanvas.
virtual void SetBufferSize (int w, int h)
 sets buffersize ( if used ) for the a2dDrawer2D
virtual bool GetTrippleBuf ()
virtual bool GetTrippleBufHasAlpha ()
virtual bool HasAlhpa ()
virtual ~a2dCanvasView ()
 destructor
void SetViewDependentObjects (bool viewDependentObjects)
 if set true, document can contain objects that depend on this view (size etc).
bool GetViewDependentObjects () const
 see SetViewDependentObjects()
a2dLayerViewGetLayerRenderArray ()
 get the layer render array
bool Get_UpdateAvailableLayers () const
 update layers available needed?
void SetAvailable ()
 check which layers do contain objects as seen from the ShowObject()
void SetLayerCheck (wxUint16 layer)
 signals the need to check the given layer for visibility/availibility as seen from this view.
void Set_UpdateAvailableLayers (bool value)
 Sets a flag for updating available layers checking, which makes sure layers will be checked first when needed.
void SetReverseOrder (bool revorder)
 Set to draw layers in reverse order.
bool GetReverseOrder () const
 Get Setting for draw layers in reverse order.
void SetHitMargin (wxUint16 pixels)
 used to extend a hittest with the number of pixels.
wxUint16 GetHitMarginDevice () const
 Get HitMargin used to extend a hittest with the number of pixels.
double GetHitMarginWorld () const
 Get HitMargin used to extend a hittest in world units.
virtual bool ProcessEvent (wxEvent &event)
 Special event handling for a2dCanvasView class.
virtual wxPrintout * OnCreatePrintout (a2dCommand *typeOfPrint)
 to create a a2dViewPrintout, used to print a view or its document
void SetMouseEvents (bool onoff)
 If not set do not process mouse events.
bool GetMouseEvents () const
 return true if this a2dCanvasView allows mouse events to be processed.
void SetCaptured (a2dCanvasObject *captured)
 set the object that is captured for events in the a2dCanvasDocument.
a2dCanvasObjectGetCaptured () const
 are events redirected to a captured corridor? if so return the captured object in it, else NULL
void SetEndCorridorObject (a2dCanvasObject *endCorridorObject)
 use in combination with the a2dIterC class to set a corridor path for events.
a2dCanvasObjectGetEndCorridorObject () const
 return the corridor object if set else NULL
a2dCanvasDocumentGetCanvasDocument () const
 get a2dCanvasDocument that is displayed on the canvas
a2dCanvasObjectSetShowObject (const wxString &name)
 set object available in the a2dCanvasDocument to be shown on the drawer
bool SetShowObject (a2dCanvasObject *obj)
 set top object available in the a2dCanvasDocument to be shown on the drawer
a2dCanvasObjectGetShowObject () const
 return pointer of then currently shown object on the drawer.
void AddPendingUpdateArea (a2dCanvasObject *obj, wxUint8 id=0, bool refsalso=true)
 add pending update for the area that is the boundingbox of the given object
bool AddObjectPendingUpdates ()
 recursive find pending objects and adds their areas to the updatelist
void AddPendingUpdateArea (const a2dBoundingBox &box, wxUint8 id=0)
 add boundingbox to update list for updating in idle time
void AddPendingUpdateArea (const wxRect &recnew, wxUint8 id=0)
 add rectangle to update list for updating in idle time
void AddPendingUpdateArea (int x, int y, int w, int h, wxUint8 id=0)
 add area to update list for updating in idle time
void AddOverlayAreas (bool update)
void AddOverlayObject (a2dCanvasObject *obj)
 add to list of overlay objects (must be children of m_top)
void RemoveOverlayObject (a2dCanvasObject *obj)
 remove from the list of overlay objects (must be children of m_top)
virtual void OnDraw (wxDC *)
 Not implemented, use a2dViewPrintout to print.
void OnUpdate (a2dDocumentEvent &event)
 depending on the hint value performs specific updating on the view.
void Update (unsigned int how=(a2dCANVIEW_UPDATE_ALL|a2dCANVIEW_UPDATE_BLIT), wxObject *hintObject=NULL)
 see OnUpdate
virtual void UpdateArea (int x, int y, int width, int height, wxUint8 id=0)
 update/redraw part of the buffer, using the given a2dCanvasDocument and ShowObject within that root.
virtual void ClearArea (int x, int y, int width, int height)
virtual void RenderChildObject (a2dCanvasObject *obj)
virtual void BlitBuffer (int x, int y, int width, int height, int xbuf, int ybuf)
 blit part of the drawing buffer to the canvas
virtual void DrawOrigin ()
 Function to draw the origin.
virtual void PaintGrid (int x, int y, int width, int height)
 Function to draw the grid.
virtual void PaintBackground (int x, int y, int width, int height)
 (re)painting of background
void SetCrossHair (bool onoff)
 set enable crosshair cursor
bool GetCrossHair ()
 get enable crosshair cursor
void SetCrossHairLengthX (int LengthX)
 set crosshair cursor Length in X in pixels
void SetCrossHairLengthY (int LengthY)
 set crosshair cursor Length in Y in pixels
int GetCrossHairLengthX ()
 get crosshair cursor Length in X in pixels
int GetCrossHairLengthY ()
 get crosshair cursor Length in Y in pixels
void SetCrossHairStroke (const a2dStroke &stroke)
 set stroke for crosshair
a2dStrokeGetCrossHairStroke ()
 get stroke for crosshair
virtual void UpdateCrossHair (int x, int y)
 blit old areas to remove last drawn crosshair and draw the cross hair at this new position.
void SetFixedStyleFill (const a2dFill &fixFill)
 set a2dFill to use when RenderFIX_STYLE is set.
void SetFixedStyleStroke (const a2dStroke &fixStroke)
 set a2dStroke to use when RenderFIX_STYLE is set.
void SetSelectFill (const a2dFill &selectFill)
 set a2dFill to use when RenderWIREFRAME_SELECT or RenderWIREFRAME_SELECT_INVERT is set.
void SetSelectStroke (const a2dStroke &selectStroke)
 set a2dStroke to use when RenderWIREFRAME_SELECT or RenderWIREFRAME_SELECT_INVERT is set.
void SetHighLight (const a2dFill &hightLightFill)
 set a2dFill to use when RenderWIREFRAME_HighLight.
void SetHighLight (const a2dStroke &hightLightStroke)
 set a2dStroke to use when RenderWIREFRAME_HighLight.
void SetOverlayFill (const a2dFill &overlayFill)
 set a2dFill to use when RenderFIX_STYLE is set.
void SetOverlayStroke (const a2dStroke &overlayStroke)
 set a2dStroke to use when RenderFIX_STYLE is set.
void SetBackgroundFill (const a2dFill &backgroundfill)
 background fill for the canvas
a2dFillGetBackgroundFill ()
 get current background fill for the canvas
void SetGridAtFront (bool gridatfront)
 Set grid setting for drawing grid in front or back.
bool GetGridAtFront ()
 Get grid setting for drawing grid in front or back.
void SetGridStroke (const a2dStroke &gridstroke)
 set stroke used for grid drawing
void SetGridSize (wxUint16 gridsize)
 set size of grid circle
void SetGridFill (const a2dFill &gridfill)
 set fill used for grid drawing
double GetGridX ()
 Get grid distance in X.
void SetGridX (double gridx)
 Set grid distance in X.
double GetGridY ()
 Get grid distance in Y.
void SetGridY (double gridy)
 Set grid distance in Y.
void SetGrid (bool grid)
 Set grid on/off.
bool GetGrid ()
 Get grid setting on/off.
void SetGridLines (bool gridlines)
 Get grid setting for line drawing.
bool GetGridLines ()
 Get setting for grid to draw lines instead of points.
void SetGridThreshold (wxUint16 gridthres)
wxUint16 GetGridThreshold ()
 Get grid threshold.
void SetShowOrigin (bool show)
 Set showorigin on/off.
bool IsFrozen ()
 Returns if canvas is frozen.
void Freeze ()
 prevent changing the a2dCanvasView buffer and blitting it to the window
void Thaw (bool update)
 to release Freeze()
virtual bool BlitPendingUpdateAreas ()
 blit pending update areas, that are already updated to the buffer, now to the screen.
bool SetCanvasToolContr (a2dToolContr *controller)
 set toolcontroller ( reset with NULL )
a2dToolContrGetCanvasToolContr ()
void SetCursor (const wxCursor &cursor)
void PushCursor (const wxCursor &cursor)
 push a cursor on the cursor stack, and set display cursor to new back being cursor.
void PopCursor ()
 pop a cursor from the cursor stack, and set display cursor to back
void ClearCursorStack ()
 clear the stack of cursor, and set display cursor ARROW.
a2dCanvasObjectIsHitWorld (double x, double y, int layer=wxLAYER_ALL, a2dHitOption option=a2dCANOBJHITOPTION_NONE, bool filterSelectableLayers=false)
 do a hittest on the view at coordinates x,y
a2dCanvasObjectIsHitWorld (a2dHitEvent &hitEvent, int layer=wxLAYER_ALL)
 do an advanged hittest on the view
virtual bool ProcessCanvasObjectEvent (wxEvent &event, bool &isHit, double x, double y, int margin, int layer=wxLAYER_ALL)
 Corridor and captured object event processing.
virtual bool ProcessCanvasObjectEvent (a2dCanvasObjectEvent &event, bool &isHit, double x, double y, int margin, int layer=wxLAYER_ALL)
 Corridor and captured object event processing.
void OnPropertyChanged (const a2dPropertyId *id)
 This function is called after a property changed.
bool FindAndSetCorridorPath (a2dCanvasObject *findObject, bool capture)
 Find the show-object child object, set the path to the given child object and capture it.
void SetCorridorPath (const a2dCorridor &corridor)
 find object on the current corridor path.
void ClearCorridorPath (bool uncapture)
 Reset all corridor paths and uncapture object.
void SetMappingShowAll ()
 use the boundingbox of the ShowObject to set the mapping such that it will be displayed completely on the device.
void SetDrawer2D (a2dDrawer2D *drawer2d, bool noDelete=false)
 set the internal m_drawer2D to be used for rendering the document
a2dDrawer2DGetDrawer2D ()
 get the internal m_drawer2D that is used for rendering the document
void SetDocumentDrawStyle (wxUint32 drawstyle)
 set drawstyles to use for drawing the document
void RestoreDrawStyle ()
 restore drawstyle to the one before the last change
wxUint32 GetDocumentDrawStyle ()
 get drawstyles used for drawing the document
void SetOverlayDrawStyle (a2dDocumentRenderStyle drawstyle)
virtual void Scroll (int dxy, bool yscroll, bool total)
 scroll up down or left right
virtual void RenderTopObject (wxUint32 documentDrawStyle, wxUint8 id)
 does render the top object in the given style.
virtual void RenderTopObject (a2dCanvasObjectFlagsMask mask, a2dDocumentRenderStyle drawstyle)
 single drawstyle render cycle called on document
virtual void RenderOverlay (a2dDocumentRenderStyle drawstyle)
 render of overlay objects stored in m_overlayObjects specific to the view
void UpdateViewDependentObjects ()
 update the transform matrix for objects with property 'PROPID_viewDependent'
void SetPrintTitle (bool val)
 If true render the printout with a title string, otherwise not.
void SetPrintFilename (bool val)
 If true render the printout with a filename string, otherwise not.
void SetPrintScaleLimit (double val)
 Set the scaling limit for printing, so that small stuff is not zoomed to full page.
void SetPrintFrame (bool val)
 If true, draw a frame around printouts.
void SetPrintFitToPage (bool val)
 If true, draw a view on all page without real scale.
int GetMouseX ()
 get mouse position X
int GetMouseY ()
 get mouse position Y
int GetWorldMouseX ()
 get mouse position X in world coordinates
int GetWorldMouseY ()
 get mouse position Y in world coordinates
void MouseToToolWorld (int x, int y, double &xWorldLocal, double &yWorldLocal)

Public Attributes

bool m_skipBuffer

Static Public Attributes

static a2dPropertyIdUint16PROPID_drawstyle = NULL
static a2dPropertyIdBoolPROPID_gridlines = NULL
static a2dPropertyIdBoolPROPID_grid = NULL
static a2dPropertyIdBoolPROPID_showorigin = NULL
static a2dPropertyIdUint16PROPID_hitmargin = NULL
static a2dPropertyIdBoolPROPID_gridatfront = NULL
static a2dPropertyIdUint16PROPID_gridsize = NULL
static a2dPropertyIdUint16PROPID_gridthres = NULL
static a2dPropertyIdDoublePROPID_gridx = NULL
static a2dPropertyIdDoublePROPID_gridy = NULL
static const wxEventType sm_changedLayers
 when more layers changed ( rerendering view is needed).
static const wxEventType sm_changedLayerAvailable
 when an object is added to a layer, and therefore makes this layer available.
static const wxEventType sm_changedLayerVisibleInView
 when one layer is set visible in a2dCanvasView
static const wxEventType sm_changedActiveView
static const wxEventType sm_changedShowObject

Protected Member Functions

void OnActivate (a2dViewEvent &activateEvent)
 Default handler for wxEVT_ACTIVATE_VIEW called when the view gets the focus or something else needs.
void OnEnter (wxMouseEvent &event)
void OnIdle (wxIdleEvent &event)
 redraw and/or blit pending areas to the device
void OnMouseEvent (wxMouseEvent &event)
 normally sent from wxWindow containing the view, via its ProcessEvent(wxEvent& event)
void OnCharEvent (wxKeyEvent &event)
 normally sent from wxWindow containing the view, via its ProcessEvent(wxEvent& event)
void OnCloseView (a2dCloseViewEvent &event)
 next to base class functionality,
void OnComEvent (a2dComEvent &event)
 called for a2dComEvent events.
void OnSetDocument (a2dViewEvent &event)
 called when document of the a2dView has changed.
void RedrawPendingUpdateAreas (bool noblit=false)
 redraw the pending update areas to the buffer given in device coordinates.
void DeleteAllPendingAreas ()
 pending update areas in the update list are deleted.
void Aberration (double angle, double radius, double &dphi, unsigned int &segments)
 based on angle and radius and m_aberration calculate a proper delta phi and number of segments

Protected Attributes

bool m_frozen
 buffer updating activity possible or not
a2dCanvasObjectPtr m_capture
 object that is receiving events
a2dCanvasObjectPtr m_endCorridorObject
 when a corridor is active, this is set.
bool m_mouseevents
 enable/ disable mouse events handling by canvas
a2dCanvasObjectPtr m_top
 top object for drawer object, from here the rendering starts
a2dFill m_backgroundfill
 background fill of canvas and background color of background fill in case of mono colour fill
bool m_showorigin
 showorigin?
bool m_gridatfront
 grid drawn at front or back
bool m_crosshair
 is croshair visible
int m_crosshairx
 crosshair x
int m_crosshairy
 crosshair y
int m_crosshairLengthX
 crosshair cursor Length in X in pixels
int m_crosshairLengthY
 crosshair cursor Length in Y in pixels
a2dStroke m_crosshairStroke
 stroke to use for crosshair
int m_mouse_x
 last mouse position
int m_mouse_y
a2dStroke m_gridstroke
 grid stroke
a2dFill m_gridfill
 grid fill
a2dStroke m_fixStroke
 fixed style stroke
a2dFill m_fixFill
 fixed style fill
a2dStroke m_overlayStroke
 overlay style stroke
a2dFill m_overlayFill
 overlay style fill
a2dStroke m_selectStroke
 select style stroke
a2dFill m_selectFill
 select style fill
a2dStroke m_highLightStroke
 highLight style stroke
a2dFill m_highLightFill
 highLight style fill
double m_gridx
 grid distance in x
double m_gridy
 grid distance in y
wxUint16 m_gridsize
 grid point size
bool m_gridlines
 show grid as lines
wxUint16 m_gridthres
 threshold for grid.
bool m_grid
 grid on/off
bool m_virtualarea_set
 is the virtual area set already (used during startup)
int m_width
 device size width
int m_height
 device size height
double m_splineaberration
 accuracy of spline
a2dClipRegionList m_clipregionlist
 pushed clipping regions
double m_displayaberration
 accuracy of arc segment calculation etc. in device coordinates
a2dUpdateList m_updateareas
 list of rectangles that need to be blited to the screen.
bool m_recur
 to prevent recursive updates
a2dSmrtPtr< a2dToolContrm_toolcontroller
 toolscontroller plugged in as first event handler
a2dDrawer2Dm_drawer2D
wxUint16 m_hitmargin
 how close does a hit need to be to the object you are trying to hit.
bool m_asrectangle
 underneath the threshold draw rectangles.
wxUint32 m_documentDrawStyle
 drawstyles to use when rendering document
a2dDocumentRenderStyle m_overlayDrawStyle
 drawstyles to use when rendering overlay
wxUint32 m_documentDrawStyleRestore
 to restore style after a temporary change.
bool m_printtitle
 if true, a printout is done with title (document name (description?)), otherwise not
bool m_printfilename
 if true, a printout is done with filename (document file path), otherwise not
double m_printscalelimit
 Set the scaling limit for printing, so that small stuff is not zoomed to full page.
bool m_printframe
 If true, draw a frame around printouts.
bool m_printfittopage
 If true, draw a view on all page without real scale.
a2dLayerView m_layerRenderArray [wxMAXLAYER]
 which layer should be rendered ( visible and/or available )
bool m_update_available_layers
 flag to updatelayers that are available.
a2dTiles m_tiles
 tiles on drawing surface, used to optimize update areas.
a2dTiles m_tiles2
bool m_reverse_order
 draw in reverse order if set
bool m_viewDependentObjects
a2dCursorStack m_cursorStack
a2dCanvasObjectList m_overlayObjects


Detailed Description

View on a a2dCanvasDocument, in which a2dCanvasObjects are shown.

a2dCanvasView is a specialized view to display parts of a a2dCanvasDocument. Such a part always starts at one a2dCanvasObject which is inside of a a2dCanvasDocument object. The a2dCanvasObject itself contains as children a2dCanvasObject derived drawable objects. A hierarchy of recursively nexted objects is what forms the actual drawing. The parent object to start the drawing is called the ShowObject. The member functions SetShowObject(...) are used to set the ShowObject to be displayed. All objects are defined in relative world coordinates, which are relative to the parent object(s).

a2dCanvasDocument is given as a drawing and/or updating context a a2dCanvasView. E.g. in a2dCanvasDocument::RenderTopObject() the a2dCanvasView is used by the a2dCanvasObject render functions to get to a2dCanvasView::m_drawer2D, which is the Drawing Context used to do the actual drawing within the a2dCanvasObjects. But a2dCanvasView::RenderTopObject() defines what drawing style is used to draw.

The real purpose of a2dCanvasView, is to maintain a list of damaged/changed areas in the view/drawing, and when time is ready, start redrawing those areas. When a a2dCanvasObject did change in position or size etc., the a2dCanvasDocument reports this change as a rectangular redraw areas to the a2dCanvasView's of that document. The update areas are based on the boundingbox of the object in its old state and in its new state. This reporting is done in idle time, and for all changed objects at once. When reporting of all changed areas is done, each a2dCanvasView knows what parts of its drawing need to be redrawn. It will then start redrawing those areas, but only after optimizing to the minimum areas to redraw. So overlapping areas will only be redrawn once. The mechanism for that is called tilling.

The size of the drawing in world coordinates and the size of the view in pixels is all indirectly defined by a2dCanvasView::m_drawer2D and a2dView::m_display. The area of the drawing in world coordinates that is visible, can be set via a2dCanvasView::m_drawer2D. Also if World coordinates is with the Y axis going up are down. a2dDrawer2D has methods to convert from world to device coordinates and visa versa. a2dCanvasView::m_drawer2D draws into a buffer. After rendering an update of all damaged parts into this buffer, it will be blitted from the buffer to the a2dView::m_display of the a2dCanvasView. This is done in Idle time, but can also be forced. In the end a2dCanvasView automatically always displays an up to date part of the drawing which is stored inside the a2dCanvasDocument. The user just changes a a2dCanvasObject inside the a2dCanvasDocument, and the redrawing on all the views will be done automatically.

A a2dCanvasView its a2dCanvasView::m_drawer2D knows where to draw to, this can be a bitmap buffer or a window etc. The job to update a window in case of drawing to a bitmap buffer, is not part of the a2dDrawer2D. This is/needs to be done by the class using the drawer, like a2dCanvasView and indirectly a2dCanvas here. The a2dCanvas receives a paint event, e.g. when moving an overlapping window or dialog, and it then blits the right parts from a2dCanvasView::m_drawer2D its drawing buffer to the canvas window. a2dCanvasView also takes care of scrolling the view, it does this by re-using the contents of the a2dDrawer2D drawing buffer when possible. The drawing buffer can be bigger then the size of the canvas window. a2dCanvasView always makes sure the whole buffer contains an up to date contents, as being the drawing to display form its document. Therefore if the canvas windows which uses the a2dCanvasView for drawing, implements scrolling and resizing, the canvas window is responsible for optimizing the scroll to take maximum advantage from the buffer of a2dCanvasView. Like if the buffer is bigger in size then the canvas windows size, a resize of the canvas window only needs to increase the buffer size of a2dCanvasView, when the size of the window exeeds the buffer size. One can even decide to set the buffer to the size of the complete virtual area that can be scrolled. This way one can make a trade of between buffer size and scrolling/resizing speed. Knowing this, one needs to realize that mouse coordinates as received inside a canvas window, are different if the origin in the drawing context is not at the orginin of the canvas window. The a2dCanvasView::m_drawer2D takes (0,0) of the buffer as the origin of device coodinates.

Definition at line 507 of file drawer.h.


Constructor & Destructor Documentation

a2dCanvasView::a2dCanvasView ( int  width = 1000,
int  height = 1000 
)

constructor

Remarks:
Do not forget to call SetDocument() if used standalone (in a a2dDocumentCommandProcessor setting this is taken care of).

Definition at line 655 of file drawer.cpp.

a2dCanvasView::a2dCanvasView ( int  width,
int  height,
a2dDrawer2D drawer2D 
)

constructor

Width and hight is given, mapping is as in drawer given.

Remarks:
Do not forget to call SetDocument() if used standalone (in a a2dDocumentCommandProcessor setting this is taken care of).

Definition at line 670 of file drawer.cpp.

a2dCanvasView::a2dCanvasView ( a2dDrawer2D drawer  ) 

constructor

Width and hight and mapping is as in drawer given.

Remarks:
Do not forget to call SetDocument() if used standalone (in a a2dDocumentCommandProcessor setting this is taken care of).

Definition at line 686 of file drawer.cpp.

a2dCanvasView::a2dCanvasView ( const wxSize &  size  ) 

constructor

Remarks:
Do not forget to call SetDocument() if used standalone (in a a2dDocumentCommandProcessor setting this is taken care of)

Definition at line 640 of file drawer.cpp.


Member Function Documentation

a2dCanvas* a2dCanvasView::GetCanvas (  )  const [inline]

Get the Display window of the a2dView. But casted to a a2dCanvas.

when a a2dCanvas is used in this a2dCanvasView return it else 0. a2dCanvasView needs to know the window (a2dCanvas) to display itself. The a2dCanvasView updates to this window in idel time. Paint event to the a2dCanvas are using the a2dCanvasView its buffer for quick updating the a2dCanvas window.

See also:
a2dView::SetDisplayWindow()

Definition at line 568 of file drawer.h.

void a2dCanvasView::SetViewDependentObjects ( bool  viewDependentObjects  )  [inline]

if set true, document can contain objects that depend on this view (size etc).

If set those objects will be automatically updated for this view. Else the document is assumed to not contain viewdependent objects for this view, and that update cycle is skipped.

Definition at line 586 of file drawer.h.

bool a2dCanvasView::Get_UpdateAvailableLayers (  )  const [inline]

update layers available needed?

See also:
Set_UpdateAvailableLayers

Definition at line 598 of file drawer.h.

void a2dCanvasView::Set_UpdateAvailableLayers ( bool  value  )  [inline]

Sets a flag for updating available layers checking, which makes sure layers will be checked first when needed.

Eventually results in updating the layers table settings on layers available in document before rendering starts or simular functions.

Definition at line 611 of file drawer.h.

void a2dCanvasView::SetHitMargin ( wxUint16  pixels  )  [inline]

used to extend a hittest with the number of pixels.

to be able to hit a line of width zero, a margin is needed to hit it, which is set here.

Remarks:
default value is 2 pixels

Definition at line 625 of file drawer.h.

bool a2dCanvasView::ProcessEvent ( wxEvent &  event  )  [virtual]

Special event handling for a2dCanvasView class.

If eventprocessing is enabled and the view is enabled. OR in case this event ( wxEVT_ENABLE_VIEW | wxEVT_ENABLE_VIEWS ) is to enable this a2dView, the event is processed.

wxEVT_IDLE is first processed by the view, and next by the m_toolcontroller is set. wxEVT_PAINT is first processed by the m_display if set, next by the view, and next by the m_toolcontroller is set. This garantees proper redrawing of tools on top of the window.

Next to this check the command processor for its current parent object, and sent a command to set it right if change is needed.

Reimplemented from a2dView.

Definition at line 923 of file drawer.cpp.

wxPrintout * a2dCanvasView::OnCreatePrintout ( a2dCommand typeOfPrint  )  [virtual]

to create a a2dViewPrintout, used to print a view or its document

The a2dViewPrintout created will take as much possible from the this view. a2dViewPrintout will create itself a view which fits the size of the paper, but important setting are taken from this view.

Reimplemented from a2dView.

Definition at line 2591 of file drawer.cpp.

void a2dCanvasView::SetMouseEvents ( bool  onoff  ) 

If not set do not process mouse events.

Mouse events are handled by the canvas. They are redirected to the a2dCanvasObject hit. You can switch this off here, and skip the event from being processed. This is often used in tools, to prevent a2dCanvasObjects from receiving events.

Remarks:
most events go to the m_toolcontroller first if set.
See also:
ProcessEvent()

Definition at line 1185 of file drawer.cpp.

void a2dCanvasView::SetCaptured ( a2dCanvasObject captured  )  [inline]

set the object that is captured for events in the a2dCanvasDocument.

Used in combination with the a2dIterC class to set a corridor path for events. Do not use this function directly from outside a2dCorridor or a2diterC

Definition at line 675 of file drawer.h.

void a2dCanvasView::SetEndCorridorObject ( a2dCanvasObject endCorridorObject  ) 

use in combination with the a2dIterC class to set a corridor path for events.

A corridor path leads event to a specific a2dCanvasObject in a a2dCanvasDocument. This feature is used to do editing of nested a2dCanvasObject 's, and to captures events to such objects. The a2dCanvasObject's on a corridor path get the m_flags.m_isOnCorridorPath set, which result in redirecting events to the m_endCorridorObject.

Definition at line 1148 of file drawer.cpp.

a2dCanvasObject* a2dCanvasView::GetEndCorridorObject (  )  const [inline]

return the corridor object if set else NULL

See also:
SetEndCorridorObject()

Definition at line 691 of file drawer.h.

a2dCanvasDocument * a2dCanvasView::GetCanvasDocument (  )  const

get a2dCanvasDocument that is displayed on the canvas

As a side effect also sets this drawer for the document as active.

end of updating routines

Definition at line 2551 of file drawer.cpp.

a2dCanvasObject * a2dCanvasView::SetShowObject ( const wxString &  name  ) 

set object available in the a2dCanvasDocument to be shown on the drawer

Parameters:
name name of top object
Returns:
pointer to the object found else NULL

Definition at line 2597 of file drawer.cpp.

bool a2dCanvasView::SetShowObject ( a2dCanvasObject obj  ) 

set top object available in the a2dCanvasDocument to be shown on the drawer

Parameters:
obj,: pointer to object to show

Definition at line 2630 of file drawer.cpp.

a2dCanvasObject* a2dCanvasView::GetShowObject (  )  const [inline]

return pointer of then currently shown object on the drawer.

Returns:
: pointer to the current object that is shown.

Definition at line 716 of file drawer.h.

void a2dCanvasView::AddPendingUpdateArea ( a2dCanvasObject obj,
wxUint8  id = 0,
bool  refsalso = true 
)

add pending update for the area that is the boundingbox of the given object

Updates the boundingbox area of the given object at idle time. If obj is NULL nothing will be done If refalso is true then all references to this object will be updated also.

Parameters:
obj the object where to take the bounding box from
refsalso true to update all references, else false

Definition at line 2496 of file drawer.cpp.

bool a2dCanvasView::AddObjectPendingUpdates (  ) 

recursive find pending objects and adds their areas to the updatelist

it does first test if the a2dCanvasDocument has the flag set to tell it has pending objects inside. If that is the case, it traverses the a2dCanvasDocument, and adds the absolute boundingbox of the pending object to the a2dCanvasView updatelist. This is for all paths leading to the object from the current ShowObject, so also a2dCanvasObjectReference's.

Returns:
true if did add pendingobject's else false

Definition at line 2525 of file drawer.cpp.

void a2dCanvasView::AddPendingUpdateArea ( int  x,
int  y,
int  w,
int  h,
wxUint8  id = 0 
)

add area to update list for updating in idle time

the given area will be added to the list of rectangles to be blitted to the screen later in idle time, at repaint or after an UpdateNow action. The given area will be combined (merged/ignored) with the already available update areas. This to prevent un necessary redraws.

Definition at line 2456 of file drawer.cpp.

void a2dCanvasView::OnDraw ( wxDC *  dc  )  [virtual]

Not implemented, use a2dViewPrintout to print.

OnDraw is called when printing a view via wxView::OnPrint with wxDocPrintout::OnPrintPage. But for a2dCanvasView, i implemented it in a2dViewPrintout::OnPrintPage.

This funcion is and should NOT be used to Redraw the a2dCanvasView views, this is taken care of automatically, and if needed can be forced with OnUpdate or Update. Paint events are intercepted to blit damaged parts caused by overlaping windows, and in Idle time changes or updated in a2dCanvasView.

Implements a2dView.

Definition at line 1388 of file drawer.cpp.

void a2dCanvasView::OnUpdate ( a2dDocumentEvent event  ) 

depending on the hint value performs specific updating on the view.

Hint is unsigned int containing flags of type

See also:
a2dCanViewUpdateFlags which actions will be executed in the right order. In principle the view its internal data ( this is mostly the buffer ) should be updated, and be made ready for redisplay on the view its DisplayWindow(). A reason for updating a view, is a change in the a2dCanvasDocument. The document is checked for changes in idle time, and updates all views on the document at once when a change exists. First all changed areas on the view because of changes to the document, are reported by the document to the a2dCanvasView. The a2dCanvasView keeps an internal list of areas needing a redraw. The areas reported are found on the basis of the old and new boundingboxes of the changed objects. Next the areas in the updatelist are redrawn in the buffer of the a2dCanvasView, and at last those areas will be blitted.
The above is done automatic, but one is free for whatever reason to add pending areas directly to the a2dCanvasView its update arealist. Those will be updated also in idle time, along with all others areas as a result of changing objects.

Remarks:
OnUpdate is the key routine to speedy redraws, proper use asures only redraw of changed or damaged areas in idle time.

Called in a2dCanvasDocument from UpdateAllViews() and AddPendingUpdatesOldNew() to update this view.

a2dCANVIEW_UPDATE_BLIT means, blit all updated areas for this a2dCanvas now to the screen, else it will happen in idle time. Use a2dCANVIEW_UPDATE_OLDNEW |a2dCANVIEW_UPDATE_BLIT | a2dCANVIEW_UPDATE_BLIT to support dragging for instance, because in such cases idle time will take to long. Other a2dCanvas using the same a2dCanvasDocument will not be redrawn and blitted when double buffered.

Reimplemented from a2dView.

Definition at line 1476 of file drawer.cpp.

void a2dCanvasView::Update ( unsigned int  how = (a2dCANVIEW_UPDATE_ALL | a2dCANVIEW_UPDATE_BLIT),
wxObject *  hintObject = NULL 
) [virtual]

see OnUpdate

by default adds a full pending update for the drawer and all in it, and redraws this to the device. Use how = a2dCANVIEW_UPDATE_ALL when the contents/data of the canvas has changed without specific updates applied to areas. This will do the redraw in idle time. For example: after adding many new objects to the root object or other objects referenced or after changing the root object

Remarks:
the default value is brute force redraw all, but in general not wise to use since it means a total redraw. instead most often a2dCANVIEW_UPDATE_OLDNEW is used, or if result needs to be displayed directly, use ( a2dCANVIEW_UPDATE_OLDNEW |a2dCANVIEW_UPDATE_AREAS | a2dCANVIEW_UPDATE_BLIT )

Reimplemented from a2dView.

Definition at line 1471 of file drawer.cpp.

void a2dCanvasView::UpdateArea ( int  x,
int  y,
int  width,
int  height,
wxUint8  id = 0 
) [virtual]

update/redraw part of the buffer, using the given a2dCanvasDocument and ShowObject within that root.

This method also takes care of redrawing the background and the grid

Definition at line 1689 of file drawer.cpp.

void a2dCanvasView::DrawOrigin (  )  [virtual]

Function to draw the origin.

override this function in a derived class to redefine painting of the origin

Definition at line 2729 of file drawer.cpp.

void a2dCanvasView::PaintGrid ( int  x,
int  y,
int  width,
int  height 
) [virtual]

Function to draw the grid.

override this function in a derived class to redefine painting of the grid

Definition at line 2747 of file drawer.cpp.

void a2dCanvasView::PaintBackground ( int  x,
int  y,
int  width,
int  height 
) [virtual]

(re)painting of background

override this function in a derived class to redefine painting of the background

Definition at line 2832 of file drawer.cpp.

void a2dCanvasView::SetGridLines ( bool  gridlines  )  [inline]

Get grid setting for line drawing.

Note: SetGridSize must be 0, if gridlines=false

Definition at line 937 of file drawer.h.

void a2dCanvasView::SetGridThreshold ( wxUint16  gridthres  )  [inline]

Set grid threshold, if grid distance is below this in pixels, it will be increased by factors of 2 until it fits.

Definition at line 944 of file drawer.h.

void a2dCanvasView::Freeze (  ) 

prevent changing the a2dCanvasView buffer and blitting it to the window

This makes sure the contents displayed into the a2dCanvasView buffer does not change. Pending objects inside a root will be added to the update list of the a2dCanvasView, but not redrawn into the buffer until Thaw.

See also:
Thaw

Definition at line 1133 of file drawer.cpp.

void a2dCanvasView::Thaw ( bool  update  ) 

to release Freeze()

The Frozen view ( Freeze() ), is released. Pending update araes in the update list will be redrawn in OnIdle at the next idle event.

See also:
Freeze
Parameters:
update if true all shown on this view will be redrawn.

Definition at line 1138 of file drawer.cpp.

bool a2dCanvasView::BlitPendingUpdateAreas (  )  [virtual]

blit pending update areas, that are already updated to the buffer, now to the screen.

does the second stage in the two stage process of updating

Definition at line 1622 of file drawer.cpp.

bool a2dCanvasView::SetCanvasToolContr ( a2dToolContr controller  ) 

set toolcontroller ( reset with NULL )

Toolcontrollers are meant to implement tools that manipulate the objects displayed on the a2dCanvas. All events to the canvas window or first redirected to the controller. When skipped in the controller the events will eventually reach the a2dCanvas itself.

Returns:
true is there was a controller set already.
Remarks:
The controller is owned by the canvas and will be deleted by the canvas on destruction or when changed.

Definition at line 905 of file drawer.cpp.

a2dCanvasObject * a2dCanvasView::IsHitWorld ( double  x,
double  y,
int  layer = wxLAYER_ALL,
a2dHitOption  option = a2dCANOBJHITOPTION_NONE,
bool  filterSelectableLayers = false 
)

do a hittest on the view at coordinates x,y

Parameters:
x x of point to do hittest
y y of point to do hittest
layer test only if objects are on this layer or if set to wxLAYER_ALL test obejcts on all layers
option ways to hit
mask only object with this mask set will be hit
Returns:
the top object that was hit (e.g.in case of groups)
Remarks:
hit margin is defined in a2dCanvasDocument containing the root group

Definition at line 1353 of file drawer.cpp.

a2dCanvasObject * a2dCanvasView::IsHitWorld ( a2dHitEvent hitEvent,
int  layer = wxLAYER_ALL 
)

do an advanged hittest on the view

Parameters:
hitEvent stores hit information
layer test only if objects are on this layer or if set to wxLAYER_ALL test obejcts on all layers
Returns:
the top object that was hit (e.g.in case of groups)
Remarks:
hit margin is defined in a2dCanvasDocument containing the root group

Definition at line 1376 of file drawer.cpp.

bool a2dCanvasView::ProcessCanvasObjectEvent ( wxEvent &  event,
bool &  isHit,
double  x,
double  y,
int  margin,
int  layer = wxLAYER_ALL 
) [virtual]

Corridor and captured object event processing.

Follow corridor set, and redirect the event to last object in the corridor. The event is first sent to the child objects, and if not processed there, testing for a hit on the object itself is done, and if true a2dEvtHandler::ProcessEvent is called.

Parameters:
event the event to process
isHit return if there was a hit on an object
x x of point to do hittest
y y of point to do hittest
margin margin that still gives a valid hittest.
layer only if object is on this layer or if set to wxLAYER_ALL ignore layer id.
Returns:
true if Object (or a child ) did process the event and did not call event.Skip()

Definition at line 1262 of file drawer.cpp.

bool a2dCanvasView::ProcessCanvasObjectEvent ( a2dCanvasObjectEvent event,
bool &  isHit,
double  x,
double  y,
int  margin,
int  layer = wxLAYER_ALL 
) [virtual]

Corridor and captured object event processing.

This is the same as the function ProcessCanvasObjectEvent( wxEvent& event, bool& isHit, double x, double y, int margin, int layer = wxLAYER_ALL ), but it sets the iteration context pointer of the event. This is used when sending a2dCanvasObjectEvents from a simple (handle less) tool.

Parameters:
event the event to process
isHit return if there was a hit on an object
x x of point to do hittest
y y of point to do hittest
margin margin that still gives a valid hittest.
layer only if object is on this layer or if set to wxLAYER_ALL ignore layer id.
Returns:
true if Object (or a child ) did process the event and did not call event.Skip()

Definition at line 1283 of file drawer.cpp.

void a2dCanvasView::OnPropertyChanged ( const a2dPropertyId id  )  [virtual]

This function is called after a property changed.

This is overloaded to update the view if needed.

Reimplemented from a2dObject.

Definition at line 620 of file drawer.cpp.

bool a2dCanvasView::FindAndSetCorridorPath ( a2dCanvasObject findObject,
bool  capture 
)

Find the show-object child object, set the path to the given child object and capture it.

See also:
a2dIterC::SetCorridorPath This is used to redirect events in the wxDocview library to a specific child object, e.g. one found by extended hit testing.
Parameters:
findObject (child) object to be searched for.
capture if true the findObject is captured
Returns:
true if findObject was found

Definition at line 1306 of file drawer.cpp.

void a2dCanvasView::SetCorridorPath ( const a2dCorridor corridor  ) 

find object on the current corridor path.

The a2dCanvasObject in the document with the m_flags.m_isOnCorridorPath set, are pushed into a list, which is returned. If non found the return is false, else true and the list of objects leading to the end of the corridor. set a corridor from a list of objects

Definition at line 1323 of file drawer.cpp.

void a2dCanvasView::ClearCorridorPath ( bool  uncapture  ) 

Reset all corridor paths and uncapture object.

See also:
a2dIterC::SetCorridorPath Reset a corridor path set with FindAndSetCorridorPath
Parameters:
uncapture if true uncaptured the captured object

Definition at line 1338 of file drawer.cpp.

void a2dCanvasView::SetMappingShowAll (  ) 

use the boundingbox of the ShowObject to set the mapping such that it will be displayed completely on the device.

See also:
SetMappingDeviceRect to map to a different device/buffer rectangle.

Definition at line 2681 of file drawer.cpp.

void a2dCanvasView::SetDrawer2D ( a2dDrawer2D drawer2d,
bool  noDelete = false 
)

set the internal m_drawer2D to be used for rendering the document

The drawing context is owned by a2dCanvasView, it will delete it. Still you set it to NULL or othere context without deletion using the noDelete parameter.

Parameters:
drawer2d the drawing context object to set
noDelete default the old drawing context object is deleted, but not is this is set true. This can be used to simulate ownership of the drawing context by another class.

Definition at line 885 of file drawer.cpp.

void a2dCanvasView::SetDocumentDrawStyle ( wxUint32  drawstyle  ) 

set drawstyles to use for drawing the document

The internal m_drawer2D is set to this style before rendering of the document starts.

Remarks:
m_drawstyleRestore is set to the current drawstyle. So a temporary change can easily be restored.
Parameters:
drawstyle one of the draw styles

Definition at line 1123 of file drawer.cpp.

void a2dCanvasView::Scroll ( int  dxy,
bool  yscroll,
bool  total 
) [virtual]

scroll up down or left right

Parameters:
dxy scroll distance in X or Y
yscroll if true scrolling is in Y else X
total update whole device after scroll

Definition at line 2909 of file drawer.cpp.

void a2dCanvasView::RenderTopObject ( wxUint32  documentDrawStyle,
wxUint8  id 
) [virtual]

does render the top object in the given style.

This function can be used from tools to render the tool its objects which do become part of the document in a certain style.

Definition at line 1993 of file drawer.cpp.

void a2dCanvasView::RenderTopObject ( a2dCanvasObjectFlagsMask  mask,
a2dDocumentRenderStyle  drawstyle 
) [virtual]

single drawstyle render cycle called on document

Render the given topobject and all that is below it Will recursive call the render routines of all the objects seen from the topobject. This rendering iterates over layers.

Parameters:
mask object must have this mask
drawstyle which drawstyle should be used for this render action .
Remarks:
If a layer is Invisible it will not be rendered.

Definition at line 2214 of file drawer.cpp.

void a2dCanvasView::UpdateViewDependentObjects (  ) 

update the transform matrix for objects with property 'PROPID_viewDependent'

will recursive call the UpdateViewDependentObjects routines of all the objects seen from the topobject.

Remarks:
TODO: Check all child objects (TODO for optimize: with flag 'm_childpixelsize=true').

Definition at line 1975 of file drawer.cpp.

void a2dCanvasView::MouseToToolWorld ( int  x,
int  y,
double &  xWorldLocal,
double &  yWorldLocal 
)

convert mouse position as seen from the display window, into world coordinates. If no display window is defined,

Definition at line 1202 of file drawer.cpp.

void a2dCanvasView::OnActivate ( a2dViewEvent activateEvent  )  [protected]

Default handler for wxEVT_ACTIVATE_VIEW called when the view gets the focus or something else needs.

to have this view the active view ( the one which recieves events from the containing window ). This drawer is set (non)active for the a2dCanvasDocument which is displayed on this drawer.

Remarks:
at least called when a2dCanvasView gets the focus
See also:
wxView::Activate

Definition at line 1108 of file drawer.cpp.

void a2dCanvasView::OnCloseView ( a2dCloseViewEvent event  )  [protected]

next to base class functionality,

this here removes or resets the toolcontroller. The wxEVT_CLOSE_VIEW is first sent to the m_toolcontroller, so in there it is intercepted too.

Reimplemented from a2dView.

Definition at line 1419 of file drawer.cpp.

void a2dCanvasView::OnSetDocument ( a2dViewEvent event  )  [protected]

called when document of the a2dView has changed.

Sets the a2dCanvasDocument where the objects for this canvas are stored It will trigger boundingbox calculation and other administrative tasks to properly render the document onto this view

Definition at line 2556 of file drawer.cpp.

void a2dCanvasView::DeleteAllPendingAreas (  )  [protected]

pending update areas in the update list are deleted.

use when ready with updates, or when they become useless because of scroll etc.

Definition at line 1545 of file drawer.cpp.

void a2dCanvasView::Aberration ( double  angle,
double  radius,
double &  dphi,
unsigned int &  segments 
) [protected]

based on angle and radius and m_aberration calculate a proper delta phi and number of segments

The calculation is used for circular arc segments


Member Data Documentation

list of rectangles that need to be blited to the screen.

This list holds several rectangles, which should be updated. The are blitted from the buffer, since they were damaged they first need to be updated.

Definition at line 1392 of file drawer.h.

wxUint16 a2dCanvasView::m_hitmargin [protected]

how close does a hit need to be to the object you are trying to hit.

This is given in device units (pixels) and tranformed to world units using the drawers transform

Definition at line 1406 of file drawer.h.

flag to updatelayers that are available.

It is set when m_layerRenderArray does not contain all layers used by a2dCanvasObject's

Definition at line 1442 of file drawer.h.

const wxEventType a2dCanvasView::sm_changedActiveView [static]

sent when activating a frame ( maybe containing several a2dView's ), used to update dialogs for the current active frame which shows some views.

Definition at line 1490 of file drawer.h.

const wxEventType a2dCanvasView::sm_changedShowObject [static]

id for changed a2dObject a new show object was chosen in a2dCanvasView

Definition at line 1494 of file drawer.h.


The documentation for this class was generated from the following files:
a2dCanvasView Class Reference -- Tue Aug 31 18:14:28 2010 -- 31 Aug 2010 -- 1.5.5 -- wxArt2D -- . -- Main Page Reference Documentation