11 #pragma warning(disable:4786)
23 #include <wx/wfstream.h>
26 #include "wx/canvas/eval.h"
35 #if wxART2D_USE_EDITOR
37 #endif //wxART2D_USE_EDITOR
50 #define wxMAX_COORDINATE INT_MAX
51 #define wxMIN_COORDINATE INT_MIN
53 #define wxMAX_COORDINATE 100e99
54 #define wxMIN_COORDINATE 100e-99
57 a2dBboxHash::a2dBboxHash(
void )
96 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
98 CurrentSmartPointerOwner =
this;
113 m_intrect = other.m_intrect;
125 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
127 CurrentSmartPointerOwner =
this;
131 a2dCurvesArea::~a2dCurvesArea()
187 wxASSERT_MSG( extbox.
GetWidth() != 0, wxT(
"pixel size can not be zero" ) );
188 wxASSERT_MSG( extbox.
GetHeight() != 0, wxT(
"pixel size can not be zero" ) );
202 if ( !curvename.IsEmpty() )
221 if ( !curvename.IsEmpty() )
232 if( obj->
GetName() == curvename )
388 bool retCode =
false;
405 if ( zerox < extbox.
GetMinX() )
407 else if ( zerox > extbox.
GetMaxX() )
425 if ( curve && curve->IsHighlighted() )
433 m_markerShow = showm;
439 m_markerShow2 = showm;
477 #if wxART2D_USE_CVGIO
482 if ( xmlparts == a2dXmlSer_attrib )
484 out.WriteAttribute( wxT(
"showyaxis" ) ,
m_showyaxis );
487 out.WriteAttribute( wxT(
"ixmin" ) , m_intrect.
GetMinX() );
488 out.WriteAttribute( wxT(
"iymin" ) , m_intrect.
GetMinY() );
489 out.WriteAttribute( wxT(
"ixmax" ) , m_intrect.
GetMaxX() );
490 out.WriteAttribute( wxT(
"iymax" ) , m_intrect.
GetMaxY() );
505 if ( xmlparts == a2dXmlSer_attrib )
531 #include <wx/arrimpl.cpp>
532 WX_DEFINE_OBJARRAY( a2dCurvesAreaListBase );
534 a2dCurvesAreaList::a2dCurvesAreaList()
537 m_autoshowyaxes =
false;
543 m_leftAxisY = curvesarea;
546 a2dCurvesAreaList::a2dCurvesAreaList(
const a2dCurvesAreaList& other, CloneOptions options,
a2dRefMap* refs )
549 m_autoshowyaxes = other.m_autoshowyaxes;
550 for(
size_t i = 0; i < other.GetCount(); i++ )
562 a2dCurvesAreaList::~a2dCurvesAreaList()
569 a2dCurvesAreaList* cloneArea =
new a2dCurvesAreaList( *
this, options, refs );
576 for(
size_t i = 0; i < GetCount(); i++ )
579 if( area->
GetName().IsEmpty() )
581 else if( area->
GetName() == curvesAreaName )
584 if( emptyArea != NULL && !curvesAreaName.IsEmpty() )
585 emptyArea->
SetName( curvesAreaName );
592 for(
size_t i = 0; i < GetCount(); i++ )
595 if( area->
GetName() == curvesAreaName )
603 for(
size_t i = 0; i < GetCount(); i++ )
612 for(
size_t i = 0; i < GetCount(); i++ )
625 for(
size_t i = 0; i < GetCount(); i++ )
629 area->
Walker(
this, handler );
637 for(
size_t i = 0; i < GetCount(); i++ )
649 for(
size_t i = 0; i < GetCount(); i++ )
653 ( *irectHash )[area->
GetName()] = aRect;
660 for(
size_t i = 0; i < GetCount(); i++ )
665 ( *irectHash )[area->
GetName()] = aRect;
686 void a2dCurvesAreaList::AddPending(
a2dIterC& ic )
688 for(
size_t i = 0; i < GetCount(); i++ )
697 bool retCode =
false;
702 for(
size_t i = 0; i < GetCount(); i++ )
706 if( m_autoshowyaxes )
709 retCode = area->
Update( mode ) || retCode;
710 if( m_autoshowyaxes )
712 if( !leftOK || !rightOK )
718 else if( !rightAxisY )
725 if( m_autoshowyaxes )
737 if( !leftOK && rightAxisY )
756 if( !rightOK && leftAxisY )
768 if( m_autoshowyaxes )
777 if( m_autoshowyaxes )
790 double tzerox, tzeroy, tixmin, tixmax;
791 for(
size_t i = 0; i < GetCount(); i++ )
800 if( m_autoshowyaxes )
808 if( m_autoshowyaxes )
831 for(
size_t i = 0; i < GetCount(); i++ )
836 area->
Render( ic, clipparent );
844 for(
size_t i = 0; i < GetCount(); i++ )
847 if( area->
GetName() == curveAreaName )
856 if( m_autoshowyaxes )
867 for(
size_t i = 0; i < GetCount(); i++ )
870 if( area->
GetName() == curveAreaName )
876 if( m_autoshowyaxes )
883 if( m_autoshowyaxes )
901 double abs_val = fabs( val );
902 if( abs_val < 1E-10 )
904 double expon = log10( abs_val );
905 int toInt = int( expon < 0 ? expon - 1 : expon );
906 double standardized = val * pow( 10., -toInt );
909 int sign = val < 0. ? -1 : 1;
910 double abs_standardized = fabs( standardized );
911 if( abs_standardized <= 1.0001 )
912 return pow( 10., toInt ) * sign;
913 else if( abs_standardized <= 1.2501 )
914 return 1.25 * pow( 10., toInt ) * sign;
915 else if( abs_standardized <= 2.0001 )
916 return 2.*pow( 10., toInt ) * sign;
917 else if( abs_standardized <= 2.5001 )
918 return 2.5 * pow( 10., toInt ) * sign;
919 else if( abs_standardized <= 5.0001 )
920 return 5.*pow( 10., toInt ) * sign;
921 return 10.*pow( 10., toInt ) * sign;
924 double expand = val < 0. ? -0.5 : 0.5;
925 return double( (
int( standardized + expand ) ) * pow( 10., toInt ) );
928 double a2dBoundsRound(
double val )
933 double a2dTicsRound(
double val )
938 void a2dCurvesAreaList::SetTicY(
int numLines )
943 double numLines2 = numLines / 2;
945 for(
size_t i = 0; i < GetCount(); i++ )
953 double meanY = newRect.
GetMinY() + curHeight / 2.;
954 double newHeight = a2dTicsRound( curHeight / (
double )numLines ) * numLines;
955 double aTic = newHeight / ( double )numLines;
956 wxASSERT( aTic > 1E-12 );
957 double newMeanY = int( ( meanY / aTic ) + ( meanY < 0. ? -0.5 : 0.5 ) ) * aTic;
958 double newMinY = newMeanY - newHeight / 2.;
959 if( newRect.
GetMinY() == 0. && newMinY < 0. )
963 double newMaxY = newMinY + newHeight;
968 precision = m_group->SetAxisTicPrecision( axisY, newMinY, newMaxY );
971 m_group->SetCommonTicPrecision( precision );
1036 for(
size_t i = 0; i < GetCount(); i++ )
1044 bool a2dCurvesAreaList::GetPending(
void )
1046 bool retCode =
false;
1047 for(
size_t i = 0; i < GetCount(); i++ )
1055 void a2dCurvesAreaList::UpdateViewDependentObjects(
a2dIterC& ic )
1057 for(
size_t i = 0; i < GetCount(); i++ )
1064 void a2dCurvesAreaList::SetCursor(
a2dCursor* cursor )
1066 cursor->RemoveMarkers();
1067 for(
size_t i = 0; i < GetCount(); i++ )
1072 cursor->AddMarker( marker );
1078 bool retCode =
false;
1079 for(
size_t i = 0; i < GetCount() && !retCode; i++ )
1087 bool a2dCurvesAreaList::GetHasToolObjectsBelow()
1089 bool retCode =
false;
1090 for(
size_t i = 0; i < GetCount() && !retCode; i++ )
1098 void a2dCurvesAreaList::SetClippingFromBox(
a2dBoundingBox& bbox )
1100 for(
size_t i = 0; i < GetCount(); i++ )
1107 void a2dCurvesAreaList::SetGroup( a2dCanvasXYDisplayGroupAreas* aGroup )
1110 for(
size_t i = 0; i < GetCount(); i++ )
1117 #if wxART2D_USE_CVGIO
1123 if ( xmlparts == a2dXmlSer_attrib )
1130 for(
size_t i = 0; i < GetCount(); i++ )
1133 area->
Save(
this, out, towrite );
1140 void a2dCurvesAreaList::DoLoad( wxObject* parent,
a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts )
1145 if ( xmlparts == a2dXmlSer_attrib )
1171 EVT_CHAR( a2dCanvasXYDisplayGroupAreas::OnChar )
1179 if ( m_axesarealist )
1180 m_axesarealist->Walker(
this, handler );
1183 m_axisX->Walker(
this, handler );
1187 m_cursor->Walker(
this, handler );
1242 void a2dCanvasXYDisplayGroupAreas::OnChar( wxKeyEvent& event )
1246 switch( event.GetKeyCode() )
1250 ChangeCursorPos( -1 );
1255 ChangeCursorPos( -10 );
1260 ChangeCursorPos( -1024 );
1265 ChangeCursorPos( 1 );
1270 ChangeCursorPos( 10 );
1275 ChangeCursorPos( 1024 );
1330 #if wxART2D_USE_EDITOR
1339 drawrec->SetEditAtEnd(
true );
1340 #else //wxART2D_USE_EDITOR
1341 wxMessageBox( wxT(
"Need editor module enabled for this" ) );
1342 #endif //wxART2D_USE_EDITOR
1349 #if wxART2D_USE_EDITOR
1358 draw->SetEditAtEnd(
true );
1359 #else //wxART2D_USE_EDITOR
1360 wxMessageBox( wxT(
"Need editor module enabled for this" ) );
1361 #endif //wxART2D_USE_EDITOR
1376 hitinfo.m_xyRelToChildren =
true;
1380 #if wxART2D_USE_EDITOR
1387 #else //wxART2D_USE_EDITOR
1388 wxMessageBox( wxT(
"Need editor module enabled for this" ) );
1389 #endif //wxART2D_USE_EDITOR
1401 hitinfocurve.m_xyRelToChildren =
true;
1405 #if wxART2D_USE_EDITOR
1412 #else //wxART2D_USE_EDITOR
1413 wxMessageBox( wxT(
"Need editor module enabled for this" ) );
1414 #endif //wxART2D_USE_EDITOR
1448 hitinfomarker.m_xyRelToChildren =
true;
1452 #if wxART2D_USE_EDITOR
1460 #else //wxART2D_USE_EDITOR
1461 wxMessageBox( wxT(
"Need editor module enabled for this" ) );
1462 #endif //wxART2D_USE_EDITOR
1516 m_cursorOnlyByCurves =
true;
1520 m_autoTicYPrecision =
true;
1554 m_cursorOnlyByCurves = other.m_cursorOnlyByCurves;
1555 m_showgrid = other.m_showgrid;
1556 m_showxaxis = other.m_showxaxis;
1557 m_autoTicYPrecision = other.m_autoTicYPrecision;
1564 m_strokegrid = other.m_strokegrid;
1565 m_fillAxisArea = other.m_fillAxisArea;
1566 m_strokeAxisArea = other.m_strokeAxisArea;
1572 m_strokegrid = other.m_strokegrid;
1573 m_fillAxisArea = other.m_fillAxisArea;
1574 m_strokeAxisArea = other.m_strokeAxisArea;
1579 if( options & clone_members )
1587 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
1589 CurrentSmartPointerOwner =
this;
1604 wxASSERT_MSG( curvesarea != (
a2dCurvesArea* )NULL, wxString::Format( wxT(
"can't create curves area with name '%s' " ), curveAreaName.c_str() ) );
1636 curvesarea->
AddCurve( curve, curvename );
1646 curvesarea->
InsertCurve( before, curve, curvename );
1654 wxASSERT_MSG( curvesarea != NULL, wxString::Format( wxT(
"not found curves area by name '%s' " ), curveAreaName.c_str() ) );
1667 wxASSERT_MSG( curvesarea != NULL, wxString::Format( wxT(
"not found curves area by name '%s' " ), curveAreaName.c_str() ) );
1677 void a2dCanvasXYDisplayGroupAreas::SetCursor(
a2dCursor* cursor )
1691 void a2dCanvasXYDisplayGroupAreas::ChangeCursorPos(
double step )
1696 double newposx, tempposy;
1702 double currentPosition = newposx;
1703 double smallStep = step / ( fabs( step ) );
1705 if( newposx < ibox.
GetMinX() )
1710 if( newposx > ibox.
GetMaxX() )
1715 if( m_cursorOnlyByCurves )
1717 bool currentPositionOK =
m_cursor->CheckPosition( currentPosition );
1718 double newposition = newposx;
1719 while( !
m_cursor->CheckPosition( newposx ) )
1721 newposx += smallStep;
1724 newposx = newposition;
1725 while( !
m_cursor->CheckPosition( newposx ) )
1727 newposx -= smallStep;
1730 if( currentPositionOK )
1732 newposx = newposition;
1746 wxASSERT_MSG( curvesarea != NULL, wxString::Format( wxT(
"not found curve by name '%s' " ), curveAreaName.c_str() ) );
1748 return curvesarea->
GetCurve( curvename );
1755 wxASSERT_MSG( curvesarea != NULL, wxString::Format( wxT(
"not found curves area by name '%s' " ), curveAreaName.c_str() ) );
1764 wxASSERT_MSG( curvesarea != NULL, wxString::Format( wxT(
"not found curves area by name '%s' " ), curveAreaName.c_str() ) );
1776 wxASSERT_MSG( curvesarea != NULL, wxString::Format( wxT(
"not found curves area by name '%s' " ), curveAreaName.c_str() ) );
1783 wxASSERT_MSG( curvesarea != NULL, wxString::Format( wxT(
"not found curves area by name '%s' " ), curveAreaName.c_str() ) );
1802 m_strokegrid = stroke;
1808 m_fillAxisArea = fill;
1814 m_strokeAxisArea = stroke;
1829 wxASSERT_MSG( curvesarea != NULL, wxString::Format( wxT(
"not found curve area by name '%s' " ), curveAreaName.c_str() ) );
1852 wxASSERT_MSG( curvesarea != NULL, wxString::Format( wxT(
"not found curves area by name '%s' " ), curveAreaName.c_str() ) );
1871 a2dAffineMatrix a2dCanvasXYDisplayGroupAreas::GetCurvesAreaTransform(
const wxString& curveAreaName )
1874 wxASSERT_MSG( curvesarea != NULL, wxString::Format( wxT(
"not found curves area by name '%s' " ), curveAreaName.c_str() ) );
1902 bool pendingchild =
false;
1975 double zerox, zeroy;
1976 double ixmin, ixmax;
2039 void a2dCanvasXYDisplayGroupAreas::DrawGrid(
a2dIterC& ic )
2058 ticstartx = floor( intrect.
GetMinX() / ticx + 0.5 ) * ticx;
2059 if ( ( ticx > 0. && ticstartx <= intrect.
GetMinX() ) || ( ticx < 0. && ticstartx >= intrect.
GetMinX() ) )
2061 ticstarty = floor( intrect.
GetMinY() / ticy + 0.5 ) * ticy;
2062 if ( ( ticy > 0. && ticstarty <= intrect.
GetMinY() ) || ( ticy < 0. && ticstarty >= intrect.
GetMinY() ) )
2066 for ( x = ticstartx; ( ticx > 0. && x < intrect.
GetMaxX() ) || ( ticx < 0. && x > intrect.
GetMaxX() ) ; x = x + ticx )
2074 for ( y = ticstarty; ( ticy > 0. && y < intrect.
GetMaxY() ) || ( ticy < 0. && y > intrect.
GetMaxY() ) ; y = y + ticy )
2104 wxASSERT_MSG( curvesarea != NULL, wxString::Format( wxT(
"not found curve by name '%s' " ), curveAreaName.c_str() ) );
2109 void a2dCanvasXYDisplayGroupAreas::ClearCurvesAreas()
2118 void a2dCanvasXYDisplayGroupAreas::SetAreaMarkerShow(
const wxString& curveAreaName,
a2dMarkerShow* showm )
2121 wxASSERT_MSG( curvesarea != NULL, wxString::Format( wxT(
"not found curves area by name '%s' " ), curveAreaName.c_str() ) );
2122 curvesarea->SetMarkerShow( showm );
2126 void a2dCanvasXYDisplayGroupAreas::SetAreaMarkerShow2(
const wxString& curveAreaName,
a2dMarkerShow* showm )
2129 wxASSERT_MSG( curvesarea != NULL, wxString::Format( wxT(
"not found curves area by name '%s' " ), curveAreaName.c_str() ) );
2130 curvesarea->SetMarkerShow2( showm );
2134 a2dMarkerShow* a2dCanvasXYDisplayGroupAreas::GetAreaMarkerShow(
const wxString& curveAreaName )
const
2137 wxASSERT_MSG( curvesarea != NULL, wxString::Format( wxT(
"not found curves area by name '%s' " ), curveAreaName.c_str() ) );
2138 return curvesarea->GetMarkerShow();
2141 a2dMarkerShow* a2dCanvasXYDisplayGroupAreas::GetAreaMarkerShow2(
const wxString& curveAreaName )
const
2144 wxASSERT_MSG( curvesarea != NULL, wxString::Format( wxT(
"not found curves area by name '%s' " ), curveAreaName.c_str() ) );
2145 return curvesarea->GetMarkerShow2();
2148 void a2dCanvasXYDisplayGroupAreas::SetTicY(
int numLines )
2153 int a2dCanvasXYDisplayGroupAreas::SetAxisTicPrecision(
a2dCurveAxis* axisY,
double newMinY,
double newMaxY )
2155 if( m_autoTicYPrecision )
2157 double aTic = axisY->
GetTic();
2158 double abs_tic = fabs( aTic );
2160 double maxVal = wxMax( fabs( newMinY ), fabs( newMaxY ) );
2161 if( maxVal > 999999. )
2166 else if( abs_tic <= 1E-6 )
2169 if( precision != 5 )
2172 else if( abs_tic <= 1E-4 )
2175 if( precision != 4 && precision != 5 )
2178 else if( abs_tic <= 0.026 )
2181 if( precision != 1 )
2184 else if( abs_tic >= 1. )
2186 if(
int( abs_tic ) * 10 ==
int( abs_tic * 10. ) )
2188 else if(
int( abs_tic * 10 ) * 10 ==
int( abs_tic * 100. ) )
2200 void a2dCanvasXYDisplayGroupAreas::SetCommonTicPrecision(
int precision )
2202 if( m_autoTicYPrecision )
2204 wxString commonTicFormat;
2208 case 1: commonTicFormat = wxT(
"%f2.2" );
break;
2209 case 2: commonTicFormat = wxT(
"%f2.3" );
break;
2210 case 3: commonTicFormat = wxT(
"%f4.2" );
break;
2211 case 4:
case 5: commonTicFormat = wxT(
"%g" );
break;
2221 #if wxART2D_USE_CVGIO
2225 if ( xmlparts == a2dXmlSer_attrib )
2227 out.WriteAttribute( wxT(
"cursorOnlyByCurves" ) , m_cursorOnlyByCurves );
2228 out.WriteAttribute( wxT(
"showgrid" ) , m_showgrid );
2229 out.WriteAttribute( wxT(
"showxaxis" ) , m_showxaxis );
2230 out.WriteAttribute( wxT(
"autoTicYPrecision" ) , m_autoTicYPrecision );
2243 m_strokegrid.Save(
this, out, towrite );
2244 m_fillAxisArea.Save(
this, out, towrite );
2245 m_strokeAxisArea.Save(
this, out, towrite );
2262 if ( xmlparts == a2dXmlSer_attrib )
2280 m_strokegrid = m_strokegrid;
2281 m_fillAxisArea = m_fillAxisArea;
2282 m_strokeAxisArea = m_strokeAxisArea;
2284 m_strokegrid.Load( parent, parser );
2286 m_fillAxisArea.Load( parent, parser );
2288 m_strokeAxisArea.Load( parent, parser );
2308 : a2dCanvasXYDisplayGroupAreas( x, y )
2310 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
2312 CurrentSmartPointerOwner =
this;
2321 : a2dCanvasXYDisplayGroupAreas( other, options, refs )
2324 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
2326 CurrentSmartPointerOwner =
this;
2336 #endif //wxART2D_USE_CVGIO
a2dHit m_how
return in which way the object was hit (stroke, fill, ...)
bool m_processed
set if event was processed sofar
void SetClippingFromBox(a2dBoundingBox &bbox=wxNonValidBbox)
set the clipping polygon according to the given box
wxString GetLeftAxisText() const
if left axis a2dCurveArea is set, the label text will be set to this
cursor on curve plot as a vertical line with markers
virtual bool ProcessCanvasObjectEvent(a2dIterC &ic, a2dHitEvent &hitEvent)
Hit objects will receive the event.
double m_relx
(world coordinates) hit point x relative to the canvas object its parent object(s) ...
double GetHeight() const
returns height of the boundingbox
double GetPosition() const
get position of axis ( zero is default )
void SetAxisAreaFill(const a2dFill &fill)
Set a fill for axis area.
virtual void Render(a2dIterC &ic, OVERLAP clipparent)
Render this object to the active a2dDrawingPart.
(In) Visible property that can be added to Docview Objects.
#define wxDynamicCast(obj, className)
Define wxDynamicCast so that it will give a compiler error for unrelated types.
Base class for all types of strokes, understood by a2dDrawer2D classes.
void SetRoot(a2dDrawing *root, bool recurse=true)
Sets this object to a a2dCanvasDocument.
void AddMarker(a2dMarker *marker)
add a marker
void SetShowRightYaxis(const wxString &curveAreaName, bool showyaxis)
the a2dCurveArea with the given name is set as holding the rigth Yaxis
bool HasAttribute(const wxString &attrib)
Does the current tag have this attribute?
void AddPending(a2dIterC &ic)
search objects ( if nested recursive ) that have the pending flag Set
bool GetEditable() const
get if the object may be edited
mouse event sent from a2dCanvasObject to itself
void SetMaxY(double maxy)
set the bounding box its maximum Y, does not validate the box
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...
virtual wxString GetName() const
Returns the name of this object, if no name is given the internal id will be returned.
void SetRelease(bool value)
set release flag
a2dCanvasObjectList * GetCurvesFromArea(const wxString &curveAreaName)
returns the list where the curves are stored in.
XMLeventType Next()
Walks to next element and returns event type.
bool RequireAttributeValueBool(const wxString &attrib)
Forces an attribute and returns its boolean value.
void SetCommonTicFormat(const wxString &format)
Set how common tic text is formated/displayed for all (Y-axes).
bool ResolveOrAdd(a2dSmrtPtr< a2dObject > *storedHere, const wxString &id=wxT(""))
try to resolve the object that is in storedHere when it is a reference.
class to map references to objects stored in XML, in order to make the connection later on...
void SetCurvesArea(a2dCurvesArea *curvesArea)
used for conversion of curve data to curvegroup area
void DoAddPending(a2dIterC &ic)
called by addPending
double a2dInternal_BoundsRound(double val, bool tics)
a2dCanvasOFlags m_flags
holds flags for objects
a2dSmrtPtr< a2dCurvesArea > m_rightAxisY
the curve area to display the right Y axis
const a2dAffineMatrix & GetInverseTransform() const
Inverse of GetTransform()
a2dSmrtPtr< a2dCurvesArea > m_leftAxisY
the curve area to display the left Y axis
bool GetHasSelectedObjectsBelow()
selected object itself or one of its recursive children
a2dMarker * GetCursorMarker() const
search a marker ( placed to show a position on a curve )
virtual void DoWalker(wxObject *parent, a2dWalkerIOHandler &handler)
iterate over this object and its children
bool GetPending() const
is this object pending for update?
void SetAxisY(a2dCurveAxis *axisY)
set Y axis of this curve area
void SetAxisText(const wxString &curveAreaName, const wxString &text, const wxColour &color)
set axis text for given curve area
a2dDrawing * GetRoot() const
get a2dCanvasDocument of the object.
void Enlarge(const double Marge)
enlarge with the given amount
proptype * GetPropertyListOnly(const a2dObject *obj) const
Get the property from the list in obj ( no members, not cloned )
a2dSmrtPtr< a2dCurvesArea > GetBaseCurvesArea() const
the a2dCurveArea which has bin set to be the m_leftAxisY
a2dCanvasObject * GetCaptured() const
are events redirected to a captured corridor? if so return the captured object in it...
a2dObject * Clone(CloneOptions options, a2dRefMap *refs=NULL) const
create an exact copy of this property
bool m_pending
set when a2dCanvasObject needs an update (redraw).
a2dSmrtPtr< a2dCurveAxis > m_axisY
y axis object
void SetMaxX(double maxx)
set the bounding box its maximum X, does not validate the box
virtual bool Update(UpdateMode mode)
Update the state of the object according to its current position etc.
virtual void DependencyPending(a2dWalkerIOHandler *handler)
called by to check if this object becomes pending as a result of other objects
void DoWalker(wxObject *parent, a2dWalkerIOHandler &handler)
iterate over this object and its children
void SetDrawerStroke(const a2dStroke &stroke)
Used to set the current stroke.
Input and output handler for the XmlSer format.
UpdateMode
Various mode flags for Update.
a2dBoundingBox GetCurveBoundaries()
get boundary box of plot boundary in curve coordinates
void World2Curve(double xw, double yw, double &xcurve, double &ycurve)
used by a2dCurve to transform its own curve coordinates to the curve plotting area ...
virtual void SetPending(bool pending)
set this object pending for update
OVERLAP
Result of a a2dBoundingBox intersection or hittest.
double GetTic() const
get distance of tic lines in X/Y (curve coords)
void DoWalker(wxObject *parent, a2dWalkerIOHandler &handler)
iterate over this object and its children
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
void DependencyPending(a2dWalkerIOHandler *handler)
called by to check if this object becomes pending as a result of other objects
void SetInternalBoundaries(double ximin, double yimin, double ximax, double yimax, const wxString &curveAreaName=wxEmptyString)
set the minimum and maximum values to be displayed in the axisarea
The base class for all drawable objects in a a2dCanvasDocument.
For Showing Marker position of Markers on a Curve.
const a2dCanvasObjectList * GetCurves() const
returns the list where the curves are stored in.
void InsertCurve(size_t before, a2dCurve *curve, const wxString curvename=_T(""))
add a curve to the end of the existing curves.
wxUint16 m_layer
layer of object, default wxLAYER_DEFAULT
base class for axis in a2dCanvasXYDisplayGroup
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
a2dCanvasObject is the base class for Canvas Objects.
wxString GetAxisText() const
get text to display for axis label
void AddCurve(a2dCurve *curve, const wxString curvename=_T(""))
add a curve to the end of the exisiting curves.
void SetTic(double d)
distance of tic lines in X/Y (curve coords)
virtual ~a2dCanvasXYDisplayGroup()
destructor
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dDerivedCanvasObjectStart
id for a2dWalkEvent issued from within a2dWalkerIOHandler
a2dCanvasObjectList * GetChildObjectList()
get the list where the child objects are stored in.
a2dCanvas uses a2dCanvasView for displaying a view on a a2dCanvasDocument.
void TransformPoint(double x, double y, double &tx, double &ty) const
Transform a point.
virtual void EndEdit()
cleanup an editcopy object
a2dSmrtPtr< a2dCurvesAreaList > m_axesarealist
internal object used to display the curves in internal coordinates
simple curve group with just one a2dCurvesArea in use
virtual void SetName(const wxString &name)
Creates the a2dStringProperty PROPID_Name.
void WriteEndElement(bool newLine=true)
Writes correspondending end tag for the current start tag.
bool ProcessCanvasObjectEvent(a2dIterC &ic, a2dHitEvent &hitEvent)
Hit objects will receive the event.
void Curve2World(double xcurve, double ycurve, double &xw, double &yw)
used by a2dCurve to transform its own curve coordinates to the curve plotting area ...
void AddCurveToArea(const wxString &curveAreaName, a2dCurve *curve, const wxString curvename=_T(""))
add a curve to the end of the existing curves in a given a2dCurveArea
void RenderAxesY(a2dIterC &ic, OVERLAP clipparent)
render all Yaxis objects ( of Left and Right a2dCurveArea )
a2dCurveObject for objects needing to know its parent a2dCurvesArea.
int ReleaseChild(a2dCanvasObject *obj, bool backwards=false, bool all=false, bool now=false, bool undoCommands=false)
remove the given object from the childobjects
float m_worldExtend
world extend in world coordinates.
a2dAffineMatrix m_lworld
used for positioning the object (x,y,ang,scale etc.)
void SetBoundaries(const a2dBoundingBox &extbox)
sets for all curve areas in the list the same boundaries
void SetDrawerFill(const a2dFill &fill)
Used to set the current fill.
a2dBoundingBox GetInternalBoundaries(const wxString &curveAreaName=wxEmptyString) const
return curve coordinate boundaries of a given curve area
Io handler to iterate through a a2dDocument.
void WriteNewLine()
Writes a new line and takes care of indentation.
void RemoveMarkerFromArea(const wxString &curveAreaName, a2dMarker *marker)
remove a marker
list for a2dCurvesArea objects
double ExtendDeviceToWorld(int extend)
Transform a pixel extend from device to world units.
bool ProcessCanvasObjectEvent(a2dIterC &ic, a2dHitEvent &hitEvent)
Hit objects will receive the event.
bool m_isOnCorridorPath
This object is on the corridor path to a captured object or to a corridored object.
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
double GetMinX() const
get minimum X of the boundingbox
virtual void DrawRoundedRectangle(double x, double y, double width, double height, double radius, bool pixelsize=false)
Draw RoundedRectangle in world coordinates.
int AppendInternalBoundaries(a2dBboxHash *irectHash)
fills a2dBboxHash with rectangles representing the plotting area of a curve
void AddMarkerToArea(const wxString &curveAreaName, a2dMarker *marker)
add a marker
#define forEachIn(listtype, list)
easy iteration for a2dlist
clips all children to a polygon
const a2dBoundingBox & GetPlotAreaRect() const
get the boundingbox in relative world coordinates of the plot area
virtual void DoUpdateViewDependentObjects(a2dIterC &ic)
update derived objects
void DoAddPending(a2dIterC &ic)
called by addPending
void SetPropertyToObject(a2dObject *obj, const basetype &value, SetFlags setflags=set_none) const
Set the property in obj to value.
void Walker(wxObject *parent, a2dWalkerIOHandler &handler)
This is used to recursively walk through an object tree.
double GetPosX() const
get x position from affine matrix
const a2dAffineMatrix & GetCurveAreaTransform()
a2dCurveAxis * GetAxisY()
get Y axis of this curve area
a2dCurve * GetCurve(const wxString curvename)
return curve named curvename, if not available returns NULL
base class for axis in a2dCanvasXYDisplayGroup
a2dDrawer2D * GetDrawer2D() const
get current a2dDrawer2D
#define wxStaticCast(obj, className)
The wxWindows 2.4.2 wxStaticCast is buggy. It evaluates its argument twice.
bool m_editable
object can be edited
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
Save settings.
#define EVT_CANVASOBJECT_MOUSE_EVENT(func)
static event table macro for a2dCanvasObject mouse event
int AppendInternalBoundaries(a2dBboxHash *irectHash)
fills a2dBboxHash with rectangles representing the plotting area of a curve
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
void SetLength(double length)
set length in world coordinates ( not axis coordinates )
bool m_isHit
in the end if there was a hit (even if not processed event)
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
wxString GetRightAxisText() const
if right a2dCurveArea is set, the label text will be set to this
Special object group to plot a2dCurve Objects but also any other a2dCanvasObject. ...
void SetMin(double px, double py)
set the bounding box its maximum
int AppendCurvesBoundaries(a2dBboxHash *irectHash)
fills a2dBboxHash with rectangles representing the plotting area of a curve
virtual void DrawLine(double x1, double y1, double x2, double y2)
Draw line in world coordinates.
void SetMinY(double miny)
set the bounding box its minimum Y, does not validate the box
Input and output handler for the XmlSer format.
if set, respect layer order, hit testing is done per layer from the top.
void SetAreaAxisY(const wxString &curveAreaName, a2dCurveAxis *axisY)
set Y axis object for given curve area
void DoUpdateViewDependentObjects(a2dIterC &ic)
update derived objects
a2dCurve * GetCurveFromArea(const wxString &curveAreaName, const wxString curvename)
return curve named curvename, if not available returns NULL
void DoUpdateViewDependentObjects(a2dIterC &ic)
update derived objects
void SetAxes(const a2dBoundingBox &extbox, double x, double y, double &zerox, double &zeroy, double &ixmin, double &ixmax)
sets m_axisY values
bool Identity(void)
Make into identity matrix.
void UpdateInternalBoundaries(const a2dBoundingBox &extbox)
update conversion matrix to/from curve to world coordinates
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
clone it
a2dBoundingBox m_plotrect
placement in world coordinates
a2dCanvasObject * ChildIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent, bool filterSelectableLayers=false)
Do hittest on children.
virtual bool DoStartEdit(wxUint16 editmode, wxEditStyle editstyle)
only used for editable objects and under control of a editing tool.
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
A 2x3 affine matrix class for 2D transformations.
wxMouseEvent & GetMouseEvent()
return the original mouse event that was redirected to the a2dCanvasObject
bool SetAxisText(const wxString &name)
set text to display for axis label
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
Save settings.
void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
wxUint16 m_pixelExtend
Pixel extend.
bool Update(UpdateMode mode)
Update the state of the object according to its current position etc.
double GetMaxX() const
get maximum X of the boundingbox
void Render(a2dIterC &ic, OVERLAP clipparent)
render by first setting clipping box and next start rendering children and itself.
void SetGridStroke(const a2dStroke &stroke)
Set a stroke for grid.
if set, set in the clone the PROPID_editcopy property to the original object
void SetShowYaxis(bool showyaxis)
set show yaxis
void SetShowLeftYaxis(const wxString &curveAreaName, bool showyaxis)
the a2dCurveArea with the given name is set as holding the left Yaxis
void SetMax(double px, double py)
set the bounding box its minimum
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
Load settings.
void SetAxisAreaStroke(const a2dStroke &fill)
Set a stroke around axis area.
a2dCanvasXYDisplayGroupAreas * m_group
the group of which the area is a part
void InsertCurveToArea(const wxString &curveAreaName, size_t before, a2dCurve *curve, const wxString curvename=_T(""))
add a curve to the end of the exisiting curves.
while iterating a a2dCanvasDocument, this holds the context.
void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
double GetTicY() const
tic distance in Y for the m_leftAxisY area
void UpdateViewDependentObjects(a2dIterC &ic)
update the transform matrix for objects with property 'PROPID_viewDependent'
void SetGroup(a2dCanvasXYDisplayGroupAreas *aGroup)
the group of which the area is a part
a2dBoundingBox GetCurvesBoundaries()
get the boundingbox in internal curve coordinates of all the curves
double m_x
(world coordinates) hit point x as in a2dDrawingPart or any other top level
void MapBbox(const a2dAffineMatrix &matrix)
bool ReleaseChildObjects(a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL)
removes and release only from the childobjects the objects with the given mask
a2dCurvesArea * GetCurvesArea(const wxString &curvesAreaName)
get a2dCurvesArea with the given name
virtual ~a2dCanvasXYDisplayGroupAreas()
destructor
bool DoIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
Does hit test on the object (exclusif child objects)
virtual void Load(wxObject *parent, a2dIOHandlerXmlSerIn &parser)
load object from CVG file
wxString GetAttributeValue(const wxString &attrib, const wxString &defaultv=wxT(""))
Returns the value of an attribute.
void SetBoundaries(double min, double max)
define which part is displayed on this axis
void SetShowRightYaxis(const wxString &curveAreaName, bool showyaxis)
show yaxis
editing tool for a2dCanvasObject's
bool m_HasSelectedObjectsBelow
selected objects detected below
a2dBoundingBox GetPlotAreaBbox() const
return plotting rectangle in world coordinates
double GetHitMarginWorld()
Get HitMargin in World units.
void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
double GetMaxY() const
get maximum Y of the boundingbox
double GetWidth() const
returns width of the boundingbox
An object of this class will update a a2dIterC with the required information.
void Require(const XMLeventType &type, wxString name)
Forces a special tag.
void SetColor(const wxColour &color)
set color of axis text
a2dCanvasXYDisplayGroupAreas(double x=0, double y=0)
construct a new a2dCanvasXYDisplayGroup at given position
bool IsCurvesHighlighted() const
if a curve in this area is set, true returned
void SetPosXY(double x, double y, bool restrict=false)
set position to x,y
bool Scale(double scale)
Scale by scale (isotropic scaling i.e. the same in x and y):
bool m_HasToolObjectsBelow
special tool object detected below
bool Translate(double x, double y)
Translate by dx, dy:
bool GetHasSelectedObjectsBelow() const
selected object itself or one of its recursive children
void DependencyPending(a2dWalkerIOHandler *handler)
called by to check if this object becomes pending as a result of other objects
const a2dStroke * a2dTRANSPARENT_STROKE
global a2dStroke stock object for TRANSPARENT stroking
bool m_editingCopy
true if the object needs to be rendered in edit mode.
virtual void DoAddPending(a2dIterC &ic)
called by addPending
if set, clone members (e.g. line end styles), otherwise ref-copy them
virtual wxString StringValueRepresentation() const
a2dCurvesArea * AddCurvesArea(const wxString &curveAreaName)
add a2dCurveArea with this name, if not already available
void SetBoundaries(const a2dBoundingBox &extbox)
size of object in world coordinates, as displayed in the drawing.
a2dCurveAxis * GetAreaAxisY(const wxString &curveAreaName) const
get Y axis object for given curve area
const a2dBoundingBox & GetInternalBoundaries() const
get the plotting rectangle in curve coordinates
a2dCanvasObject * IsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
If the position (x,y) is within the object return this.
void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
bool Invert(void)
Invert matrix.
void SetInternalXBoundaries(double ximin, double ximax)
set the minimum and maximum values for axis X for all axisareas to be displayed
bool GetHasToolObjectsBelow() const
tool object itself or one of its recursive children
static a2dHit stock_fill
Stock object for a fill hit.
a2dCurvesArea(const wxString curvesAreaName=wxT(""))
constructor
bool DoUpdate(UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
Update derived Object specific things ( mainly boundingbox)
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
Load settings.
virtual bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dObject's and derived classes
double GetMinY() const
get minimum Y of the boundingbox
a2dAffineMatrix m_iworld
internal coordinates used for curve plotting expressed as matrix
bool m_showyaxis
if true show the Y axis object
#define const_forEachIn(listtype, list)
easy const iteration for a2dlist
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.
wxColour m_colour
color of axis text
a2dCanvasXYDisplayGroup(double x=0, double y=0)
construct a new a2dCanvasXYDisplayGroup at given position
basetype GetPropertyValue(const a2dObject *obj) const
Get the property value in obj.
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dDerivedCanvasObjectEnd
id for a2dWalkEvent issued from within a2dWalkerIOHandler
a2dCanvasGlobal * a2dCanvasGlobals
global a2dCanvasGlobal to have easy access to global settings
virtual void Save(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dObjectList *towrite)
write all needed to an XML type of file called the CVG format
bool DoUpdate(UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
Update derived Object specific things ( mainly boundingbox)
a2dDrawingPart * GetDrawingPart() const
get current a2dDrawingPart
This template class is for property ids with a known data type.
void SetTicFormat(const wxString &format)
Set how tic text is formated/displayed.
a2dBoundingBox m_bbox
boundingbox in world coordinates
double RequireAttributeValueDouble(const wxString &attrib)
Forces an attribute and returns its double value.
void Insert(size_t before, a2dCanvasObject *obj, bool ignoreReleased=true)
insert a a2dCanvasObject to the childobjects
void SetAxes(const a2dBoundingBox &extbox, double x, double y, double &zerox, double &zeroy, double &ixmin, double &ixmax)
sets m_axisY values
void Append(a2dCanvasObject *obj)
append a a2dCanvasObject to the childobjects
void SetMinX(double minx)
set the bounding box its minimum X, does not validate the box
const a2dAffineMatrix & GetTransform() const
Get the accumulated transform up to and including m_lworld of the current object. ...
a2dSmrtPtr< a2dCursor > m_cursor
cursor object
void SetInternalBoundaries(const a2dBoundingBox &extbox, const a2dBoundingBox &intbox)
set the internal curve boundaries, and update conversion to world matrix
double m_rely
(world coordinates) hit point y relative to the canvas object its parent object(s) ...
A pointer class, that automatically calls SmrtPtrOwn/SmrtPtrRelease.
virtual bool Update(UpdateMode mode)
Update the state of the object according to its current position etc.
double m_y
(world coordinates) hit point y as in a2dDrawingPart or any other top level
void SetBoundaries(const a2dBoundingBox &extbox)
set the minimum and maximum values
CloneOptions
options for cloning
a2dSmrtPtr< a2dCurveAxis > m_axisX
x axis object
bool DoStartEdit(wxUint16 editmode, wxEditStyle editstyle)
only used for editable objects and under control of a editing tool.
void RemoveMarker(a2dMarker *marker)
remove a marker
void SetCorridorPath(bool OnOff, a2dCanvasObject *captureObject=NULL)
to set corridor path ( also to captured object), its a2dCanvasOFlags::IsOnCorridorPath flag is set on...
a2dBoundingBox & GetBbox()
get boundingbox in world coordinates exclusive stroke width relative to its parent ...
structure to give as parameter to member functions of a2dCanvasObject
a2dBoundingBox GetCurvesBoundariesFromArea(const wxString &curveAreaName)
get the boundingbox in internal curve coordinates of all the curves in a given area ...
int AppendCurvesBoundaries(a2dBboxHash *irectHash)
fills a2dBboxHash with rectangles representing the plotting area of a curve
virtual void DoWalker(wxObject *parent, a2dWalkerIOHandler &handler)
iterate over this object and its children
const a2dFill * a2dTRANSPARENT_FILL
global a2dFill stock object for TRANSPARENT filling
base class for curve area in a a2dCurvesAreaList, like used in a2dCanvasXYDisplayGroups ...
general canvas module declarations and classes
void WriteStartElement(const wxString &name, bool newLine=true)
Writes start tag which has no attributes.
void SetShowLeftYaxis(const wxString &curveAreaName, bool showyaxis)
show yaxis