a2dBandCurve Class Reference
[a2dCanvasObject related objectscomplex canvasobject'scomplex canvasobject's for drawing sets of curves]

Curve represented by a number of vertexes. More...

#include <curve.h>

Inheritance diagram for a2dBandCurve:

Inheritance graph
[legend]
Collaboration diagram for a2dBandCurve:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 a2dBandCurve (a2dSweepPointArray *points)
 a2dBandCurve (const a2dBandCurve &other, CloneOptions options)
virtual a2dObjectClone (CloneOptions options) const
 This is here so that this class cannot be used directly.
virtual bool GetXyAtSweep (double sweepValue, a2dPoint2D &point) const
 calculate Y at X
a2dSweepPointArray * GetPoints ()
 return the array of points.
int GetNumberOfPoints ()
 return the number of point in the curve
void SetMarkerUpLow (bool markerUpLow)
 return of GetXyAtSweep() is upper side of curve if true, else low
void SetPosXYPoint (int index, double sweep, double y, bool upper)
 modify point at index to x,y
void GetPosXYPoint (int index, double &sweep, double &y, bool upper)
 get point x and y at index
void GetPosXYPointWorld (int index, double &sweep, double &y, bool upper, bool transform)
 get point x and y at index in world coordinates
void RemovePoint (double &sweep, double &y, bool upper, int index=-1)
 removes point at index
void RemovePointWorld (double &sweep, double &y, bool upper, int index=-1, bool transformed=true)
 removes point at index
bool EliminateMatrix ()
 reduce matrix to identity without replacing object
void SetSpline (bool on)
 set to true, the polygon will be drawn as a spline
bool GetSpline ()
 Get the polygon spline setting.
void AddPoint (double sweep, const a2dPoint2D &P)
 Append a new point in curve coordinates.
void AddPoint (double sweep, double x, double y)
 Append a new point in curve coordinates.
void Alloc (size_t count)
 Preallocates memory for a given number of array elements.
void Clear ()
 This function does the same as Empty() and additionally frees the memory allocated to the array.
a2dSweepPointDetach (size_t index)
void Empty ()
void Insert (a2dSweepPoint *item, size_t n)
bool IsEmpty () const
 Returns true if the array is empty, false otherwise.
a2dSweepPointoperator[] (size_t index) const
 get i'th point
a2dSweepPointItem (size_t index) const
a2dSweepPointLast () const
void RemoveAt (size_t index)
void Shrink ()
 Frees all memory unused by the array.
bool PointOnCurve (const a2dPoint2D &P, double marge)
 test if a point is on the curve.
void SetRenderMode (wxUint32 rendermode)
 sets which parts or how the curve is rendered
int GetRenderMode ()
 get which parts or how the curve is rendered
void SetEditMode (wxUint32 editmode)
 sets how the curve is edited
int GetEditMode ()
 get how the curve is edited

Protected Member Functions

bool DoStartEdit (wxUint16 editmode, wxEditStyle editstyle)
 only used for editable objects and under control of a editing tool.
void SyncHandlesWithLineSegments ()
void OnHandleEvent (a2dHandleMouseEvent &event)
 called if a mouse event occured on a child object, that is a handle
void OnEnterObject (a2dCanvasObjectMouseEvent &event)
 called when the mouse enters the object
void OnLeaveObject (a2dCanvasObjectMouseEvent &event)
 called when the mouse leaves the object
void OnCanvasObjectMouseEvent (a2dCanvasObjectMouseEvent &event)
 default handler for mouse events, sent to the object from the a2dCanvasView.
virtual void DoSave (wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
 write object specific CVGL data
void DoLoad (wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
 load object specific CVG data
a2dBoundingBox DoGetUnTransformedBbox (a2dBboxFlags flags=a2dCANOBJ_BBOX_NON) const
bool DoUpdate (UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
 Update derived Object specific things ( mainly boundingbox).
void DoRender (a2dIterC &ic, OVERLAP clipparent)
 render derived object
bool DoIsHitWorld (a2dIterC &ic, a2dHitEvent &hitEvent)
 Does hit test on the object (exclusif child objects).

Protected Attributes

bool m_spline
wxUint32 m_rendermode
wxUint32 m_editmode
a2dSweepPointArray * m_points
bool m_markerUpLow
 return of GetXyAtSweep() is upper side of curve if true, else low


Detailed Description

Curve represented by a number of vertexes.

Definition at line 704 of file curve.h.


Member Function Documentation

void a2dBandCurve::SetPosXYPoint ( int  index,
double  sweep,
double  y,
bool  upper 
)

modify point at index to x,y

Set the coordinates of the point at index to x,y.

Parameters:
index the index of the point to change
sweep new sweep for the point in curve coordinates
y new y for the point in curve coordinates
Remarks:
afterinversion = true should be used if you have x,y relative to the polygon object, while afterinversion = false should be used when x,y are relative to the point in the polygon.

Definition at line 2235 of file curve.cpp.

void a2dBandCurve::GetPosXYPoint ( int  index,
double &  sweep,
double &  y,
bool  upper 
)

get point x and y at index

Parameters:
index the index of the point to change
sweep new sweep for the point in curve coordinates
y new y for the point in curve coordinates

Definition at line 2295 of file curve.cpp.

void a2dBandCurve::GetPosXYPointWorld ( int  index,
double &  sweep,
double &  y,
bool  upper,
bool  transform 
)

get point x and y at index in world coordinates

Parameters:
index the index of the point to change
sweep new sweep for the point in world coordinates
y new y for the point in world coordinates
transform if true return x y transformed with local matrix

Definition at line 2307 of file curve.cpp.

void a2dBandCurve::RemovePoint ( double &  sweep,
double &  y,
bool  upper,
int  index = -1 
)

removes point at index

Parameters:
sweep sweep value of removed point in curve coordinates
y y value of removed point in curve coordinates
index index of point to remove (-1 means last point)

Definition at line 2246 of file curve.cpp.

void a2dBandCurve::RemovePointWorld ( double &  sweep,
double &  y,
bool  upper,
int  index = -1,
bool  transformed = true 
)

removes point at index

Parameters:
sweep sweep value of removed point in world coordinates
y y value of removed point in world coordinates
index index of point to remove (-1 means last point)
transformed if true returned values x,y are transformed with local matrix

Definition at line 2260 of file curve.cpp.

void a2dBandCurve::Alloc ( size_t  count  )  [inline]

Preallocates memory for a given number of array elements.

It is worth calling when the number of items which are going to be added to the array is known in advance because it will save unneeded memory reallocation. If the array already has enough memory for the given number of items, nothing happens.

Definition at line 799 of file curve.h.

a2dSweepPoint* a2dBandCurve::Detach ( size_t  index  )  [inline]

Removes the element from the array, but, unlike, Remove() doesn't delete it. The function returns the pointer to the removed element.

Definition at line 806 of file curve.h.

void a2dBandCurve::Empty (  )  [inline]

Empties the array. For wxObjArray classes, this destroys all of the array elements. this function does not free the allocated memory, use Clear() for this.

Definition at line 810 of file curve.h.

void a2dBandCurve::Insert ( a2dSweepPoint item,
size_t  n 
) [inline]

Insert a new point into the array before the point n - thus, Insert(something, 0u) will insert a point in such way that it will become the first array element.

Definition at line 814 of file curve.h.

a2dSweepPoint* a2dBandCurve::Item ( size_t  index  )  const [inline]

Returns the point pointer at the given position in the array. If index is out of bounds, an assert failure is raised in the debug builds but nothing special is done in the release build.

Definition at line 825 of file curve.h.

a2dSweepPoint* a2dBandCurve::Last (  )  const [inline]

Returns the last element in the array, i.e. is the same as Item(GetCount() - 1). An assert failure is raised in the debug mode if the array is empty.

Definition at line 829 of file curve.h.

void a2dBandCurve::RemoveAt ( size_t  index  )  [inline]

Removes a point from the array by index. When a point is removed it is deleted - use Detach() if you don't want this to happen.

Definition at line 833 of file curve.h.

void a2dBandCurve::Shrink (  )  [inline]

Frees all memory unused by the array.

If the program knows that no new items will be added to the array it may call Shrink() to reduce its memory usage. However, if a new item is added to the array, some extra memory will be allocated again.

Definition at line 840 of file curve.h.

void a2dBandCurve::SetRenderMode ( wxUint32  rendermode  )  [inline]

sets which parts or how the curve is rendered

See wxCurveRenderFlags for flags in the mask.

Definition at line 849 of file curve.h.

void a2dBandCurve::SetEditMode ( wxUint32  editmode  )  [inline]

sets how the curve is edited

See wxCurveEditFlags for flags in the mask.

Definition at line 858 of file curve.h.

bool a2dBandCurve::DoStartEdit ( wxUint16  editmode,
wxEditStyle  editstyle 
) [protected, virtual]

only used for editable objects and under control of a editing tool.

If object is editable this function is used to initialize the object for editing. In general this means adding editing handles to the child list. In the event handling of the object those handles are hit and moved, the object itself is changed accordingly.

Returns:
true is this object can be edited and is initialized for that.

Todo:
edit of bbox ( children or not included )

Reimplemented from a2dCanvasObject.

Definition at line 2325 of file curve.cpp.

void a2dBandCurve::OnCanvasObjectMouseEvent ( a2dCanvasObjectMouseEvent event  )  [protected]

default handler for mouse events, sent to the object from the a2dCanvasView.

Mouse events are sent to the object when the mouse pointer is hiting the object. The default is used when the object is in edit mode. Else it will detect if the special object tip property named __OBJECTTIP__ is available, and switch it on or off when the mouse eneter or leaves the object.

&& m_flags.m_subEditAsChild )

Reimplemented from a2dCanvasObject.

Definition at line 2861 of file curve.cpp.

void a2dBandCurve::DoLoad ( wxObject *  parent,
a2dIOHandlerXmlSerIn parser,
a2dXmlSer_flag  xmlparts 
) [protected, virtual]

load object specific CVG data

todo ignore until this down here is fully converted.

Reimplemented from a2dCurve.

Definition at line 2745 of file curve.cpp.

bool a2dBandCurve::DoUpdate ( UpdateMode  mode,
const a2dBoundingBox childbox,
const a2dBoundingBox clipbox,
const a2dBoundingBox propbox 
) [protected, virtual]

Update derived Object specific things ( mainly boundingbox).

Calculates the boundingbox of the object (exclusif base class child objects but with other nested objects).

Parameters:
mode way to update the objects
childbox size of children boundingbox
clipbox clip to this
propbox size of properties boundingbox
Remarks:
in a derived class this function can also be used to update object specific cache data.

force may or may not have direct influence on the object itself, if this function is called directly for some reason (e.g from derived objects), you must invalidate the boudingbox yourself. GetDrawerBox()->SetValid( false );

Reimplemented from a2dCurveObject.

Definition at line 2558 of file curve.cpp.

void a2dBandCurve::DoRender ( a2dIterC ic,
OVERLAP  clipparent 
) [protected, virtual]

render derived object

if the object has sub objects (apart from the childobject which are handled here), those subobject most rendered by iterating on layer when needed/wanted, simular to child objects. We do not iterate here, since that is only needed if indeed there or subobjects. This will be know in a "wxDerivedCanvasObject DoRender".

SO parent objects that call this function, must:

  • 1- clip object against area to redraw.
  • 2- iterate on layers when needed.
A a2dCanvasObject is rendered as a + (plus sign) when there or no children.

Reimplemented from a2dCanvasObject.

Definition at line 2589 of file curve.cpp.

bool a2dBandCurve::DoIsHitWorld ( a2dIterC ic,
a2dHitEvent hitEvent 
) [protected, virtual]

Does hit test on the object (exclusif child objects).

DoIsHitWorld() should return the way the object is hit by filling a2dHitEvent::m_how with the correct info.

Parameters:
ic iterative context ( e.g. current transform WITH the local transform applied )
hitEvent stores hit information
Returns:
true if hit

Reimplemented from a2dCanvasObject.

Definition at line 2772 of file curve.cpp.


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