25 #include <wx/wfstream.h>
50 a2dDumpWalker::~a2dDumpWalker()
60 object->Walker( NULL, *
this );
104 a2dWalker_CallMemberFunc::a2dWalker_CallMemberFunc()
110 a2dWalker_CallMemberFunc::~a2dWalker_CallMemberFunc()
117 object->Walker( NULL, *
this );
126 ( canobj->*( ( a2dCanvasObjectFunc ) ( m_func ) ) )();
139 a2dWalker_CallMemberFuncW::a2dWalker_CallMemberFuncW()
144 a2dWalker_CallMemberFuncW::~a2dWalker_CallMemberFuncW()
151 object->Walker( NULL, *
this );
162 ( canobj->*( ( a2dCanvasObjectFuncW ) ( m_func ) ) )( this );
175 a2dWalker_SetAvailable::a2dWalker_SetAvailable(
a2dLayers* layerSetup )
182 a2dWalker_SetAvailable::a2dWalker_SetAvailable(
a2dDrawingPart* drawingPart )
189 a2dWalker_SetAvailable::~a2dWalker_SetAvailable()
195 object->Walker( NULL, *
this );
201 bool foundfirst =
false;
240 a2dWalker_RemoveProperty::~a2dWalker_RemoveProperty()
252 object->Walker( NULL, *
this );
308 a2dWalker_RemovePropertyCandoc::~a2dWalker_RemovePropertyCandoc()
320 object->Walker( NULL, *
this );
382 a2dWalker_FilterCanvasObjects::~a2dWalker_FilterCanvasObjects()
411 object->Walker( NULL, *
this );
546 a2dWalker_CollectCanvasObjects::~a2dWalker_CollectCanvasObjects()
590 if ( firstc->
GetName() < secondc->GetName() )
600 if ( firstc->
GetName() > secondc->GetName() )
654 a2dWalker_CollectCanvasObjectsSet::~a2dWalker_CollectCanvasObjectsSet()
666 bool a2dWalker_CollectCanvasObjectsSet::Start(
a2dCanvasObject*
object )
676 object->Walker( NULL, *
this );
719 a2dWalker_FindCanvasObject::~a2dWalker_FindCanvasObject()
750 object->Walker( NULL, *
this );
780 a2dWalker_SetSpecificFlagsCanvasObjects::~a2dWalker_SetSpecificFlagsCanvasObjects()
789 object->Walker( NULL, *
this );
831 a2dWalker_SetPropertyToObject::~a2dWalker_SetPropertyToObject()
892 object->Walker( NULL, *
this );
905 m_skipNotRenderedInDrawing =
true;
908 a2dWalker_SetRoot::~a2dWalker_SetRoot()
918 if ( drawingInDrawing && drawingInDrawing !=
m_root )
933 object->Walker( NULL, *
this );
961 a2dWalker_MakeTree::~a2dWalker_MakeTree()
968 setp.
Start(
object );
970 object->Walker( NULL, *
this );
979 m_firstLevelChild =
false;
995 m_firstLevelChild =
true;
1006 if ( obj && m_firstLevelChild )
1015 for ( i = 0 ; i < arrayref->GetRows(); i++ )
1017 for ( j = 0 ; j < arrayref->GetColumns(); j++ )
1025 offsetXY.
Translate( arrayref->GetHorzSpace(), 0 );
1028 offsetXY.
Translate( -arrayref->GetHorzSpace()*arrayref->GetColumns(), arrayref->GetVertSpace() );
1057 m_firstLevelChild =
false;
1094 a2dWalker_RemoveHierarchy::~a2dWalker_RemoveHierarchy()
1101 unify.
Start(
object );
1104 setp.
Start(
object );
1106 setflags.SetSkipNotRenderedInDrawing(
true );
1107 setflags.
Start(
object,
false );
1109 object->Walker( NULL, *
this );
1119 m_firstLevelChild =
false;
1138 m_firstLevelChild =
true;
1151 if ( obj && !obj->
GetBin() && parentobj && m_firstLevelChild )
1156 wxASSERT_MSG( ref->
GetCanvasObject() == NULL, wxT(
"No references allowed at this stage" ) );
1167 a2dCanvasObjectList::value_type objchild = *iter;
1171 if ( !objchild->GetRelease() )
1179 objchild->SetBin(
true );
1180 objchild->SetParent( parentobj );
1182 objchild->SetSelected( m_selected );
1193 m_parentList.pop_front();
1194 if ( m_parentList.size() < 2 )
1196 m_firstLevelChild =
false;
1245 wxASSERT_MSG( wxMAXLAYER > targetlayer , wxT(
" targetlayer > wxMAXLAYER, index to high" ) );
1252 setflags.SetSkipNotRenderedInDrawing(
true );
1253 setflags.
Start(
object,
false );
1255 object->Walker( NULL, *
this );
1306 m_detectCircle =
false;
1307 m_calculatedArea = 0.0;
1348 bool returnIsPolygon;
1353 parentobj->
Append( contour );
1367 if ( m_detectCircle && objc->
GetSegments()->CheckForOneCircle( middle, radius ) )
1404 for( a2dCanvasObjectList::iterator iterp = polylist->begin(); iterp != polylist->end(); ++iterp )
1414 else if ( polyline && polyline->GetNumberOfSegments() > 2 )
1417 polyline->SetBin(
true );
1418 parentobj->
Prepend( polyline );
1426 for( a2dCanvasObjectList::iterator iterp = polylist->begin(); iterp != polylist->end(); ++iterp )
1437 else if ( polyline && polyline->GetNumberOfSegments() > 2 )
1440 polyline->SetBin(
true );
1441 polyline->GetSegments()->ConvertToLines();
1442 parentobj->
Prepend( polyline );
1450 for( a2dCanvasObjectList::iterator iterp = vpath->begin(); iterp != vpath->end(); ++iterp )
1464 int i, count = polylist->size();
1465 a2dCanvasObjectList::iterator iterp = polylist->begin();
1466 for( i = 0 ; i < count ; i++ )
1477 iterp = polylist->erase( iterp );
1479 else if ( polyline && polyline->GetNumberOfSegments() > 2 )
1482 polyline->SetBin(
true );
1483 parentobj->
Prepend( polyline );
1493 int i, count = polylist->size();
1494 a2dCanvasObjectList::iterator iterp = polylist->begin();
1495 for( i = 0 ; i < count ; i++ )
1501 for( a2dCanvasObjectList::iterator iterl = linesAndArcs->begin(); iterl != linesAndArcs->end(); ++iterl )
1503 iterp = polylist->erase( iterp );
1504 delete linesAndArcs;
1543 void a2dWalker_LayerCanvasObjects::AddArea(
a2dCanvasObject* getAsPolyObject )
1618 a2dCanvasObjectList::iterator iter = vpath->begin();
1619 while ( iter != vpath->end() )
1625 for( a2dCanvasObjectList::iterator iterp = polylist->begin(); iterp != polylist->end(); ++iterp )
1635 iter = vpath->erase( iter );
1636 iter = vpath->begin();
1685 setflags.Start(
object,
false );
1687 m_CVGwriter.WriteCvgStartDocument( m_strstream );
1690 m_CVGwriter.WriteAttribute( wxT(
"classname" ), wxT(
"a2dCanvasObject" ) );
1693 object->Walker( NULL, *
this );
1697 m_CVGwriter.WriteCvgEndDocument();
1722 #if wxART2D_USE_CVGIO
1723 m_CVGwriter.WriteObject( obj );
1724 #endif //wxART2D_USE_CVGIO
1791 setflags.Start(
object,
false );
1793 m_CVGwriter.WriteCvgStartDocument( m_strstream );
1796 m_CVGwriter.WriteAttribute( wxT(
"classname" ), wxT(
"a2dCanvasObject" ) );
1799 object->Walker( NULL, *
this );
1803 m_CVGwriter.WriteCvgEndDocument();
1837 #if wxART2D_USE_CVGIO
1838 m_CVGwriter.WriteObject( p );
1839 #endif //wxART2D_USE_CVGIO
1857 #if wxART2D_USE_CVGIO
1858 m_CVGwriter.WriteObject( p );
1859 #endif //wxART2D_USE_CVGIO
1901 obj->SetIsOnCorridorPath(
true );
1915 obj->SetIsOnCorridorPath(
false );
1932 /! Search for objects that are multiple referenced from within the document.
1933 All such object get there m_bin2 flag set.
1935 virtual bool MarkMultiReferences();
1938 bool a2dCanvasObject::MarkMultiReferences()
1944 m_flags.m_bin2 = true;
1947 m_flags.m_bin = true; //passed here
1949 if ( canobj->GetChildObjectList() == wxNullCanvasObjectList )
1952 forEachIn( a2dCanvasObjectList, canobj->GetChildObjectList() )
1954 a2dCanvasObject *obj = *iter;
1955 found = obj->MarkMultiReferences() && found;
1969 The base implementation calls this function on its childs, so in a derived object always
1970 call the base class to keep recursing deeper.
1972 \param function id of the user function to be called
1973 \param data for the called function (type depends on id)
1974 \param depth recursion depth (0=this object, 1=this object+childs, ...)
1975 \param flags objects with this flag set ignore the depth limit
1977 virtual bool UserBaseFunctionEx( int function, void *data, int depth, a2dCanvasObjectFlagsMask flags );
1981 bool a2dCanvasObject::UserBaseFunctionEx( int function, void *data, int depth, a2dCanvasObjectFlagsMask flags )
1983 if( depth<=0 && !CheckMask( flags ) )
1987 if( GetChildObjectsCount() )
1989 forEachIn( a2dCanvasObjectList, canobj->GetChildObjectList() )
1991 a2dCanvasObject *obj = *iter;
1992 rslt &= obj->UserBaseFunctionEx( function, data, depth-1, flags );
2003 This brings the wxWindows controls back to the front.
2005 void RefreshControls();
2008 void a2dCanvasObject::RefreshControls()
2010 if ( canobj->GetChildObjectList() == wxNullCanvasObjectList )
2013 forEachIn( a2dCanvasObjectList, canobj->GetChildObjectList() )
2015 a2dCanvasObject *obj = *iter;
2016 obj->RefreshControls();
2066 setflags.Start(
object,
false );
2068 m_CVGwriter.WriteCvgStartDocument( m_strstream );
2071 m_CVGwriter.WriteAttribute( wxT(
"classname" ), wxT(
"a2dCanvasObject" ) );
2074 object->Walker( NULL, *
this );
2078 m_CVGwriter.WriteCvgEndDocument();
2094 if ( obj && parentobj && !obj->GetIgnoreLayer() && !obj->
GetBin() &&
ObjectOke( obj ) )
2107 #if wxART2D_USE_CVGIO
2108 m_CVGwriter.WriteObject( obj );
2109 #endif //wxART2D_USE_CVGIO
2156 setp.SetSkipNotRenderedInDrawing(
true );
2157 setp.
Start(
object );
2163 object->WalkerWithContext( *m_context, NULL, *
this );
2195 Render( ic, canobj, childclip );
2206 wxUint16 layer = canobj->
GetLayer();
2244 if ( canobj->GetHighLight() )
2265 bool fillset =
false;
2266 bool strokeset =
false;
2267 bool viewSpecific =
false;
2293 if ( ic.
GetLayer() == layer || ic.
GetLayer() == wxLAYER_ALL || canobj->GetIgnoreLayer() )
2300 canobj->CallDoRender( ic, clipparent );
2304 if ( canobj->GetHighLight() )
2316 a2dConnectTask connectTask,
double xpin,
double ypin,
double margin )
2322 m_pinclassToConnectTo = pinclassToConnectTo;
2326 m_connectTask = connectTask;
2327 m_stopAtFirst =
false;
2330 a2dWalker_FindPinsToConnect::~a2dWalker_FindPinsToConnect()
2346 a2dCanvasObjectList::iterator iter;
2348 for( iter = object->
GetChildObjectList()->begin(); iter !=
object->GetChildObjectList()->end(); ++iter )
2353 a2dCanvasObjectList::iterator iterpins;
2366 double dx = fabs( pin->
GetAbsX() - m_xpin );
2367 double dy = fabs( pin->
GetAbsY() - m_ypin );
2370 if ( dx < m_margin && dy < m_margin
2379 if ( m_returnPinclass = pinclass->GetPinClassForTask( m_connectTask, obj, m_pinclassToConnectTo, pin ) )
2387 else if ( m_connectTask == a2d_StartWire_BasedOnClassStartPin )
2389 if ( m_returnPinclass = pinclass->GetPinClassForTask( m_connectTask, obj ) )
2392 else if ( m_connectTask == a2d_StartWire_BasedOnWireClassRequired )
2394 if ( m_returnPinclass = pinclass->GetPinClassForTask( m_connectTask, obj ) )
2397 else if ( m_connectTask == a2d_StartWire_BasedOnObjectClassRequired )
2399 if ( m_returnPinclass = pinclass->GetPinClassForTask( m_connectTask, obj ) )
2404 if ( m_pinclassToConnectTo == m_pinclassToConnectTo->GetPinClassForTask( m_connectTask, obj, pinclass ) )
2434 if ( m_stopAtFirst )
2464 m_pinToConnectTo = pinToConnectTo;
2466 m_connectTask = connectTask;
2467 m_stopAtFirst =
false;
2470 a2dWalker_FindPinsToConnectToPin::~a2dWalker_FindPinsToConnectToPin()
2486 a2dCanvasObjectList::iterator iter;
2488 for( iter = object->
GetChildObjectList()->begin(); iter !=
object->GetChildObjectList()->end(); ++iter )
2493 a2dCanvasObjectList::iterator iterpins;
2504 double dx = fabs( pin->
GetAbsX() - m_pinToConnectTo->
GetAbsX() );
2505 double dy = fabs( pin->
GetAbsY() - m_pinToConnectTo->
GetAbsY() );
2508 if ( dx < m_margin && dy < m_margin
2514 if ( m_connectTask == a2d_PinToPin )
2516 if ( m_pinToConnectTo->
GetPinClass() == pinclass->GetPinClassForTask( m_connectTask, obj, m_pinToConnectTo->
GetPinClass(), m_pinToConnectTo ) )
2526 if ( m_pinToConnectTo->
GetPinClass() == pinclass->GetPinClassForTask( m_connectTask, obj, m_pinToConnectTo->
GetPinClass(), m_pinToConnectTo ) )
2537 if ( m_stopAtFirst )
2567 m_pinclassToConnectTo = pinclassToConnectTo;
2570 m_connectTask = connectTask;
2573 a2dWalker_GeneratePinsToConnect::~a2dWalker_GeneratePinsToConnect()
2592 a2dCanvasObjectList::iterator iter;
2596 for( iter = object->
GetChildObjectList()->begin(); iter !=
object->GetChildObjectList()->end(); ++iter )
2648 a2dWalker_SetPinsToEndState::~a2dWalker_SetPinsToEndState()
2661 a2dCanvasObjectList::iterator iter;
2663 for( iter = object->
GetChildObjectList()->begin(); iter !=
object->GetChildObjectList()->end(); ++iter )
2670 a2dCanvasObjectList::iterator iterpins;
2713 a2dWalker_SetPinsToBeginState::~a2dWalker_SetPinsToBeginState()
2726 a2dCanvasObjectList::iterator iter;
2728 for( iter = object->
GetChildObjectList()->begin(); iter !=
object->GetChildObjectList()->end(); ++iter )
2736 a2dCanvasObjectList::iterator iterpins;
2780 m_connectTask = connectTask;
2781 m_connectObject = connectObject;
2784 a2dWalker_GeneratePinsToConnectObject::~a2dWalker_GeneratePinsToConnectObject()
2801 a2dCanvasObjectList::iterator iter;
2803 bool directChild =
false;
2809 if ( m_connectObject == obj )
2831 a2dCanvasObjectList::iterator iter;
2860 allpinobjects.push_back( obj );
2866 for( iter = allpinobjects.begin(); iter != allpinobjects.end(); ++iter )
2877 if ( m_connectObject->GetEditingRender( ) )
2882 if ( original != obj )
2929 m_connectTask = connectTask;
2930 m_connectObject = connectObject;
2934 a2dWalker_ConnectToPinsObject::~a2dWalker_ConnectToPinsObject()
2943 bool a2dWalker_ConnectToPinsObject::Start(
a2dCanvasObject* top,
bool alsoWires )
2948 a2dCanvasObjectList::iterator iter;
2950 bool directChild =
false;
2956 if ( m_connectObject == obj )
2967 ( alsoWires || !m_connectObject->
IsConnect() ) )
2969 a2dCanvasObjectList::iterator iter;
2976 ConnectAtPin( top, pin );
2986 a2dCanvasObjectList::iterator iter;
2993 a2dCanvasObjectList::iterator iterpins;
3018 m_connectObject->
ConnectPins( top, pintoconnect, pin,
true );
Display Part of a a2dDrawing, in which a2dCanvasObjects are shown.
a2dCanvasObject * GetCanvasObject()
set check on a2dObject flag false or true
virtual void MakeReferencesUnique()
All direct a2dCanvasObject which are part of this one are made unique.
a2dCircle at x,y, and with radius
bool IsSameLocation(a2dPin *other, double margin=0) const
Check if this pin is at same location.
wxPoint2DDouble a2dPoint2D
this to define if coordinate numbers are integer or doubles
bool Start(a2dObject *object)
Start traversing at object, returns true.
double GetHeight() const
returns height of the boundingbox
a2dWalker_RemoveProperty(bool all=true)
constructor with no a2dPropertyId added yet. For that use AddPropertyId()
bool m_result
result of walk, set false at start, use at will.
virtual bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dCanvasDocument
a2dNamedProperty * m_property
id of property to set
void Initialize()
used from constructors
static const a2dCanvasObjectFlagsMask BIN
(In) Visible property that can be added to Docview Objects.
double GetAbsY() const
get absolute Y position of the pin ( after applying the parent's matrix and its own matrix ) ...
A2DGENERALDLLEXP long wxGenNewId()
This function is like wxNewId, but it has its own ID set.
all basic primitives derived from a2dCanvasObject
#define wxDynamicCast(obj, className)
Define wxDynamicCast so that it will give a compiler error for unrelated types.
void SetRoot(a2dDrawing *root, bool recurse=true)
Sets this object to a a2dCanvasDocument.
virtual bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dCanvasDocument
bool GetGeneratePins() const
get the GeneratePins flag
a2dCanvasObjectList * CreateChildObjectList()
create and get the list where the child objects are stored in.
a2dCanvasObjectReference is a reference to any a2dCanvasObject derived class.
a2dWalker_MakeTree(a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL)
constructor with no a2dPropertyId added yet. For that use AddPropertyId()
virtual bool HasProperty(const a2dPropertyId *id, const wxString &stringvalue=wxEmptyString) const
Check if the object has a property with given id and string representation.
bool CanConnectWith(a2dIterC &ic, a2dCanvasObject *toConnect, bool autocreate)
check connect to other object
bool Start(a2dObject *object)
a2dCanvasObjectList * GetAsCanvasVpaths(bool transform=true) const
when implemented the object without its children, is converted to
a2dConnectTask
flags for searching a connecting a2dpinClass, for the connecting task at hand.
a2dWalker_SetSpecificFlagsCanvasObjects(a2dCanvasObjectFlagsMask which, a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL)
constructor with no a2dPropertyId added yet. For that use AddPropertyId()
virtual wxString GetName() const
Returns the name of this object, if no name is given the internal id will be returned.
const a2dStroke * a2dBLACK_STROKE
global a2dStroke stock object for BLACK stroking
void Initialize()
to initialize a walker class, default does nothing.
const a2dAffineMatrix & GetTransformMatrix() const
get the matrix used to position the object
void SetRelease(bool value)
set release flag
void SetDepthFirst(bool depthFirst)
set if walker needs to go into recursive objects first.
bool m_viewdependent
on/off for view dependent updating
void AddPropertyId(const a2dPropertyId *id)
add a a2dPropertyId to the list
a2dCanvasObjectList * GetAsCanvasVpaths(bool transform=true) const
when implemented the object without its children, is converted to
bool Start(a2dCanvasObject *object)
start here
bool m_all
to remove all or only one property on each object found.
void ConvertToLines(double aberation=0)
Convert complex segments to line segments.
base algorithm class to work on a2dCanvasObjects in groups of layers
unsigned int GetChildObjectsCount() const
get number of child objects
~a2dWalker_LayerGroup()
destructor
bool m_viewspecific
set only visible for this view
a2dCanvasObjectList m_found
pins found
static const long sm_PinCanConnectToPinClass
Pin can connect to supplied a2dPinClass.
void Initialize()
used from constructors
double m_AberPolyToArc
Polygon/polyline to Arc Maximum abberation.
int GetMode() const
get current mode
OVERLAP Intersect(const a2dBoundingBox &, double Marge=0) const
bool m_all
to remove all or only one property on each object found.
wxString m_objectname
name for object is not empty
a2dCanvasObjectList * GetAsCanvasVpaths(bool transform=true) const
when implemented the object without its children, is converted to
const a2dFill * a2dBLACK_FILL
global a2dFill stock object for BLACK filling
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.
~a2dWalker_FindAndSetCorridorPath()
destructor
a2dCanvasObjectList * GetAsPolygons()
convert to a list of a2dPolygonL and a2dPolylineL
void Initialize()
used from constructor
static const long moveLayers
move layers to target
a2dDrawing * GetRoot() const
get a2dCanvasDocument of the object.
a2dLayerViewList & GetLayerRenderArray()
get the layer render array
a2dCanvasObjectList * GetAsCanvasVpaths(bool transform=true) const
when implemented the object without its children, is converted to
a2dWalker_RemovePropertyCandoc(a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL, bool all=true)
constructor with no a2dPropertyId added yet. For that use AddPropertyId()
a2dObject * Clone(CloneOptions options, a2dRefMap *refs=NULL) const
create an exact copy of this property
wxUint16 GetLayer()
get the layer that is to be rendered
a2dWalker_CollectCanvasObjectsSet(a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL)
constructor with no a2dPropertyId added yet. For that use AddPropertyId()
bool OnNrChilds(const a2dCanvasObjectPtr &x, const a2dCanvasObjectPtr &y)
used to canvas object on number of childs order and if same on name
a2dPropertyIdList m_propertyList
properties to search for
virtual bool GeneratePinsPossibleConnections(a2dPinClass *pinClass, a2dConnectTask task, double x, double y, double margin=0)
generates pins on all possible locations where the object can be connected.
void SetDrawerStroke(const a2dStroke &stroke)
Used to set the current stroke.
bool IsIdentity(void) const
Is the matrix the identity matrix?
static const long ConvertToArcs
convert segments in polygon/polyline objects in group A to Arcs where possible
~a2dWalker_DetectSmallSegments()
destructor
virtual void SetPending(bool pending)
set this object pending for update
OVERLAP
Result of a a2dBoundingBox intersection or hittest.
static const long deleteLayers
delete layers
wxUint16 m_intersectionCondition
test m_bbox against teh object in question for this condition
bool GetThresholdDrawRectangle() const
underneath the threshold draw a rectangle instead of the real object.
a2dCanvasObjectList * GetAsCanvasVpaths(bool transform=true) const
return the arrow converted to a vector path.
a2dRectC is a centered rectangle
static const long sm_PinConnected
Pin is connected rendering mode.
a2dPin * IsConnectedTo(a2dPin *pin=a2dAnyPin) const
Return the pin to which this pin is connected.
The base class for all drawable objects in a a2dCanvasDocument.
~a2dWalker_AllowedObjects()
destructor
void SetViewDependent(a2dDrawingPart *aView, bool viewdependent, bool viewspecific=false, bool onlyinternalarea=false, bool deep=false)
set the object view dependent and maybe process all children to set these flags
static const long ConvertLinesArcs
convert shapes to seperate lines and arcs
static const long ConvertToPolygonPolylinesWithArcs
convert to simple polygons and polylines preserve arcs
wxUint16 GetPrimitiveThreshold() const
get drawing threshold
void Initialize()
used from constructors
bool GetFlag(const a2dCanvasObjectFlagsMask which) const
get specific bitflag value
void Initialize()
used from constructors
static const long ConvertToVPaths
convert shapes to vector paths
OVERLAP GetClipStatus(a2dIterC &ic, OVERLAP clipparent)
used for deciding if the object needs to be rendered against the current clipping area of the active ...
a2dCanvasObject is the base class for Canvas Objects.
std::vector< a2dLayerInfoPtr > & GetLayerIndex()
return array index on Layer
a2dCanvasObjectList m_found
objects found
virtual bool WalkTask(a2dIterC &ic, wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dCanvasDocument
a2dBoundingBox wxNonValidBbox
global non valid boundingbox to use as default argument etc.
void Initialize()
used from constructors
bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dCanvasDocument
a2dCanvasObjectList m_found
pins found
a2dCanvasObjectArrayReference is an array of a reference to any a2dCanvasObject derived class...
a2dCanvasObjectPtr m_search
object found
static const long ConvertPolylineToArcs
convert segments in polyline objects in group A to Arcs where possible
void Initialize()
used from constructor
void ConvertPolylineToArc(double aber, double Rmin, double Rmax)
a2dLayers * GetLayerSetup()
Get the layersettings for the canvas.
a2dCanvasObjectList * GetChildObjectList()
get the list where the child objects are stored in.
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dNamedPropertyStart
id for a2dWalkEvent issued from within a2dWalkerIOHandler
void Initialize()
used from constructors
void Initialize()
used from constructors
bool GetSelected() const
is the object selected flag set
void WriteEndElement(bool newLine=true)
Writes correspondending end tag for the current start tag.
double GetBboxWidth()
get width of the boundingbox in world coordinates relative to its parents
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 RemoveClassName(wxString className)
remove this classname from set.
void SetBin(bool bin)
general flag use at will.
void Initialize()
used from constructors
void EndFilterObject(a2dCanvasObject *canvasObject)
called when filter ends
bool Start(a2dCanvasObject *object)
Start traversing at object, returns true.
int ReleaseChild(a2dCanvasObject *obj, bool backwards=false, bool all=false, bool now=false, bool undoCommands=false)
remove the given object from the childobjects
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dObjectStart
id for a2dWalkEvent issued from within a2dWalkerIOHandler
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dCanvasObjectPostChild
id for a2dWalkEvent issued from within a2dWalkerIOHandler
find wire/connect pinclass, given start pinclass of start pin
wxUint64 a2dCanvasObjectFlagsMask
mask flags for a2dCanvasObject
void SetDrawerFill(const a2dFill &fill)
Used to set the current fill.
set a2dObjects property in a hierarchy of a a2dDocument
void Initialize()
to initialize a walker class, default does nothing.
Io handler to iterate through a a2dDocument.
void Initialize()
used from constructors
name of canvasobject reverse
a2dWalker_DetectSmallSegments(a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL)
constructor with no a2dPropertyId added yet. For that use AddPropertyId()
bool GetCheck() const
general flag use at will.
void Transform(const a2dAffineMatrix &tworld, const wxString &type=wxT(""), a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL, const a2dPropertyId *id=NULL)
Transform objects fitting the given filter.
bool Disconnect(a2dPin *pin=a2dAnyPin, bool forceErase=false)
wxObject * m_currentParent
parent object of current object
bool Start(a2dCanvasObject *object)
start setting the root object from here
void ConnectPins(a2dCanvasObject *parent, a2dPin *pinc, a2dPin *pinother, bool undo=false)
connect two pins which must be unconnected and at the same position
void SetRootRecursive()
set a2dDrawing to its nested a2dCanvasObject's recursive for whole tree
a2dText is an abstract base class.
a2dCanvasObjectList * wxNullCanvasObjectList
define a NON a2dCanvasObjectList
bool Start(a2dObject *object)
object to start the algorithm
virtual bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dCanvasDocument
bool GetValid() const
returns true if boundingbox is calculated properly and therefore its valid flag is set...
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.
bool m_allowClassList
to negate list of classnames to be filtered
void Initialize()
used from constructor
a2dWalker_AllowedObjects(a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL)
constructor with no a2dPropertyId added yet. For that use AddPropertyId()
a2dCanvasObjectList * GetAsCanvasVpaths(bool transform=true) const
when implemented the object without its children, is converted to
bool NameSorterReverse(const a2dCanvasObjectPtr &x, const a2dCanvasObjectPtr &y)
used to canvas object on name in reverse order
void Transform(const a2dAffineMatrix &tworld)
transform the object using the given matrix
#define forEachIn(listtype, list)
easy iteration for a2dlist
static const long ConvertToPolygonPolylinesWithoutArcs
convert to simple polygons and polylines
a2dWalker_SetPropertyToObject(a2dNamedProperty *prop)
constructor with a2dPropertyId to set
void SetCanvasObject(a2dCanvasObject *object)
set the object that is referenced
Debug handler for output the hierarchy found in a a2dDocument.
void SetMode(int mode)
default used to modify rendering
a2dEllipse centered at x,y.
polyline defined with list of points.
virtual bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dCanvasDocument
~a2dWalker_SetViewDependent()
destructor
virtual a2dCanvasObjectList * GetAsCanvasVpaths(bool transform=true) const
when implemented the object without its children, is converted to
void Initialize()
used from constructor
layer settings for a a2dCanvasDocument Holds layers settings classes
virtual bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dDocument
a2dDrawer2D * GetDrawer2D() const
get current a2dDrawer2D
#define wxStaticCast(obj, className)
The wxWindows 2.4.2 wxStaticCast is buggy. It evaluates its argument twice.
a2dVertexListPtr GetSegments()
Get the list of points ( this is not a copy! )
bool Start(a2dCanvasObject *object)
Start traversing at object, returns true.
a2dWalkerIOHandlerWithContext(a2dIterC &ic)
constructor
void SetSpecificFlags(bool setOrClear, a2dCanvasObjectFlagsMask which)
set all bit flags in object that or true in mask to true or false
static const long ConvertToPolylines
convert shapes to polylines even if polygons
Operation m_operation
id for operation
a2dWalker_CollectCanvasObjects(a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL)
constructor with no a2dPropertyId added yet. For that use AddPropertyId()
~a2dWalker_DetectSmall()
destructor
a2dCanvasObjectList * GetAsCanvasVpaths(bool transform=true) const
return text as a vector path, where text outline is converted to polyline or polygons.
virtual bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dCanvasDocument
wxUint16 GetLayer() const
Returns the layer index where this object is drawn upon.
bool m_skipStartObject
the start object itself is not checked
bool HasPins(bool realcheck=false)
are there a2dPin derived children
void Prepend(a2dCanvasObject *obj)
prepend a a2dCanvasObject to the childobjects
bool CheckMask(a2dCanvasObjectFlagsMask mask) const
Compares all flags in object to the given mask and return true is the same.
bool InGroup(wxUint16 layer)
void Initialize()
used from constructors
bool GetBin() const
general flag use at will.
bool Start(a2dObject *object, a2dCanvasObjectFuncW func)
object to start the algorithm
static const long copyLayers
copy layers to target
void RemovePins(bool NotConnected=false, bool onlyTemporary=false, bool now=false)
Remove all a2dPin children.
virtual bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dDocument
virtual bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dCanvasDocument
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dObjectEnd
id for a2dWalkEvent issued from within a2dWalkerIOHandler
static const long areaLayers
calculate area of objects
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dPropertyStart
id for a2dWalkEvent issued from within a2dWalkerIOHandler
a2dArrow is used for having line begin and ends on specific objects.
set a2dCanvasObjects flags in a hierarchy of a a2dCanvasDocument
a2dWalker_LayerGroup(a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL)
constructor with no a2dPropertyId added yet. For that use AddPropertyId()
void WriteEndAttributes(bool close=false)
"Closes" the start tag after writing all attributes (writes the ">" or "/>" bracket).
virtual a2dCanvasObject * CreateConnectObject(a2dCanvasObject *parent, a2dPin *pinThis, a2dPin *pinOther, bool undo=false) const
generates a connection object with pins and all.
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dCanvasObjectStart
id for a2dWalkEvent issued from within a2dWalkerIOHandler
void SetCheck(bool check)
general flag use at will.
virtual bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dDocument
bool RemoveRedundant(bool polygon)
line segments ( not arcs ) with same point are removed
a2dCanvasObjectList * GetAsCanvasVpaths(bool transform=true) const
when implemented the object without its children, is converted to
virtual bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dCanvasDocument
make the child which fit the mask/filter into a tree structure to a certain level ...
A 2x3 affine matrix class for 2D transformations.
a2dLayers * m_layerSetup
availability set for this layer setup
bool m_layervisible
if set, the layer must be visible
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dCanvasObjectEnd
id for a2dWalkEvent issued from within a2dWalkerIOHandler
a2dPinClass * GetPinClass() const
return the pin class of this pin
bool Start(a2dCanvasObject *object)
int m_currentDepth
contour to be used by algorithm, to decide on how deep recursing is to be.
bool DoConnect()
if return true, connection with other object on this object its pins is allowed.
virtual bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dCanvasDocument
a2dPropertyIdList m_propertyList
properties to search for
void Initialize()
used from constructors
bool NameSorter(const a2dCanvasObjectPtr &x, const a2dCanvasObjectPtr &y)
used to canvas object on name
void AddPropertyId(a2dPropertyId *id)
add a a2dPropertyId to the list
virtual double GetContourWidth() const
get the Contour width of the shape
while iterating a a2dCanvasDocument, this holds the context.
Contains graphical drawing context specific classes. a2dDrawer2D and derived classes are used for dra...
a2dCanvasObjectFlagsMask m_mask
mask required in object
void SetToObjectClone(a2dObject *obj, a2dPropertyId::SetFlags setflags=a2dPropertyId::set_none) const
Set this property to an object and clone it if neccessary.
bool Start(a2dCanvasObject *object)
a2dWalker based algorithms
virtual bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dCanvasDocument
bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dCanvasDocument
a2dWalker_RenderLayers(a2dIterC &ic)
constructor
void MapBbox(const a2dAffineMatrix &matrix)
bool m_onlyinternalarea
transform without scale for children
virtual void DrawHighLighted(a2dIterC &ic)
called by Render() if m_flags.m_HighLight is set
double m_radiusMax
Polygon/polyline to Arc Maximum radius to test.
a2dCanvasObjectList * GetAsCanvasVpaths(bool transform=true) const
when implemented the object without its children, is converted to
set< wxString > m_classnameMap
list of classnames to be filtered
void Initialize()
to initialize a walker class, default does nothing.
a2dWalker_LayerCanvasObjects(a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL)
constructor with no a2dPropertyId added yet. For that use AddPropertyId()
void Initialize()
used from constructors
virtual bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dDocument
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dPropertyEnd
id for a2dWalkEvent issued from within a2dWalkerIOHandler
a2dCanvasObjectsSet m_found
objects found
set pending flag in a drawing
bool GetRelease() const
get release flag
bool Start(a2dObject *object, a2dCanvasObjectFunc func)
object to start the algorithm
a2dWalker_RemoveHierarchy(a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL)
constructor with no a2dPropertyId added yet. For that use AddPropertyId()
a2dCanvasObjectList * GetAsCanvasVpaths(bool transform=true) const
when implemented the object without its children, is converted to
bool m_setOrClear
clear or set the flags
a2dEndsLine with begin and/or end object.
bool Start(a2dCanvasObject *object)
start at this object
double GetHitMarginWorld()
Get HitMargin in World units.
This is the base class for all kinds of property id's for a2dObject.
double GetWidth() const
returns width of the boundingbox
bool Start(a2dCanvasObject *object)
Start traversing at object, returns true.
An object of this class will update a a2dIterC with the required information.
bool ClassOfObjectOke(a2dCanvasObject *obj)
return true of object fits the classname filter
a2dWalker_DetectSmall(a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL)
constructor with no a2dPropertyId added yet. For that use AddPropertyId()
~a2dWalker_LayerCanvasObjects()
destructor
bool m_makePending
set object pending when property is removed.
a2dVertexList * GetRedundant(bool polygon, double smallest=0)
line segments ( not arcs ) with same point are returned
a2dLayerGroup m_groupA
group A layers operand
bool m_layerselectable
if set, the layer must be selectable
static const a2dCanvasObjectFlagsMask NoRenderCanvasObject
void SetClipStatus(OVERLAP status)
set the clipping withing the current view for the last added object in context
void SetTarget(wxUint16 targetlayer)
set the layer where the result will be placed
bool Start(a2dCanvasObject *object, bool setTo)
start removing properties from the object given, and down.
bool Translate(double x, double y)
Translate by dx, dy:
bool Start(a2dCanvasObject *object)
start here
bool m_useCheck
if set a2dObject are only walked if not m_check is set
double GetBboxHeight()
get height of the boundingbox in world coordinates relative to its parents
~a2dWalkerIOHandlerWithContext()
destructor
a2dCanvasObjectFlagsMask m_which
mask for which flags to set
a2dBoundingBox m_bbox
object must be in this box if it the box is valid
find normal object pinclass, given Connect/wire pinclass
bool Start(a2dCanvasObject *object)
called from within a2dCanvasDocument
bool OnNrChildsReverse(const a2dCanvasObjectPtr &x, const a2dCanvasObjectPtr &y)
used to canvas object on number of childs reverse order and if same on name
virtual bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dCanvasDocument
a2dWalker_FindCanvasObject(a2dCanvasObject *toSearch)
constructor with no a2dPropertyId added yet. For that use AddPropertyId()
a2dCanvasObject * IsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
If the position (x,y) is within the object return this.
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
bool ObjectOke(a2dCanvasObject *obj)
return true if object fits the filter
bool Start(a2dIterC &ic, a2dCanvasObject *object, bool ItsChildren=true)
~a2dWalker_RenderLayers()
destructor
void Initialize()
used from constructors
virtual bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dCanvasDocument
virtual bool MayConnectTo(a2dPin *connectto)
Is given pin allowed to connect to this pin.
virtual bool RemoveProperty(const a2dPropertyId *id, bool all=true)
This function is called by a2dPropertyId to remove a property from the list.
virtual void Initialize()
to initialize a walker class, default does nothing.
static const long sm_PinUnConnected
Pin is not connected rendering mode.
a2dDrawingPart * m_drawingPart
visible on this drawingPart
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.
bool FilterObject(a2dCanvasObject *canvasObject)
apply object filter
bool Start(a2dCanvasObject *object)
called from within a2dCanvasDocument
Number of childs reverse.
double m_radiusMin
Polygon/polyline to Arc Minimum radius to test.
basetype GetPropertyValue(const a2dObject *obj) const
Get the property value in obj.
static const long sm_PinCannotConnect
Pin can NOT be connected rendering mode.
a2dCanvasGlobal * a2dCanvasGlobals
global a2dCanvasGlobal to have easy access to global settings
a2dCanvasObjectFlagsMask m_mask
object must fit this mask.
a2dCanvasObject for a Vector Path
size_t GetNumberOfSegments()
get the number of points in the pointlist
set the a2dCanvasObject's a2dDrawing root recursive
virtual a2dCanvasObjectList * GetAsPolygons(bool transform=true) const
convert to a list of polygons.
a2dDrawingPart * m_drawingPart
which view to set view dependent
a2dCanvasObjectList * ConvertToPolygons(a2dCanvasObject *canvasobject, bool transform)
static const long ConvertPolygonToArcs
convert segments in polygon/polyline with width objects in group A to Arcs where possible ...
Walker taking iterative context into account.
a2dWalker_FilterCanvasObjects(a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL)
constructor with no a2dPropertyId added yet. For that use AddPropertyId()
virtual a2dCanvasObjectList * GetAsPolylines(bool transform=true) const
convert to a list of polylines.
static const a2dCanvasObjectFlagsMask ALL
void AddClassName(wxString className)
add to classname to set of classes to be filtered.
wxRect GetAbsoluteArea(a2dIterC &ic, int inflate=2)
Get absolute occupied area in the device coordinates.
virtual bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dCanvasDocument
a2dPropertyIdList m_propertyList
if not empty, object must have the properties in this list
bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dCanvasDocument
void Initialize()
used from constructor
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
const a2dAffineMatrix & GetTransform() const
Get the accumulated transform up to and including m_lworld of the current object. ...
a2dWalker_FindAndSetCorridorPath(a2dCanvasObject *findObject)
constructor
virtual void SetLayer(wxUint16 layer)
set layer index where this object is drawn upon.
document walking to select a2dCanvasObject by filtering against several constraints.
void AddPropertyId(a2dPropertyId *id)
add a a2dPropertyId to the list
a2dCanvasObjectList * GetAsCanvasVpaths(bool transform=true) const
when implemented the object without its children, is converted to
virtual bool IsConnect() const
return true, if this object is used to connect other object's using rubberband like structures...
void SetRenderChildDerived(bool value)
when set child object in derived a2dCanvasObject are rendered, else only the object itself...
wxUint16 m_target
result into this layer
A pointer class, that automatically calls SmrtPtrOwn/SmrtPtrRelease.
void Initialize()
to initialize a walker class, default does nothing.
void SetStopWalking(bool stopWalking)
to further recursion, e.g. in a2dObject::Walker()
bool Start(a2dObject *object)
start removing properties from the object given, and down.
OVERLAP GetParentClipStatus() const
what is the clipping withing the current view for the second last added object in context ...
bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dCanvasDocument
double DeviceToWorldXRel(double x) const
convert x relative from device to world coordinates
find normal object pinclass, given Connect/wire pinclass
structure to give as parameter to member functions of a2dCanvasObject
a2dBoundingBox & GetBbox()
get boundingbox in world coordinates exclusive stroke width relative to its parent ...
Contain one drawing as hierarchical tree of a2dCanvasObject's.
bool m_selectedOnlyB
work only on selected object in group B
a2dCanvasObjectList * ConvertToVpath(a2dCanvasObject *canvasobject, bool transform)
bool m_selectedOnlyA
work only on selected object in group A
static const long RemoveRedundant
remove redundant segment
find a2dCanvasObjects in a hierarchy of a a2dCanvasDocument
wxInt64 GetUniqueSerializationId() const
return a unique id for this object
a2dEllipticArc centered at x,y
a2dDrawing * m_root
document to set
static const long sm_PinCanConnect
Pin can be connected rendering mode.
a2dWalker_SetViewDependent(a2dDrawingPart *drawingPart, bool viewdependent, bool viewspecific=false, bool onlyinternalarea=false)
constructor
general canvas module declarations and classes