31 #if defined(__WXMSW__) && defined(__MEMDEBUG__)
32 #include <wx/msw/msvcrt.h>
44 static inline
double sqr(
double x ) {
return x * x; }
46 static double PointDistSqr(
double x1,
double y1,
double x2,
double y2 )
50 return sqr( dx ) + sqr( dy );
57 #define a2dCrossAtVertexSize 2
59 bool a2dPolygonL::m_allowCrossAtVertex =
false;
73 m_crossAtVertex( false ),
85 m_crossAtVertex( false ),
91 a2dPolygonL::~a2dPolygonL()
104 *m_lsegments = *other.m_lsegments;
105 m_spline = other.m_spline;
107 m_crossAtVertex = other.m_crossAtVertex;
120 if ( !returnIsPolygon )
121 contourpoints->push_back( contourpoints->front()->Clone() );
122 return contourpoints;
127 if ( !returnIsPolygon )
128 contourpoints->push_back( contourpoints->front()->Clone() );
129 return contourpoints;
140 canpath->
SetFill( this->GetFill() );
144 canpathlist->push_back( canpath );
153 snappathlist->push_back( snappath );
168 ( snapToWhat & a2dRestrictionEngine::snapToPinsUnconnected && !pin->
IsConnectedTo() )
172 segments->
Add( seg );
179 if ( snapToWhat & a2dRestrictionEngine::snapToObjectPos )
182 segments->
Add( seg );
190 snappathlist->push_back( snappathvertex );
200 double xp = m_lsegments->back()->m_x;
201 double yp = m_lsegments->back()->m_y;
205 for( a2dVertexList::iterator iter = m_lsegments->begin(); iter != m_lsegments->end(); ++iter )
209 x = seg->
m_x; y = seg->
m_y;
221 arc->
Set( xp, yp, xm, ym, x, y );
222 linesAnArcs->push_back( arc );
228 linesAnArcs->push_back( line );
232 obj->
SetFill( this->GetFill() );
250 double StrokeExtend = 0;
259 StrokeExtend = layerpen.
GetWidth() / 2;
261 StrokeExtend = layerpen.
GetWidth() / 2;
271 StrokeExtend = stroke.
GetWidth() / 2;
282 a2dVertexList::iterator iter = m_lsegments->begin();
284 if ( iter != m_lsegments->end() )
287 while ( iter != m_lsegments->end() )
295 if ( snapToWhat & a2dRestrictionEngine::snapToObjectIntersection )
303 double dist = line.
PointDistance( pointToSnapTo, &pBestPoint );
305 if( dist < thresHoldWorld + pw )
306 res |=
SetPointIfCloser( pointToSnapTo, pBestPoint, bestPointSofar, thresHoldWorld + pw );
315 res |=
SetPointIfCloser( pointToSnapTo, p2, bestPointSofar, thresHoldWorld );
317 lastx = x; lasty = y;
329 if ( seg.Get() == NULL )
331 if ( !m_lsegments->empty() )
332 return m_lsegments->
IndexOf( m_lsegments->back() );
337 return m_lsegments->
IndexOf( seg );
341 a2dVertexList::iterator a2dPolygonL::GetSegmentAtIndex(
unsigned int index )
343 return m_lsegments->item( index );
346 a2dVertexList* a2dPolygonL::GetSegmentListAtIndex(
unsigned int index )
348 if ( index < m_lsegments->size() + 1 )
358 if ( afterinversion )
367 if ( seg.Get() == NULL )
368 m_lsegments->push_back( point );
371 a2dVertexList::iterator iter = m_lsegments->begin();
372 while ( iter != m_lsegments->end() )
374 if ( ( *iter ) == seg )
376 m_lsegments->insert( iter, point );
389 return AddPoint( P.m_x, P.m_y, index, afterinversion );
394 if ( afterinversion )
404 m_lsegments->push_back( point );
407 a2dVertexList::iterator iter = m_lsegments->begin();
409 while ( i < index ) { ++iter; i++; }
410 m_lsegments->insert( iter, point );
419 a2dVertexList::iterator iterp = m_lsegments->end();
420 a2dVertexList::iterator iterpp = m_lsegments->end();
421 a2dVertexList::iterator iter = m_lsegments->begin();
426 iter = m_lsegments->begin();
428 if( iter != m_lsegments->end() )
433 while ( iter != m_lsegments->end() )
437 if( line1->GetPoint() == line2->GetPoint() && !line1->GetArc() )
441 m_lsegments->erase( iterp );
452 iter = m_lsegments->begin();
454 if( iter != m_lsegments->end() )
459 if( iter != m_lsegments->end() )
465 while ( iter != m_lsegments->end() )
471 if ( !point0->GetArc() && !point1->GetArc() &&
472 ( ( point1->GetPoint().m_x == point0->GetPoint().m_x && point1->GetPoint().m_x == point2->GetPoint().m_x ) ||
473 ( point1->GetPoint().m_y == point0->GetPoint().m_y && point1->GetPoint().m_y == point2->GetPoint().m_y )
479 m_lsegments->erase( iterp );
533 if ( seg.Get() == NULL )
536 point = m_lsegments->back();
539 m_lsegments->pop_back();
543 a2dVertexList::iterator iter = m_lsegments->begin();
545 while ( iter != m_lsegments->end() )
552 m_lsegments->erase( iter );
572 point = m_lsegments->back();
575 m_lsegments->pop_back();
580 a2dVertexList::iterator iter = m_lsegments->begin();
582 while ( iter != m_lsegments->end() )
589 m_lsegments->erase( iter );
610 point = m_lsegments->front();
614 else if ( index == -1 || index == m_lsegments->size() - 1 )
617 point = m_lsegments->back();
624 a2dVertexList::iterator iter = m_lsegments->begin();
626 while ( iter != m_lsegments->end() )
648 if ( seg.Get() == NULL )
651 point = m_lsegments->back();
672 wxASSERT_MSG( seg->GetArc() , _T(
"this is not an arc segment." ) );
680 a2dVertexList::iterator iter = m_lsegments->begin();
682 while ( iter != m_lsegments->end() )
687 wxASSERT_MSG( seg->GetArc() , _T(
"this is not an arc segment." ) );
706 if ( seg.Get() == NULL )
709 wxASSERT_MSG( seg->GetArc() , _T(
"this is not an arc segment." ) );
716 wxASSERT_MSG( seg->GetArc() , _T(
"this is not an arc segment." ) );
730 if ( afterinversion )
743 if ( afterinversion )
756 if ( afterinversion )
763 a2dVertexList::iterator iterp = m_lsegments->end()--;
764 a2dVertexList::iterator iter = m_lsegments->begin();
767 while ( iter != m_lsegments->end() )
772 wxASSERT_MSG( seg->GetArc() , _T(
"this is not an arc segment." ) );
774 cseg->SetMidPoint( *( *iterp ), x, y );
786 if ( afterinversion )
793 a2dVertexList::iterator iterp = m_lsegments->end()--;
794 a2dVertexList::iterator iter = m_lsegments->begin();
796 while ( iter != m_lsegments->end() )
801 wxASSERT_MSG( segp->GetArc() , _T(
"this is not an arc segment." ) );
803 cseg->SetMidPoint( *( *iterp ), x, y );
817 a2dVertexList::iterator iter = m_lsegments->begin();
819 while ( iter != m_lsegments->end() )
832 m_lsegments = points;
844 handle->SetNodeOrg( original->
GetSegments()->item( index ) );
851 m_crossAtVertex =
true;
862 m_crossAtVertex =
false;
883 a2dVertexList::iterator iter = m_lsegments->begin();
884 a2dVertexList::iterator iterorg = original->m_lsegments->begin();
900 handle =
new a2dPolyHandleL(
this, iter, iterorg, m_lsegments, original->m_lsegments, cseg->
m_x2, cseg->
m_y2, wxT(
"__indexarc__" ) );
962 switch( event.
GetHow().m_stroke2 )
964 case a2dHit::stroke2_edgehor:
965 case a2dHit::stroke2_edgevert:
966 case a2dHit::stroke2_edgeother:
969 case a2dHit::stroke2_vertex:
978 switch( event.
GetHow().m_stroke2 )
980 case a2dHit::stroke2_edgehor:
983 case a2dHit::stroke2_edgevert:
986 case a2dHit::stroke2_edgeother:
989 case a2dHit::stroke2_vertex:
1006 if ( restrictEngine )
1014 a2dVertexList::iterator iterSeg = GetSegmentAtIndex( event.
GetHow().
m_index );
1015 a2dVertexList::iterator iterSegOrg = original->GetSegmentAtIndex( event.
GetHow().
m_index );
1018 seghandle =
new a2dPolyHandleL(
this, iterSeg, iterSegOrg, m_lsegments, original->m_lsegments, wxT(
"__segment__" ) );
1020 seghandle =
new a2dPolyHandleL(
this, iterSeg, iterSegOrg, m_lsegments, original->m_lsegments, wxT(
"__insert__" ) );
1026 a2dIterCU handlecontext( *ic, seghandle );
1027 seghandle->ProcessEvent( event );
1039 void a2dPolygonL::OnChar( wxKeyEvent& event )
1043 switch( event.GetKeyCode() )
1051 if ( ( *editmode ) > 1 ) ( *editmode ) = 0;
1058 if ( m_lsegments->size() <= 2 )
1060 wxLogWarning( _(
"stopped removing segment or vertexes, object should keep at least one segment" ) );
1067 if ( m_lsegments->size() <= 2 )
1069 wxLogWarning( _(
"stopped removing segment or vertexes, object should keep at least one segment" ) );
1078 a2dVertexList::iterator iterpoly = handle->GetNode();
1080 if ( segment->GetBin() )
1094 a2dVertexList::iterator iterpolyNext = m_lsegments->
GetNextAround( iterpoly );
1095 iterpoly = m_lsegments->erase( iterpoly );
1096 (*iterpolyNext)->m_x = xn; (*iterpolyNext)->m_y = yn;
1111 a2dVertexList::iterator iterpoly = handle->GetNode();
1113 a2dVertexList::iterator iterorg = handle->GetNodeOrg();
1116 if ( m_lsegments->size() <= 2 )
1118 wxLogWarning( _(
"stopped removing segment or vertexes, object should keep at least one segment" ) );
1124 m_lsegments->erase( iterpoly );
1140 void a2dPolygonL::SyncHandlesWithLineSegments()
1191 if ( editmode == 1 )
1206 double xinternal, yinternal;
1213 a2dVertexList::iterator iter = draghandle->GetNode();
1216 a2dVertexList::iterator iterorg = draghandle->GetNodeOrg();
1225 if ( draghandle->
GetName() == wxT(
"__index__" ) )
1229 if ( restrictEngine )
1248 ic->SetCorridorPathToParent();
1261 x = segment->
m_x; y = segment->
m_y;
1272 original->SetAlgoSkip(
true );
1273 SetAlgoSkip(
true );
1285 original->SetAlgoSkip(
false );
1286 SetAlgoSkip(
false );
1312 else if ( draghandle->
GetName() == wxT(
"__indexarc__" ) )
1316 if ( restrictEngine )
1323 x = csegment->
m_x2; y = csegment->
m_y2;
1333 csegment->
m_x2 = xwi; csegment->
m_y2 = ywi;
1338 SyncHandlesWithLineSegments();
1344 else if ( draghandle->
GetName() == wxT(
"__insert__" ) )
1359 draghandle->
SetName( wxT(
"__index__" ) );
1362 draghandle->SetNode( iter );
1363 draghandle->SetNodeOrg( iterorg );
1366 segment->
m_bin =
false;
1384 AddPoint( xwi, ywi, segmentNext,
false );
1396 else if ( draghandle->
GetName() == wxT(
"__segment__" ) )
1407 segment->
m_bin =
false;
1412 double xi_h = a2dPolyHandleL::PROPID_tmpXIH->
GetPropertyValue( draghandle );
1413 double yi_h = a2dPolyHandleL::PROPID_tmpYIH->
GetPropertyValue( draghandle );
1414 double xi_v1 = a2dPolyHandleL::PROPID_tmpXIV1->
GetPropertyValue( draghandle );
1415 double yi_v1 = a2dPolyHandleL::PROPID_tmpYIV1->
GetPropertyValue( draghandle );
1416 double xi_v2 = a2dPolyHandleL::PROPID_tmpXIV2->
GetPropertyValue( draghandle );
1417 double yi_v2 = a2dPolyHandleL::PROPID_tmpYIV2->
GetPropertyValue( draghandle );
1418 xwi = segment->
m_x + xi_v1 - xi_h;
1419 ywi = segment->
m_y + yi_v1 - yi_h;
1423 double x1 = segment->
m_x;
1424 double y1 = segment->
m_y;
1425 double x2 = segmentNext->
m_x;
1426 double y2 = segmentNext->
m_y;
1437 SyncHandlesWithLineSegments();
1455 x = segmentNext->
m_x;
1456 y = segmentNext->
m_y;
1464 double xi_h = a2dPolyHandleL::PROPID_tmpXIH->
GetPropertyValue( draghandle );
1465 double yi_h = a2dPolyHandleL::PROPID_tmpYIH->
GetPropertyValue( draghandle );
1466 double xi_v1 = a2dPolyHandleL::PROPID_tmpXIV1->
GetPropertyValue( draghandle );
1467 double yi_v1 = a2dPolyHandleL::PROPID_tmpYIV1->
GetPropertyValue( draghandle );
1468 double xi_v2 = a2dPolyHandleL::PROPID_tmpXIV2->
GetPropertyValue( draghandle );
1469 double yi_v2 = a2dPolyHandleL::PROPID_tmpYIV2->
GetPropertyValue( draghandle );
1476 double x, y, dx, dy;
1483 if ( restrictEngine )
1489 double x1 = xi_v1 - xi_h + xwi;
1490 double y1 = yi_v1 - yi_h + ywi;
1491 double x2 = xi_v2 - xi_h + xwi;
1492 double y2 = yi_v2 - yi_h + ywi;
1496 segmentNext->
m_x = x2;
1497 segmentNext->
m_y = y2;
1530 *lpoints = *m_lsegments;
1536 bbox = m_lsegments->
GetBbox();
1552 *lpoints = *m_lsegments;
1581 delete contourpoints;
1586 if ( m_crossAtVertex )
1597 a2dVertexList::iterator iter = m_lsegments->begin();
1599 while ( iter != m_lsegments->end() )
1637 a2dVertexList::iterator iter = m_lsegments->begin();
1639 while ( iter != m_lsegments->end() )
1642 if ( seg->GetBin() )
1661 #if wxART2D_USE_CVGIO
1665 if ( xmlparts == a2dXmlSer_attrib )
1669 out.WriteAttribute( wxT(
"spline" ), m_spline );
1672 out.WriteAttribute( wxT(
"points" ), m_lsegments->size() );
1684 out.WriteAttribute( wxT(
"x" ), seg->
m_x * out.
GetScale() );
1685 out.WriteAttribute( wxT(
"y" ), seg->
m_y * out.
GetScale() );
1687 if ( seg->GetArc() )
1690 out.WriteAttribute( wxT(
"xm" ), arc->
m_x2 * out.
GetScale() );
1691 out.WriteAttribute( wxT(
"ym" ), arc->
m_y2 * out.
GetScale() );
1703 if ( xmlparts == a2dXmlSer_attrib )
1726 m_lsegments->push_back( seg );
1734 #endif //wxART2D_USE_CVGIO
1745 hitEvent.
m_how = PointInPolygon( P, pw + margin );
1757 *lpoints = *m_lsegments;
1762 rlist = m_lsegments;
1785 m_xscale = m_yscale = 1;
1786 m_pathtype = a2dPATH_END_SQAURE;
1787 m_flags.m_generatePins = m_generatePins;
1788 m_flags.m_filled =
false;
1794 m_xscale = m_yscale = 1;
1795 m_pathtype = a2dPATH_END_SQAURE;
1807 if ( other.m_begin )
1808 m_begin = other.m_begin->TClone( options );
1810 m_end = other.m_end->TClone( options );
1817 m_xscale = other.m_xscale;
1818 m_yscale = other.m_yscale;
1822 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
1824 CurrentSmartPointerOwner =
this;
1828 a2dPolylineL::~a2dPolylineL()
1858 if ( !returnIsPolygon )
1859 contourpoints->push_back( contourpoints->front()->Clone() );
1860 return contourpoints;
1864 returnIsPolygon =
false;
1893 a2dVertexList::iterator iter = contourpoints.begin();
1894 while( iter != contourpoints.end() )
1903 offsetpointleft = first;
1904 offsetpointright = first;
1905 a2dLine line1( first, second );
1911 segments->
Add( segv );
1913 a2dLine lineoffset( offsetpointright, offsetpointleft );
1916 offsetpointfirst = first;
1919 offsetpointfirst.m_x, offsetpointfirst.m_y,
1922 offsetpointright = second;
1924 offsetpointleft = second;
1928 segments->
Add( segv );
1930 a2dLine lineoffset2( offsetpointleft, offsetpointright );
1933 offsetpointend = second;
1936 offsetpointend.m_x, offsetpointend.m_y,
1940 segments->
Add( segv );
1948 segments =
new a2dVpath( *m_lsegments,
true );
1955 segments =
new a2dVpath( contourpoints,
true,
false );
1962 canpath->
SetStroke( this->GetStroke() );
1963 canpath->
SetFill( this->GetFill() );
1966 canpathlist->push_back( canpath );
1974 double xp = m_lsegments->front()->m_x;
1975 double yp = m_lsegments->front()->m_y;
1979 a2dVertexList::iterator iter = m_lsegments->begin();
1981 while( iter != m_lsegments->end() )
1983 double x, y, xm, ym;
1985 x = seg->
m_x; y = seg->
m_y;
1988 if ( seg->GetArc() )
1997 arc->
Set( xp, yp, xm, ym, x, y );
1998 linesAnArcs->push_back( arc );
2004 linesAnArcs->push_back( line );
2008 obj->
SetFill( this->GetFill() );
2024 a2dVertexList::iterator iterp = m_lsegments->end();
2025 a2dVertexList::iterator iterpp = m_lsegments->end();
2026 a2dVertexList::iterator iter = m_lsegments->begin();
2031 iter = m_lsegments->begin();
2033 if( iter != m_lsegments->end() )
2038 while ( iter != m_lsegments->end() )
2042 if( line1->GetPoint() == line2->GetPoint() && !line1->GetArc() )
2044 if( sendCommandsTo )
2046 m_lsegments->erase( iterp );
2057 iter = m_lsegments->begin();
2059 if( iter != m_lsegments->end() )
2064 if( iter != m_lsegments->end() )
2070 while ( iter != m_lsegments->end() )
2076 if ( !point0->GetArc() && !point1->GetArc() &&
2077 ( ( point1->GetPoint().m_x == point0->GetPoint().m_x && point1->GetPoint().m_x == point2->GetPoint().m_x ) ||
2078 ( point1->GetPoint().m_y == point0->GetPoint().m_y && point1->GetPoint().m_y == point2->GetPoint().m_y )
2082 if( sendCommandsTo )
2084 m_lsegments->erase( iterp );
2138 a2dVertexList::iterator iterp = m_lsegments->end();
2139 a2dVertexList::iterator iterpp = m_lsegments->end();
2140 a2dVertexList::iterator iter = m_lsegments->begin();
2143 if ( removeZeroFirst )
2146 iter = m_lsegments->begin();
2148 if( iter != m_lsegments->end() )
2153 while ( iter != m_lsegments->end() )
2157 if( line1->GetPoint() == line2->GetPoint() && !line1->GetArc() )
2159 if( sendCommandsTo )
2161 m_lsegments->erase( iterp );
2173 iter = m_lsegments->begin();
2175 if( iter != m_lsegments->end() )
2180 if( iter != m_lsegments->end() )
2186 while ( iter != m_lsegments->end() )
2192 double dx10 = point1->
m_x - point0->
m_x;
2193 double dy10 = point1->
m_y - point0->
m_y;
2194 double dx21 = point2->
m_x - point1->
m_x;
2195 double dy21 = point2->
m_y - point1->
m_y;
2197 double angle = atan2( dy10, dx10 ) - atan2( dy21, dx21 );
2199 if( point1->
Length( *point0 ) > 0 && point2->
Length( *point1 ) > 0 &&
2200 !point0->GetArc() && !point1->GetArc() && ( angle ==
wxPI || angle == -
wxPI ) )
2202 if( sendCommandsTo )
2204 m_lsegments->erase( iterp );
2222 *lpoints = *m_lsegments;
2228 bbox = m_lsegments->
GetBbox();
2235 a2dVertexList::iterator iter = m_lsegments->begin();
2238 if ( iter != m_lsegments->end() )
2240 point1 = ( *iter )->GetPoint();
2242 if ( iter != m_lsegments->end() )
2243 point2 = ( *iter )->GetPoint();
2249 dx = point2.m_x - point1.m_x;
2250 dy = point2.m_y - point1.m_y;
2259 lworld.
Scale( m_xscale, m_yscale, 0, 0 );
2261 lworld.
Translate( point1.m_x, point1.m_y );
2271 a2dVertexList::reverse_iterator iter = m_lsegments->rbegin();
2274 if ( iter != m_lsegments->rend() )
2276 point1 = ( *iter )->GetPoint();
2277 while ( !dx && !dy && iter != m_lsegments->rend() )
2279 point1 = ( *iter )->GetPoint();
2281 if ( iter != m_lsegments->rend() )
2282 point2 = ( *iter )->GetPoint();
2285 dx = point2.m_x - point1.m_x;
2286 dy = point2.m_y - point1.m_y;
2298 tworld.
Scale( m_xscale, m_yscale, 0, 0 );
2300 tworld.
Translate( point1.m_x, point1.m_y );
2314 calc = m_begin->
Update( mode );
2318 calc = m_end->
Update( mode );
2328 *lpoints = *m_lsegments;
2368 a2dVertexList::iterator iter = contourpoints.begin();
2369 while( iter != contourpoints.end() )
2380 if ( first != second )
2383 a2dLine line1( first, second );
2385 offsetpoint = first;
2388 offsetpoint = first;
2391 offsetpoint = second;
2394 offsetpoint = second;
2409 delete contourpoints;
2415 if ( m_crossAtVertex )
2426 a2dVertexList::iterator iter = m_lsegments->begin();
2428 while ( iter != m_lsegments->end() )
2470 a2dVertexList::iterator iter = m_lsegments->begin();
2472 for (
int i = 0; i < m_lsegments->size()-1; i++ )
2475 if ( seg->GetBin() )
2495 a2dVertexList::iterator iter = m_lsegments->begin();
2498 if ( iter != m_lsegments->end() )
2500 point1 = ( *iter )->GetPoint();
2502 if ( iter != m_lsegments->end() )
2503 point2 = ( *iter )->GetPoint();
2509 dx = point2.m_x - point1.m_x;
2510 dy = point2.m_y - point1.m_y;
2519 lworld.
Scale( m_xscale, m_yscale, 0, 0 );
2521 lworld.
Translate( point1.m_x, point1.m_y );
2525 m_begin->
Render( ic, clipparent );
2532 a2dVertexList::reverse_iterator iter = m_lsegments->rbegin();
2535 if ( iter != m_lsegments->rend() )
2537 point1 = ( *iter )->GetPoint();
2538 while ( !dx && !dy && iter != m_lsegments->rend() )
2540 point1 = ( *iter )->GetPoint();
2542 if ( iter != m_lsegments->rend() )
2543 point2 = ( *iter )->GetPoint();
2546 dx = point2.m_x - point1.m_x;
2547 dy = point2.m_y - point1.m_y;
2559 tworld.
Scale( m_xscale, m_yscale, 0, 0 );
2561 tworld.
Translate( point1.m_x, point1.m_y );
2565 m_end->
Render( ic, clipparent );
2569 #if wxART2D_USE_CVGIO
2573 if ( xmlparts == a2dXmlSer_attrib )
2575 if ( m_begin || m_end )
2577 out.WriteAttribute( wxT(
"xscale" ), m_xscale * out.
GetScale() );
2578 out.WriteAttribute( wxT(
"yscale" ), m_yscale * out.
GetScale() );
2587 if ( ( m_begin && !m_begin->
GetCheck() ) ||
2597 if ( m_begin && !m_begin->
GetCheck() )
2598 m_begin->
Save(
this, out, towrite );
2600 m_end->
Save(
this, out, towrite );
2610 if ( xmlparts == a2dXmlSer_attrib )
2615 wxString resolveKey;
2627 if ( parser.
GetTagName() != wxT(
"derived" ) )
2640 #endif //wxART2D_USE_CVGIO
2647 m_begin->
Walker(
this, handler );
2650 m_end->
Walker(
this, handler );
2672 a2dVertexList::iterator iter = m_lsegments->begin();
2675 if ( iter != m_lsegments->end() )
2677 point1 = ( *iter )->GetPoint();
2679 if ( iter != m_lsegments->end() )
2680 point2 = ( *iter )->GetPoint();
2686 dx = point2.m_x - point1.m_x;
2687 dy = point2.m_y - point1.m_y;
2696 lworld.
Scale( m_xscale, m_yscale, 0, 0 );
2698 lworld.
Translate( point1.m_x, point1.m_y );
2700 if( m_begin->
IsHitWorld( ic, hitEvent ) != 0 )
2705 hitEvent.
m_how.m_stroke1 = a2dHit::stroke1_outside;
2706 hitEvent.
m_how.m_stroke2 = a2dHit::stroke2_vertex;
2714 a2dVertexList::reverse_iterator iter = m_lsegments->rbegin();
2719 if ( iter != m_lsegments->rend() )
2721 point1 = ( *iter )->GetPoint();
2722 while ( !dx && !dy && iter != m_lsegments->rend() )
2724 point1 = ( *iter )->GetPoint();
2726 if ( iter != m_lsegments->rend() )
2727 point2 = ( *iter )->GetPoint();
2730 dx = point2.m_x - point1.m_x;
2731 dy = point2.m_y - point1.m_y;
2742 tworld.
Scale( m_xscale, m_yscale, 0, 0 );
2744 tworld.
Translate( point1.m_x, point1.m_y );
2746 if ( m_end->
IsHitWorld( ic, hitEvent ) != 0 )
2750 hitEvent.
m_how.m_stroke1 = a2dHit::stroke1_outside;
2751 hitEvent.
m_how.m_stroke2 = a2dHit::stroke2_vertex;
2767 a2dVertexList::iterator iter = m_lsegments->begin();
2768 while ( iter != m_lsegments->end() )
2771 lpoints->push_back( point );
2775 lpoints->ConvertIntoSplinedPolyline( 10 );
2779 rlist = m_lsegments;
2798 if ( a2dCanvasObject::PROPID_Editcopy->GetPropertyValue(
this ) )
2820 if (
GetGeneratePins() && ( toCreate = toConnectTo->GetPinClassForTask( task,
this ) ) )
2827 a2dVertexList::iterator iter = m_lsegments->begin();
2828 assert( m_lsegments->size() );
2836 a2dVertexList::iterator iter = m_lsegments->end();
2837 assert( m_lsegments->size() );
2844 if ( m_lsegments->size() > 0 )
2847 double xNear, yNear;
2852 double xNearLocal, yNearLocal;
2858 pin->SetMouseInObject(
true );
2888 double minDist = DBL_MAX;
2898 rlist = m_lsegments;
2901 a2dVertexList::iterator iter = rlist->begin();
2902 p2 = ( *iter )->GetPoint();
2903 while( iter != rlist->end() )
2907 if ( iter == rlist->end() )
break;
2908 p2 = ( *iter )->GetPoint();
2913 if( dist < minDist )
2935 bool result =
false;
2950 double minDist = DBL_MAX;
2960 rlist = m_lsegments;
2963 a2dVertexList::iterator iter = rlist->begin();
2964 p2 = ( *iter )->GetPoint();
2965 while( iter != rlist->end() )
2969 if ( iter == rlist->end() )
break;
2970 p2 = ( *iter )->GetPoint();
2975 if( dist < minDist )
3004 double xNew, yNew, xNewO, yNewO;
3005 bool orthook =
FindNearPointOrtho( 0, pointLocal.m_x, pointLocal.m_y, &xNewO, &yNewO );
3006 bool straightok =
FindNearPoint( 0, pointLocal.m_x, pointLocal.m_y, &xNew, &yNew );
3009 orthook && PointDistSqr( pointLocal.m_x, pointLocal.m_y, xNewO, yNewO ) < PointDistSqr( pointLocal.m_x, pointLocal.m_y, xNew, yNew ) * 4 ||
3010 orthook && !straightok
3019 if( ( xNew != pos.m_x || yNew != pos.m_y ) && ( orthook || straightok ) )
3048 if( pin )
return pin;
3055 if( pin )
return pin;
3063 int a2dPolylineL::FindSegmentIndex(
const a2dPoint2D& point,
double margin )
3091 a2dVertexList::iterator iter = GetSegmentAtIndex( hit.
m_index );
3099 a2dVertexList::const_iterator iter = m_lsegments->begin();
3100 if ( iter != m_lsegments->end() )
3107 if ( m_lsegments->size() )
3109 a2dVertexList::const_iterator iter = m_lsegments->end();
3116 void a2dPolylineL::OnChar( wxKeyEvent& event )
3120 switch( event.GetKeyCode() )
3124 if ( m_lsegments->size() <= 2 )
3126 wxLogWarning( _(
"stopped removing segment or vertexes, object should keep at least one segment" ) );
3134 if ( m_lsegments->size() <= 2 )
3136 wxLogWarning( _(
"stopped removing segment or vertexes, object should keep at least one segment" ) );
3145 a2dVertexList::iterator iterpoly = handle->GetNode();
3147 if ( segment->GetBin() )
3161 iterpoly = m_lsegments->erase( iterpoly );
3162 (*iterpoly)->m_x = xn; (*iterpoly)->m_y = yn;
3177 a2dVertexList::iterator iterpoly = handle->GetNode();
3179 a2dVertexList::iterator iterorg = handle->GetNodeOrg();
3182 if ( m_lsegments->size() <= 2 )
3184 wxLogWarning( _(
"stopped removing segment or vertexes, object should keep at least one segment" ) );
3190 m_lsegments->erase( iterpoly );
3257 if ( m_lsegments->size() )
3268 if ( m_lsegments->size() )
3322 a2dPolygonLClipper2::a2dPolygonLClipper2(
a2dVertexList* points,
bool spline )
3327 a2dPolygonLClipper2::~a2dPolygonLClipper2()
3343 if ( m_lsegments->size() )
3353 if ( m_lsegments->size() )
3408 :
a2dHandle( NULL, 0, 0, wxT(
"dummy" ), GetHabitat()->GetHandle()->GetWidth(), GetHabitat()->GetHandle()->GetHeight() )
3410 m_arcHandle =
false;
3413 m_lsegmentsOrg = NULL;
3419 const wxString& name )
3420 :
a2dHandle( parent, ( *segNode )->m_x, ( *segNode )->m_y, name )
3422 m_segNode = segNode;
3423 m_segNodeOrg = segNodeOrg;
3424 m_lsegments = lsegments;
3425 m_lsegmentsOrg = lsegmentsOrg;
3426 m_arcHandle =
false;
3433 double xc,
double yc,
const wxString& name )
3436 m_segNode = segNode;
3437 m_segNodeOrg = segNodeOrg;
3438 m_lsegments = lsegments;
3439 m_lsegmentsOrg = lsegmentsOrg;
3440 m_arcHandle =
false;
3447 m_segNode = other.m_segNode;
3448 m_segNodeOrg = other.m_segNodeOrg;
3449 m_arcHandle = other.m_arcHandle;
3450 m_lsegments = other.m_lsegments;
3451 m_lsegmentsOrg = other.m_lsegmentsOrg;
3472 EVT_CHAR( a2dSurface::OnChar )
3475 a2dSurface::a2dSurface()
3486 a2dSurface::~a2dSurface()
3492 m_lsegments->clear();
3499 for( a2dListOfa2dVertexList::const_iterator iterp = other.m_holes.begin(); iterp != other.m_holes.end(); iterp++ )
3503 *holepoints = *vlist;
3504 m_holes.push_back( holepoints );
3511 return new a2dSurface( *
this, options, refs );
3525 contour->
SetStroke( this->GetStroke() );
3526 contour->
SetFill( this->GetFill() );
3532 polygons->push_back( contour );
3534 for( a2dListOfa2dVertexList::const_iterator iterp = m_holes.begin(); iterp != m_holes.end(); iterp++ )
3539 hole->
SetFill( this->GetFill() );
3545 polygons->push_back( hole );
3555 conSegm->push_back( conSegm->front()->Clone() );
3557 contour->
SetStroke( this->GetStroke() );
3558 contour->
SetFill( this->GetFill() );
3564 polygons->push_back( contour );
3566 for( a2dListOfa2dVertexList::const_iterator iterp = m_holes.begin(); iterp != m_holes.end(); iterp++ )
3570 vlistcopy->push_back( vlistcopy->front()->Clone() );
3573 hole->
SetFill( this->GetFill() );
3579 polygons->push_back( hole );
3592 for( a2dListOfa2dVertexList::const_iterator iterp = m_holes.begin(); iterp != m_holes.end(); iterp++ )
3595 if ( vlist->size() > 1 )
3597 a2dVertexList::iterator iter = vlist->begin();
3600 segments->push_back( segvec );
3602 while ( iter != vlist->end() )
3606 segments->push_back( segvec );
3609 seg = *( vlist->begin() );
3611 segments->push_back( segvec );
3613 segments->push_back( segvec );
3622 canpath->
SetStroke( this->GetStroke() );
3623 canpath->
SetFill( this->GetFill() );
3627 canpathlist->push_back( canpath );
3636 double xp = m_lsegments->back()->m_x;
3637 double yp = m_lsegments->back()->m_y;
3641 for( a2dVertexList::iterator iter = m_lsegments->begin(); iter != m_lsegments->end(); ++iter )
3643 double x, y, xm, ym;
3645 x = seg->
m_x; y = seg->
m_y;
3648 if ( seg->GetArc() )
3657 arc->
Set( xp, yp, xm, ym, x, y );
3658 linesAnArcs->push_back( arc );
3664 linesAnArcs->push_back( line );
3668 obj->
SetFill( this->GetFill() );
3682 m_holes.push_back( holepoints );
3703 *lpoints = *m_lsegments;
3709 bbox = m_lsegments->
GetBbox();
3725 *lpoints = *m_lsegments;
3753 m_lsegments->push_back( last );
3754 drawable.push_back( m_lsegments );
3755 for( a2dListOfa2dVertexList::const_iterator iterp = m_holes.begin(); iterp != m_holes.end(); iterp++ )
3758 if ( vlist->size() > 1 )
3761 vlist->push_back( last );
3762 drawable.push_back( vlist );
3766 m_lsegments->pop_back();
3767 for( a2dListOfa2dVertexList::const_iterator iterp = m_holes.begin(); iterp != m_holes.end(); iterp++ )
3770 if ( vlist->size() > 1 )
3777 #if wxART2D_USE_CVGIO
3781 if ( xmlparts == a2dXmlSer_attrib )
3783 out.WriteAttribute( wxT(
"holes" ), m_holes.size() );
3788 for( a2dListOfa2dVertexList::iterator iterp = m_holes.begin(); iterp != m_holes.end(); iterp++ )
3797 out.WriteAttribute( wxT(
"x" ), seg->
m_x * out.
GetScale() );
3798 out.WriteAttribute( wxT(
"y" ), seg->
m_y * out.
GetScale() );
3800 if ( seg->GetArc() )
3803 out.WriteAttribute( wxT(
"xm" ), arc->
m_x2 * out.
GetScale() );
3804 out.WriteAttribute( wxT(
"ym" ), arc->
m_y2 * out.
GetScale() );
3819 if ( xmlparts == a2dXmlSer_attrib )
3825 while( parser.
GetTagName() == wxT(
"hole" ) )
3845 holepoints->push_back( seg );
3854 AddHole( holepoints );
3858 #endif //wxART2D_USE_CVGIO
3869 unsigned int indexn = m_lsegments->size() + 1;
3870 for( a2dListOfa2dVertexList::const_iterator iterp = m_holes.begin(); iterp != m_holes.end(); iterp++ )
3879 indexn += vlist->size();
3883 hitEvent.
m_how = PointInPolygon( P, pw + margin );
3892 if ( editmode == 1 )
3894 if( ! ( editstyle & wxEDITSTYLE_NOHANDLES ) )
3902 a2dListOfa2dVertexList::const_iterator iterporg = original->m_holes.begin();
3903 for( a2dListOfa2dVertexList::const_iterator iterp = m_holes.begin(); iterp != m_holes.end(); iterp++ )
3907 a2dVertexList::iterator iter = vlist->begin();
3908 a2dVertexList::iterator iterorg = vlistorg->begin();
3911 while ( iter != vlist->end() )
3915 if ( iter != vlist->end() )
3916 nextseg = ( *iter );
3918 nextseg = vlist->front();
3926 if ( seg->GetArc() )
3931 handle =
new a2dPolyHandleL(
this, iter, iterorg, vlist, vlistorg, cseg->
m_x2, cseg->
m_y2, wxT(
"__indexhole_arc__" ) );
3987 if ( restrictEngine )
3992 int index =
event.GetHow().m_index;
3993 a2dVertexList::iterator iterSeg = GetSegmentAtIndex( index );
3994 a2dVertexList::iterator iterSegOrg = original->GetSegmentAtIndex( index );
3996 if ( vlist == m_lsegments )
4001 a2dVertexList* vlistorg = original->GetSegmentListAtIndex( index );
4004 seghandle =
new a2dPolyHandleL(
this, iterSeg, iterSegOrg, vlist, vlistorg, wxT(
"__inserthole__" ) );
4006 seghandle =
new a2dPolyHandleL(
this, iterSeg, iterSegOrg, vlist, vlistorg, wxT(
"__segmenthole__" ) );
4013 a2dIterCU handlecontext( *ic, seghandle );
4014 seghandle->ProcessEvent( event );
4033 if ( draghandle->
GetName() != wxT(
"__indexhole__" ) &&
4034 draghandle->
GetName() != wxT(
"__indexhole_arc__" ) &&
4035 draghandle->
GetName() != wxT(
"__inserthole__" ) &&
4036 draghandle->
GetName() != wxT(
"__segmenthole__" )
4046 if ( editmode == 1 )
4061 double xinternal, yinternal;
4070 a2dLineSegment* nextsegment = *( holevlist->GetNextAround( draghandle->GetNode() ) );
4080 if ( restrictEngine )
4086 if ( draghandle->
GetName() == wxT(
"__indexhole__" ) )
4088 if ( event.
GetMouseEvent().ControlDown() &&
event.GetMouseEvent().LeftDown() )
4098 ic->SetCorridorPathToParent();
4104 x = segment->
m_x; y = segment->
m_y;
4123 else if ( draghandle->
GetName() == wxT(
"__indexhole_arc__" ) )
4130 x = csegment->
m_x2; y = csegment->
m_y2;
4140 csegment->
m_x2 = xwi; csegment->
m_y2 = ywi;
4145 SyncHandlesWithLineSegments();
4151 else if ( draghandle->
GetName() == wxT(
"__inserthole__" ) )
4158 x = nextsegment->
m_x;
4159 y = nextsegment->
m_y;
4168 AddPoint( xwi, ywi, nextsegment,
false );
4181 else if ( draghandle->
GetName() == wxT(
"__segmenthole__" ) )
4190 x2 = nextsegment->
m_x;
4191 y2 = nextsegment->
m_y;
4193 double xwi, ywi, dx, dy;
4194 dx = 0.5 * ( x2 - x1 );
4195 dy = 0.5 * ( y2 - y1 );
4199 x1 = xwi - dx; x2 = xwi + dx;
4200 y1 = ywi - dy; y2 = ywi + dy;
4213 SyncHandlesWithLineSegments();
4231 x = nextsegment->
m_x;
4232 y = nextsegment->
m_y;
4240 double xi_h = a2dPolyHandleL::PROPID_tmpXIH->
GetPropertyValue( draghandle );
4241 double yi_h = a2dPolyHandleL::PROPID_tmpYIH->
GetPropertyValue( draghandle );
4242 double xi_v1 = a2dPolyHandleL::PROPID_tmpXIV1->
GetPropertyValue( draghandle );
4243 double yi_v1 = a2dPolyHandleL::PROPID_tmpYIV1->
GetPropertyValue( draghandle );
4244 double xi_v2 = a2dPolyHandleL::PROPID_tmpXIV2->
GetPropertyValue( draghandle );
4245 double yi_v2 = a2dPolyHandleL::PROPID_tmpYIV2->
GetPropertyValue( draghandle );
4252 double x, y, dx, dy;
4259 if ( restrictEngine )
4265 double x1 = xi_v1 - xi_h + xwi;
4266 double y1 = yi_v1 - yi_h + ywi;
4267 double x2 = xi_v2 - xi_h + xwi;
4268 double y2 = yi_v2 - yi_h + ywi;
4272 nextsegment->
m_x = x2;
4273 nextsegment->
m_y = y2;
4295 handle->SetNode( GetSegmentAtIndex( index ) );
4297 handle->SetNodeOrg( original->GetSegmentAtIndex( index ) );
4303 if ( seg.Get() == NULL )
4305 if ( !m_lsegments->empty() )
4306 return m_lsegments->
IndexOf( m_lsegments->back() );
4310 index = m_lsegments->
IndexOf( seg );
4314 index = m_lsegments->size();
4316 for( a2dListOfa2dVertexList::const_iterator iterp = m_holes.begin(); iterp != m_holes.end(); iterp++ )
4319 a2dVertexList::iterator iter = vlist->begin();
4320 while ( iter != vlist->end() )
4334 a2dVertexList::iterator a2dSurface::GetSegmentAtIndex(
unsigned int index )
4336 if ( index < m_lsegments->size() + 1 )
4338 return m_lsegments->item( index );
4340 unsigned int indexn = m_lsegments->size();
4342 for( a2dListOfa2dVertexList::const_iterator iterp = m_holes.begin(); iterp != m_holes.end(); iterp++ )
4345 a2dVertexList::iterator iter = vlist->begin();
4346 while ( iter != vlist->end() )
4348 if ( indexn == index )
4355 if( indexn == index )
4361 return m_lsegments->end();
4364 a2dVertexList* a2dSurface::GetSegmentListAtIndex(
unsigned int index )
4366 if ( index < m_lsegments->size() + 1 )
4370 unsigned int indexn = m_lsegments->size();
4372 for( a2dListOfa2dVertexList::const_iterator iterp = m_holes.begin(); iterp != m_holes.end(); iterp++ )
4375 a2dVertexList::iterator iter = vlist->begin();
4376 while ( iter != vlist->end() )
4378 if ( indexn == index )
4385 if( indexn == index )
4397 if ( seg.Get() == NULL )
4400 point = m_lsegments->back();
4403 m_lsegments->pop_back();
4407 a2dVertexList::iterator iter = m_lsegments->begin();
4409 while ( iter != m_lsegments->end() )
4416 m_lsegments->erase( iter );
4424 for( a2dListOfa2dVertexList::const_iterator iterp = m_holes.begin(); iterp != m_holes.end(); iterp++ )
4427 a2dVertexList::iterator iter = vlist->begin();
4428 while ( iter != vlist->end() )
4435 vlist->erase( iter );
4452 if ( index < m_lsegments->size() + 1 )
4454 m_lsegments->
Insert( index, segin );
4457 unsigned int indexn = m_lsegments->size();
4459 for( a2dListOfa2dVertexList::const_iterator iterp = m_holes.begin(); iterp != m_holes.end(); iterp++ )
4462 a2dVertexList::iterator iter = vlist->begin();
4463 while ( iter != vlist->end() )
4465 if ( indexn == index )
4467 vlist->insert( iter, segin );
4473 if( indexn == index )
4475 vlist->insert( iter, segin );
4485 if ( seg.Get() == NULL )
4488 point = m_lsegments->back();
4506 if ( afterinversion )
4515 for( a2dListOfa2dVertexList::const_iterator iterp = m_holes.begin(); iterp != m_holes.end(); iterp++ )
a2dHit m_how
return in which way the object was hit (stroke, fill, ...)
a2dPin * FindNonWirePin(a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL)
void SetClippingFromBox(a2dBoundingBox &bbox=wxNonValidBbox)
set the clipping polygon according to the given box
void PushCursor(const wxCursor &cursor)
push a cursor on the cursor stack, and set display cursor to new back being cursor.
bool GetAttributeValueBool(const wxString &attrib, bool defaultv=false)
Returns the boolean value of an attribute.
wxPoint2DDouble a2dPoint2D
this to define if coordinate numbers are integer or doubles
bool IsStrokeHit() const
true if this is a stroke hit (parent or child/member stroke)
used to move points in polygon objects
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
void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
virtual void Render(a2dIterC &ic, OVERLAP clipparent)
Render this object to the active a2dDrawingPart.
used to move points in polygon objects
double GetAbsY() const
get absolute Y position of the pin ( after applying the parent's matrix and its own matrix ) ...
bool SetSpecificFlags(bool setOrClear, a2dCanvasObjectFlagsMask which, const wxString &classname=wxT(""), a2dCanvasObjectFlagsMask whichobjects=a2dCanvasOFlags::ALL, const a2dBoundingBox &bbox=wxNonValidBbox, const a2dAffineMatrix &tworld=a2dIDENTITY_MATRIX)
set all given bit flags at once recursive for all objects in given boundingbox
void RemoveSegment(double &x, double &y, a2dLineSegmentPtr seg=NULL, bool transformed=true)
removes point at index
all basic primitives derived from a2dCanvasObject
#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.
unsigned int m_index
For edge/vertex hits the index of the edge / vertex.
bool GetGeneratePins() const
get the GeneratePins flag
a2dVertexList * GetSegmentsOrg()
get to segments chain to which this handle belongs in the original ( not edit copy ) ...
a2dObject * LoadOneObject(wxObject *parent)
load one object from a CVG file.
bool HasAttribute(const wxString &attrib)
Does the current tag have this attribute?
virtual double Length(const a2dLineSegment &prev)
calculate length
a2dHandle is used inside editing versions of a certain objects.
mouse event sent from a2dCanvasObject to itself
a2dVpath * ConvertToVpath(bool arc, bool closed=false)
return converted vector Vpath, arc segments stay intact if arc is true
a2dConnectTask
flags for searching a connecting a2dpinClass, for the connecting task at hand.
bool FindNearPoint(const a2dAffineMatrix *cworld, double xIn, double yIn, double *xOut, double *yOut)
Find the point on the polyline closest to the given world point.
void Set(double xs, double ys, double xm, double ym, double xe, double ye)
set arc using begin, end and middle point.
virtual void PopTransform(void)
Recall the previously saved user-to-world transform off the matrix stack.
const a2dAffineMatrix & GetTransformMatrix() const
get the matrix used to position the object
void SetRelease(bool value)
set release flag
XMLeventType Next()
Walks to next element and returns event type.
virtual bool RestrictToObject(a2dIterC &ic, const a2dPoint2D &pointToSnapTo, a2dPoint2D &bestPointSofar, a2dSnapToWhatMask snapToWhat, double thresHoldWorld)
called from an a2dRestrictionEngine, to restrict vertexes, lines, object to this object.
bool ResolveOrAdd(a2dSmrtPtr< a2dObject > *storedHere, const wxString &id=wxT(""))
try to resolve the object that is in storedHere when it is a reference.
void ConvertToLines(double aberation=0)
Convert complex segments to line segments.
void SetClippingTransformMatrix(const a2dAffineMatrix &mat=a2dIDENTITY_MATRIX)
Set the matrix used for the clipping polygon.
class to map references to objects stored in XML, in order to make the connection later on...
void SetName(const wxString &name)
set the name of the handle (must be unique)
a2dPin * FindEndPin()
Get the end pin from the childs.
a2dDrawing * m_root
root group for rendering and accessing the canvas's also contains layer settings
a2dCanvasOFlags m_flags
holds flags for objects
void Render(a2dIterC &ic, OVERLAP clipparent)
Render this object to the active a2dDrawingPart.
static const long sm_PinCanConnectToPinClass
Pin can connect to supplied a2dPinClass.
const a2dAffineMatrix & GetInverseTransform() const
Inverse of GetTransform()
static const a2dCanvasObjectFlagsMask BIN2
#define EVT_CANVASOBJECT_ENTER_EVENT(func)
static event table macro for a2dCanvasObject mouse enter event
void Transform(const a2dAffineMatrix &world)
transform all segments with given matrix
a2dVertexList * GetSegments()
get to segments chain to which this handle belongs in the original ( not edit copy ) ...
a2dPin is used in a2dCanvasObject to add pins to it.
This is a class/type description for a2dPin's.
void WriteStartElementAttributes(const wxString &name, bool newLine=true)
Writes start tag which has attributes.
polygon defined with list of points.
used to add points to polygon objects
void GetPosXYSegment(a2dLineSegmentPtr seg, double &x, double &y, bool transform=true) const
get point x and y at index
bool Rotate(double angle)
Rotate clockwise by the given number of degrees:
a2dPATH_END_TYPE m_pathtype
when m_contourwidth != 0 what is the end of the line looking like.
snap segments of other objects in a2dCanvasObject::RestrictToObject()
void Enlarge(const double Marge)
enlarge with the given amount
void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
double m_contourwidth
if != 0 the polygon is contoured at distance m_contourwidth/2
virtual void SetContourWidth(double width)
set the Contour width of the shape
clips all children to a polygon
basetype * GetPropertyValuePtr(a2dObject *obj) const
Get a pointer to the property value in obj.
bool EliminateMatrix()
reduce matrix to identity without replacing object
a2dBoundingBox GetBbox(const a2dAffineMatrix &lworld=a2dIDENTITY_MATRIX)
return a boundingbox of a transformed vertexarray
void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
void SetHandleToIndex(a2dPolyHandleL *handle, unsigned int index)
a handle in editing is updated to a segment at index given
bool IsHit() const
true if this is a hit
virtual bool Update(UpdateMode mode)
Update the state of the object according to its current position etc.
double PointDistance(const a2dPoint2D &p, a2dPoint2D *nearest) const
Calculate the distance of a point from the line. Works even if l==0.
#define EVT_CANVASHANDLE_MOUSE_EVENT(func)
static event table macro for a2dHandle mouse event
void SetDrawerStroke(const a2dStroke &stroke)
Used to set the current stroke.
#define EVT_CANVASHANDLE_MOUSE_EVENT_LEAVE(func)
static event table macro for a2dHandle mouse leave event
bool IsIdentity(void) const
Is the matrix the identity matrix?
Input and output handler for the XmlSer format.
virtual void DrawPolygon(a2dVertexArray *points, bool spline=false, wxPolygonFillMode fillStyle=wxODDEVEN_RULE)
Draw polygon in world coordinates using pointarray.
UpdateMode
Various mode flags for Update.
double m_x2
x2 x of arc midpoint
void SetChord(bool chord)
if true draw as a chord ( no fill end no lines to center )
double GetScale()
See GetScale()
snap to pins in other objects when not connected
void SetStrokeWorldExtend(double worldStrokeExtend)
Set strokeworld extend of last added object, used in a2dCanvasObject::DoIsHitWorld() ...
bool GetPixelStroke() const
if the width is pixels or not.
virtual void SetPending(bool pending)
set this object pending for update
OVERLAP
Result of a a2dBoundingBox intersection or hittest.
bool m_visiblechilds
child objects are visible or not
void RemoveRedundantPoints(a2dCanvasObject *sendCommandsTo=NULL)
remove all points that are redundant
a2dGlobal * a2dGlobals
global a2dCanvasGlobal to have easy access to global settings
void Clear()
Remove and delete all points in the polygon.
a2dPin * IsConnectedTo(a2dPin *pin=a2dAnyPin) const
Return the pin to which this pin is connected.
bool m_hasPins
true if this object does have a2dPin's as children
The base class for all drawable objects in a a2dCanvasDocument.
virtual bool GeneratePins(a2dPinClass *toConnectTo, a2dConnectTask task, double x, double y, double margin=0)
bool m_dragging
indicates dragging was/is going on
double GetTransformedHitMargin()
transformed to object its coordinate system
a2dVertexList * ConvertSplinedPolyline(double Aber) const
Spline conversion for polyline.
a2dPolygonLClipper(a2dBoundingBox &bbox=wxNonValidBbox)
construct the clipping polygon according to the given box
Arc Segment in a2dVertexList.
wxUint16 m_layer
layer of object, default wxLAYER_DEFAULT
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
void ReStoreFixedStyle()
when fixed drawing style is set, it can be overruled.
vertex array of line and arc segments.
a2dCanvasObject is the base class for Canvas Objects.
a2dPin * FindPin(int *i)
Get all pins one by one. i is updated by this function.
a2dBoundingBox wxNonValidBbox
global non valid boundingbox to use as default argument etc.
virtual a2dCanvasObjectList * GetAsCanvasVpaths(bool transform=true) const
when implemented the object without its children, is converted to
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dDerivedCanvasObjectStart
id for a2dWalkEvent issued from within a2dWalkerIOHandler
a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
clone it
bool SetPointIfCloser(const a2dPoint2D &pointToSnapTo, const a2dPoint2D &pointToSnap, a2dPoint2D &bestPointSofar, double thresHoldWorld)
bool DoUpdate(UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
Update derived Object specific things ( mainly boundingbox)
void ReStartEdit(wxUint16 editmode)
to restart editing in a different mode
a2dLayers * GetLayerSetup()
Get the layersettings for the canvas.
vertex list of line and arc segments.
void TransformPoint(double x, double y, double &tx, double &ty) const
Transform a point.
bool m_snap_to
snapping of other objects to this when in place
handle holds a pointer to a polygon/polyline segment
wxString GetName() const
get the name given to the handle.
bool DoUpdate(UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
Update derived Object specific things ( mainly boundingbox)
bool GetSelected() const
is the object selected flag set
void SetSelected(bool selected)
Set the object selected flag if allowed.
virtual bool RestrictToObject(a2dIterC &ic, const a2dPoint2D &pointToSnapTo, a2dPoint2D &bestPointSofar, a2dSnapToWhatMask snapToWhat, double thresHoldWorld)
called from an a2dRestrictionEngine, to restrict vertexes, lines, object to this object.
virtual bool DoStartEdit(wxUint16 editmode, wxEditStyle editstyle)
only used for editable objects and under control of a editing tool.
void WriteEndElement(bool newLine=true)
Writes correspondending end tag for the current start tag.
a2dCanvasObjectList * GetAsCanvasVpaths(bool transform=true) const
when implemented the object without its children, is converted to
virtual a2dVertexList * GetAsVertexList(bool &returnIsPolygon) const
convert to a polygon.
void SetContourWidth(double width)
set the Contour width of the shape
int ReleaseChild(a2dCanvasObject *obj, bool backwards=false, bool all=false, bool now=false, bool undoCommands=false)
remove the given object from the childobjects
bool FindNearPointOrtho(const a2dAffineMatrix *cworld, double xIn, double yIn, double *xOut, double *yOut)
Find the point on the polyline that is the closest orthogonal projection to the given world point...
int FindPinSegmentIndex(a2dPin *pinToFind, double margin=a2dACCUR)
find the index of the segment where the pin is on.
a2dAffineMatrix m_lworld
used for positioning the object (x,y,ang,scale etc.)
void SetClose(a2dPATHSEG_END close)
set this segment is closing a part since the last move
a2dPolyHandleL()
constructor
void SetDrawerFill(const a2dFill &fill)
Used to set the current fill.
bool m_generatePins
generate pins if true
~a2dPolygonLClipper()
destructor
Io handler to iterate through a a2dDocument.
#define EVT_CANVASHANDLE_MOUSE_EVENT_ENTER(func)
static event table macro for a2dHandle mouse enter event
bool MoveDynamicPinCloseTo(a2dPin *pin, const a2dPoint2D &point, bool final)
Move the given dynamic pin close to the given absolute point.
bool SetPosXYRestrict(double &x, double &y)
set position to x,y but restricted, returns new values
wxMouseEvent & GetMouseEvent()
return the original mouse event that was redirected to the a2dHandle
bool GetCheck() const
general flag use at will.
virtual a2dCanvasObjectList * GetAsPolylines(bool transform=true) const
convert contour to a polyline and holes to seperate polylines.
snap to other objects its vertexes, which are decided in a2dCanvasObject::RestrictToObject() ...
wxUint32 m_option
the way to hit/traverse the document.
void WriteNewLine()
Writes a new line and takes care of indentation.
void SetIgnoreSetpending(bool value=true)
set IgnoreSetpending flag
bool IsEdgeHit() const
true if this is a stroke hit on an edge
~a2dPolyHandleL()
destructor
bool DoCanConnectWith(a2dIterC &ic, a2dPin *pin, double margin, bool autocreate)
prepare an object for being connected to a given pin
a2dCanvasObjectList * wxNullCanvasObjectList
define a NON a2dCanvasObjectList
used to change a property on objects
void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
clone it
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
bool GetArcHandle()
is the handle on segment an arc modifier?
void Virtual_Point(a2dPoint2D &a_point, double distance) const
calculate point Perpendicula at distance from the line, through given point
bool m_bin
Marker for walking over the segments.
double GetMinX() const
get minimum X of the boundingbox
a2dCanvasObjectList * m_childobjects
holds child objects
#define forEachIn(listtype, list)
easy iteration for a2dlist
clips all children to a polygon
void SetMode(int mode)
default used to modify rendering
polyline defined with list of points.
void Insert(unsigned int index, a2dLineSegmentPtr segin)
insert before segment with index given
void SetPropertyToObject(a2dObject *obj, const basetype &value, SetFlags setflags=set_none) const
Set the property in obj to value.
double GetContourWidth() const
get the Contour width of the shape
void SetPosXYMidSegment(a2dLineSegmentPtr seg, double x, double y, bool afterinversion=true)
modify middle point of arcsegment at index to x,y
std::list< T, std::allocator< T > >::iterator GetPreviousAround(typename std::list< T, std::allocator< T > >::iterator iter)
get the previous node ( –end() if no previous )
The point hits a member of the object (e.g. line begin/end object)
used to remove points from polygon objects
void Walker(wxObject *parent, a2dWalkerIOHandler &handler)
This is used to recursively walk through an object tree.
void GetPosXYMidSegment(int index, double &x, double &y, bool transform=true) const
get middle point of arcsegment at index to x,y
double GetPosX() const
get x position from affine matrix
virtual void DrawPolyPolygon(a2dListOfa2dVertexList polylist, wxPolygonFillMode fillStyle=wxODDEVEN_RULE)
draw a list of polygons ( contour clockwise becomes hole )
a2dHit & GetHow()
in what manner the a2dCanvasObject was hit.
void SetSegments(a2dVertexList *points)
Set the list of points ( the old list is NOT DELETED !!! )
a2dDrawer2D * GetDrawer2D() const
get current a2dDrawer2D
Normal straight line segment in a2dVpath.
a2dVertexListPtr GetSegments()
Get the list of points ( this is not a copy! )
snap to intersections in other objects
bool m_editable
object can be edited
virtual a2dVertexList * GetAsVertexList(bool &returnIsPolygon) const
convert to a polygon.
a2dCanvasObject * GetShowObject() const
return pointer of then currently shown object on the drawer.
void SetPosXYSegment(int index, double x, double y, bool afterinversion=true)
modify point at index to x,y
double wxRadToDeg(double rad)
conversion from radians to degrees
Normal straight line segment in a2dVertexList and a2dVertexArray.
void SetSpecificFlags(bool setOrClear, a2dCanvasObjectFlagsMask which)
set all bit flags in object that or true in mask to true or false
#define EVT_CANVASOBJECT_MOUSE_EVENT(func)
static event table macro for a2dCanvasObject mouse event
void SetContourWidth(double width)
void CalculateLineParameters()
Calculate the parameters if invalid.
void Clear()
Remove and delete all points in the polygon.
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
virtual bool DisConnectAt(a2dPin *pin, bool undo=false)
Do Disconnect from another a2dCanvasObject by pin pointer.
general event sent from a2dHandle to its parent a2dCanvasObject
int Release(a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL, const wxString &classname=wxT(""), const a2dPropertyId *id=NULL, const wxString &name=wxT(""), bool now=true)
release only objects with the given mask and classname and has property named propertyname and object...
void Add(a2dVpathSegment *seg)
add a segment
Restriction engine for editing restrictions like snapping.
a2dLineSegment * FindPinSegment(a2dPin *pinToFind, double margin=a2dACCUR)
find the segment where the pin is on.
bool m_childrenOnSameLayer
bool HasPins(bool realcheck=false)
are there a2dPin derived children
a2dVertexList::iterator GetNextAround(a2dVertexList::iterator iter)
get the next segment as a polygon ( begin() is no next )
virtual void DrawLine(double x1, double y1, double x2, double y2)
Draw line in world coordinates.
a2dHit HitTestPolyline(const a2dPoint2D &ptest, double margin)
extensive hittesting on vertex list seen as polyline.
Input and output handler for the XmlSer format.
a2dPin * AddPin(const wxString name, double x, double y, wxUint32 a2dpinFlags, a2dPinClass *pinClass, bool undo=false)
add a a2dPin as child
void SetBegin(a2dCanvasObject *begin)
set object to draw as begin point
bool IsConnected(bool needsupdate, a2dCanvasObject *toConnect=0)
Is the object connected ( Optinal to specific object ) ?
a2dPin * FindBeginPin()
Get the begin pin from the childs.
void RemovePins(bool NotConnected=false, bool onlyTemporary=false, bool now=false)
Remove all a2dPin children.
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
virtual a2dCanvasObjectList * GetAsPolygons(bool transform=true) const
convert contour to a polygons and holes to seperate polygons.
static double GetRoundFactor()
void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
a2dHandle * GetCanvasHandle()
return the handle object hit
the property is temporary and never saved
Contains a2dDrawing Class to hold a drawing.
virtual void SetHandleToIndex(a2dPolyHandleL *handle, unsigned int index)
a handle in editing is updated to a segment at index given
wxUint32 a2dSnapToWhatMask
mask for a2dSnapToWhat flags
void WriteEndAttributes(bool close=false)
"Closes" the start tag after writing all attributes (writes the ">" or "/>" bracket).
virtual a2dCanvasObjectList * GetSnapVpath(a2dSnapToWhatMask snapToWhat)
return a vectorpath indicating on which point/segments the object likes to be snapped.
editing is completely controlled by tools. No handles are added
virtual bool Submit(a2dCommand *command, bool storeIt=true)
next to the base class submit, it sets a2DocumentCommandProcessor for a2dCommand
virtual void DoWalker(wxObject *parent, a2dWalkerIOHandler &handler)
iterate over this object and its children
bool m_snap
snapping of editable object or when moving
double GetContourWidth() const
get the Contour width of the shape
virtual bool DoStartEdit(wxUint16 editmode, wxEditStyle editstyle)
only used for editable objects and under control of a editing tool.
A 2x3 affine matrix class for 2D transformations.
a2dPoint2D GetPosXY() const
get position of object
wxMouseEvent & GetMouseEvent()
return the original mouse event that was redirected to the a2dCanvasObject
a2dVertexList * ConvertToContour(double distance, a2dPATH_END_TYPE pathtype, bool asPolygon=false)
create a contour around polygon/polyline
a2dStroke GetDrawerStroke() const
get the current stroke
void RemoveRedundantPoints(a2dCanvasObject *sendCommandsTo=NULL)
remove all points that are redundant
double GetAttributeValueDouble(const wxString &attrib, double defaultv=0)
Returns the double value of an attribute.
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 void ExtendAndPushClippingRegion(a2dVertexList *points, bool spline=false, wxPolygonFillMode fillStyle=wxODDEVEN_RULE, a2dBooleanClip clipoperation=a2dCLIP_AND)=0
push on stack the current clipping region and extend clipping region
bool IsDynamicPin() const
return true if this pin is a dynamic pin
a2dPinClass * GetPinClass() const
return the pin class of this pin
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 DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
const a2dAffineMatrix & GetInverseParentTransform() const
inverse of GetParentTransform()
a2dPin * HasPinNamed(const wxString pinName, bool NotConnected=false)
are there a2dPin derived children which matches the given pin name?
double m_y2
y2 y of arc midpoint
double GetPosY() const
get y position from affine matrix
double GetWorldStrokeExtend()
int IndexOf(a2dLineSegment *object) const
Find the index of a specific object.
void ConvertIntoSplinedPolygon(double Aber)
bool DoUpdate(UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
Update derived Object specific things ( mainly boundingbox)
virtual a2dLineSegment * Clone()
create exact copy
void SetPosXYSegment(a2dLineSegmentPtr seg, double x, double y, bool afterinversion=true)
modify point at index to x,y
while iterating a a2dCanvasDocument, this holds the context.
snap segments middle of other objects in a2dCanvasObject::RestrictToObject()
void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
double m_x
x endpoint of line
struct for how a single object on one layer was hit
polygon defined with list of points for outer contour plus a list of hole polygons ...
double m_x
(world coordinates) hit point x as in a2dDrawingPart or any other top level
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...
All updates of these modes force an update (e.g. update non-pending valid bounding boxes) ...
void Remove180DegPoints(a2dCanvasObject *sendCommandsTo=NULL, bool removeZeroFirst=true)
remove segments which are opposite direction overlapping.
a2dLineSegment * AddPoint(double x, double y, a2dLineSegmentPtr seg=NULL, bool afterinversion=true)
add point/segment after a segment.
void MapBbox(const a2dAffineMatrix &matrix)
a2dCommandProcessor * GetCommandProcessor() const
Returns a pointer to the command processor associated with this document.
a2dCanvasObjectList * GetAsCanvasVpaths(bool transform=true) const
when implemented the object without its children, is converted to
#define EVT_CANVASOBJECT_LEAVE_EVENT(func)
static event table macro for a2dCanvasObject mouse leave event
a2dBoundingBox GetMappedBbox(a2dIterC &ic, bool withExtend=true)
first translate boundingbox with cworld and recalculate at new position
double m_y
y endpoint of line
virtual bool Submit(a2dCommand *command, bool storeIt=true)
double PointDistanceOrhto(const a2dPoint2D &p, a2dPoint2D *nearest) const
Calculate the orthogonal distance of a point from the line. Works even if l==0.
void SetStroke(const wxColour &strokecolor, double width=0, a2dStrokeStyle style=a2dSTROKE_SOLID)
Set a stroke for the object which will be used instead of the layer stroke.
wxString GetAttributeValue(const wxString &attrib, const wxString &defaultv=wxT(""))
Returns the value of an attribute.
a2dRestrictionEngine * GetRestrictionEngine()
Get restriction engine (grid snapping)
double GetUnitsScale()
this is the number that defines the physical dimension in meters / inch/ etc.
std::list< T, std::allocator< T > >::iterator GetNextAround(typename std::list< T, std::allocator< T > >::iterator iter)
get the next node ( begin() if no next )
a2dConnectionGenerator * GetConnectionGenerator() const
Get class for generating new connection objects between object and pins.
bool GetRelease() const
get release flag
a2dCanvasCommandProcessor * GetCanvasCommandProcessor()
get a pointer to the command processor
double m_y1
y endpoint of line
bool DoIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
Does hit test on the object (exclusif child objects)
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
virtual bool Update(UpdateMode mode)
Update the state of the object according to its current position etc.
double GetHitMarginWorld()
Get HitMargin in World units.
virtual bool AdjustAfterChange(bool final)
adjust the polygon after a point change
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.
if set, don't stop at the first hit, but test child/sibling objects anyway
void SetPointAdjustArcs(unsigned int n, double x, double y, bool polygon)
sets a point of a segment and adjusts arc it midpoints.
wxString GetTagName()
Returns name of the current XML tag.
a2dAffineMatrix m_ClipLworld
clipping matrix.
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 Translate(double x, double y)
Translate by dx, dy:
a2dVertexList * GetAsVertexList(bool &returnIsPolygon) const
convert to a polygon.
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...
void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
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.
bool DoStartEdit(wxUint16 editmode, wxEditStyle editstyle)
only used for editable objects and under control of a editing tool.
virtual bool EliminateMatrix()
reduce matrix to identity
a2dFill GetDrawerFill() const
get the current fill
bool DoIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
Does hit test on the object (exclusif child objects)
virtual void PopClippingRegion()=0
pop a previously pushed clipping region
a2dPin * GetPin()
see SetPin()
a2dHit HitTestPolygon(const a2dPoint2D &ptest, double margin)
extensive hittesting on vertex list seen as polygon.
a2dCanvasObject * IsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
If the position (x,y) is within the object return this.
void InsertSegment(unsigned int index, a2dLineSegmentPtr segin)
insert segment after index given
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
bool Invert(void)
Invert matrix.
void Contour(double distance, a2dPATH_END_TYPE pathtype)
create an offset contour at distance
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
all polygon and polyline a2dCanvasObject are here.
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
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.
void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
double m_x1
x endpoint of line
void SetPosXyPoint(const a2dPoint2D &pos)
set position to x,y
basetype GetPropertyValue(const a2dObject *obj) const
Get the property value in obj.
void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dDerivedCanvasObjectEnd
id for a2dWalkEvent issued from within a2dWalkerIOHandler
a2dCanvasGlobal * a2dCanvasGlobals
global a2dCanvasGlobal to have easy access to global settings
virtual void DrawCircle(double x, double y, double radius)
Draw Circle in world coordinates.
virtual void Save(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dObjectList *towrite)
write all needed to an XML type of file called the CVG format
a2dCanvasObject for a Vector Path
size_t GetNumberOfSegments()
get the number of points in the pointlist
a2dDrawingPart * GetDrawingPart() const
get current a2dDrawingPart
This template class is for property ids with a known data type.
double GetScale()
See GetScale()
a2dBoundingBox m_bbox
boundingbox in world coordinates
virtual void RemoveSegment(double &x, double &y, a2dLineSegmentPtr seg=NULL, bool transformed=true)
removes point at index
static const a2dCanvasObjectFlagsMask ALL
void RemoveRedundantPoints(a2dCanvasObject *sendCommandsTo=NULL)
remove all points that are redundant
void GetPosXYSegment(int index, double &x, double &y, bool transform=true) const
get point x and y at index
virtual void DrawLines(a2dVertexArray *points, bool spline=false)
Draw polyline in world coordinates using pointarray.
double GetAbsX() const
get absolute X position of the pin ( after applying the parent's matrix and its own matrix ) ...
void Append(a2dCanvasObject *obj)
append a a2dCanvasObject to the childobjects
a2dCanvasObject * GetParent() const
get parent object of the pin
const a2dAffineMatrix & GetTransform() const
Get the accumulated transform up to and including m_lworld of the current object. ...
void PopCursor()
pop a cursor from the cursor stack, and set display cursor to back
virtual void SetLayer(wxUint16 layer)
set layer index where this object is drawn upon.
void SetEnd(a2dCanvasObject *end)
set object to draw as end point
bool DoIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
return this object if one of the objects it references is hit
double m_rely
(world coordinates) hit point y relative to the canvas object its parent object(s) ...
virtual bool Update(UpdateMode mode)
Update the state of the object according to its current position etc.
void SetRestrictPoint(double xSnap, double ySnap)
sets the point for snapping to
double m_y
(world coordinates) hit point y as in a2dDrawingPart or any other top level
double DeviceToWorldXRel(double x) const
convert x relative from device to world coordinates
CloneOptions
options for cloning
const a2dAffineMatrix & GetUserToDeviceTransform() const
get matrix which transforms directly from user coordinates to device
a2dPoint2D GetMidPoint() const
get middle on arc segment between end and start
structure to give as parameter to member functions of a2dCanvasObject
virtual bool RestrictPoint(double &x, double &y, wxUint32 sourceRequired=snapToAll, bool ignoreEngine=false)
Restrict a single point of a line or polyline.
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
const double wxPI
defines PI
wxInt64 GetUniqueSerializationId() const
return a unique id for this object
void SetFill(const a2dFill &fill)
Set a fill for the object which will be used instead of the layer fill.
virtual void PushIdentityTransform()
push no transform, to draw directly in device coordinates
snap to pins in other objects
virtual void DoWalker(wxObject *parent, a2dWalkerIOHandler &handler)
iterate over this object and its children
bool m_filled
use fill to fill if set
bool EliminateMatrix()
reduce matrix to identity without replacing object
#define A2D_PROPID_D_F(type, propname, defaultval, flags)
to define a get set property more easily
const a2dFill * a2dTRANSPARENT_FILL
global a2dFill stock object for TRANSPARENT filling
static const a2dCanvasObjectFlagsMask PRERENDERASCHILD
general canvas module declarations and classes
void SetArcHandle(bool arcHandle)
set handle on segment as arc modifier
void WriteStartElement(const wxString &name, bool newLine=true)
Writes start tag which has no attributes.
void OverRuleFixedStyle()
id style is FIXED, saves current style and sets style to a2dFILLED