wxArt2D
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members

Each a2dCanvasView needs to have a a2dCanvasDocument set in order to render data. More...

#include <candoc.h>

Inheritance diagram for a2dCanvasDocument:
Inheritance graph
[legend]
Collaboration diagram for a2dCanvasDocument:
Collaboration graph
[legend]

Public Member Functions

 a2dCanvasDocument ()
 Construct a a2dCanvasDocument to store a complete drawing in. More...
 
 ~a2dCanvasDocument ()
 destructor
 
 a2dCanvasDocument (const a2dCanvasDocument &other)
 like it to be protected, but this does not work with wxList macros More...
 
void CreateCommandProcessor ()
 create a command processor and set it for the document. More...
 
a2dDrawingGetDrawing () const
 get the root object, which holds the objects in the document.
 
void SetDrawing (a2dDrawing *newRoot)
 set new root object ( may not ne NULL )
 
void SetDescription (const wxString &desc)
 Sets a description of the document. More...
 
wxString & GetDescription ()
 Returns the description of the document. More...
 
void SetLibraryName (const wxString &libraryname)
 to name the document as a library (independent of a path and filename )
 
wxString & GetLibraryName ()
 Get name the document as a library (independent of a path and filename )
 
void SetVersion (wxString version)
 set version of library or document
 
wxString GetVersion ()
 get version of library or document
 
virtual void DeleteContents ()
 delete all object in this document (also nested groups etc.)
 
bool WriteSVG (a2dCanvasView *drawer, const wxString &filename, a2dCanvasObject *top, double Width, double Height, wxString unit)
 write as SVG to a file starting at given object More...
 
virtual a2dDocumentInputStreamLoadObject (a2dDocumentInputStream &stream, a2dIOHandlerStrIn *handler)
 load form a file containing the a2dCanvas specific XML called CVG format
 
void Load (wxObject *parent, a2dIOHandlerXmlSerIn &parser)
 used by CVG parser More...
 
bool Load (const wxString &filename, a2dIOHandlerStrIn *handler)
 load document from a file with the given filename and given parser type
 
bool SaveLayers (const wxString &filename)
 save layer settings to CVG file
 
bool LoadLayers (const wxString &filename)
 load layers from another file More...
 
virtual void UpdateLoadedLayerSetup ()
 Update a loaded layer setup. More...
 
a2dDocumentOutputStreamSaveObject (a2dDocumentOutputStream &stream, a2dIOHandlerStrOut *handler)
 save as the a2dCanvas specific XML called CVG format
 
void Save (wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dObjectList *towrite)
 called from a2dIOHandlerXmlSerOut after a SaveObject. More...
 
void Save (a2dIOHandlerCVGOut &out, a2dCanvasObject *start=0)
 called from a2dIOHandlerCVGOut after a SaveObject. More...
 
bool Save (const wxString &filename, a2dIOHandlerStrOut *handler) const
 save document to a file with the given name and given output writer type
 
void Update (a2dCanvasObject::UpdateMode mode)
 update all pending objects in the document
 
void SetLayerSetup (a2dLayers *layersetup)
 set the layersettings for the canvas. More...
 
a2dLayersGetLayerSetup ()
 Get the layersettings for the canvas. More...
 
void SetMultiRoot (bool multiRoot=true)
 Set true if the document read from a file did not have on erootobject but several. More...
 
bool GetMultiRoot ()
 
a2dCameleonGetTopCameleon ()
 what is the top a2dcameleon in the drawing to display after opening a document, when m_show is not set.
 
void SetTopCameleon (a2dCameleon *root)
 what is the top a2dcameleon in the drawing to display after opening a document, when m_show is not set.
 
a2dCanvasObjectGetShowObject ()
 what to display when document is openened
 
void SetShowObject (a2dCanvasObject *show)
 what to display when document is openened
 
double GetUnitsAccuracy ()
 this is the number that defines the number of decimal places in the fraction More...
 
void SetUnitsAccuracy (double accuracy)
 this is the number that defines the number of decimal places in the fraction More...
 
double GetUnitsScale ()
 this is the number that defines the physical dimension in meters / inch/ etc. More...
 
void SetUnitsScale (double scale)
 this is the number that defines the physical dimension in meters / inch/ etc. More...
 
double GetNormalizeScale ()
 Normalize objects ( defined in coordinates -1 to 1 ranges ) will be multiplied by this factor. More...
 
void SetNormalizeScale (double scale)
 see GetNormalizeScale()
 
wxString GetUnits ()
 this string defines the unit e.g. meters / inch/ etc. More...
 
void SetUnits (const wxString &unitString)
 this string defines the unit e.g. meters / inch/ etc. More...
 
void SetAccessTime (const wxDateTime &datatime)
 Sets the time of last access to this doc. More...
 
wxDateTime & GetAccessTime ()
 Returns the time of last access.
 
wxDateTime & GetInternalChangedTime ()
 gives time when a change was made to the document which may effect rendering More...
 
 DECLARE_DYNAMIC_CLASS (a2dCanvasDocument)
 
- Public Member Functions inherited from a2dDocument
 a2dDocument (a2dDocument *parent=(a2dDocument *) NULL)
 Constructor. More...
 
 ~a2dDocument ()
 destructor
 
 a2dDocument (const a2dDocument &other)
 constructor with other document
 
void SetFilename (const wxFileName &filename, bool notifyViews=false)
 Sets the filename for this document. Usually called by the framework. More...
 
wxFileName GetFilename () const
 Get the file name in use for this document.
 
void SetTitle (const wxString &title, bool notifyViews=false)
 Sets the title for this document. More...
 
wxString GetTitle () const
 Returns the title for this document.
 
void SetDocumentTypeName (const wxString &name)
 Sets the document type name for this document. See the comment for documentTypeName.
 
wxString GetDocumentTypeName () const
 Gets the document type name of this document. See the comment for documentTypeName.
 
bool GetDocumentSaved () const
 Returns if the document was saved after a modification.
 
bool IsDocumentSaved () const
 Alias for a2dDocument::GetDocumentSaved.
 
void SetDocumentSaved (bool saved=true)
 Sets the document saved flag. More...
 
bool IsClosed ()
 returns true when document is closed or busy closing. More...
 
bool Close (bool force)
 Closes the document if not vetod. More...
 
bool Save ()
 Saves the document by sending a a2dDocumentEvent ::wxEVT_SAVE_DOCUMENT event. More...
 
bool SaveAs (const wxFileName &fileTosaveTo=wxFileName(wxT("")), a2dDocumentFlagMask flags=a2dREFDOC_NON)
 Tries to save the document by sending a a2dDocumentEvent ::wxEVT_SAVEAS_DOCUMENT event. More...
 
bool Export (a2dDocumentTemplate *doctemplate, const wxFileName &fileTosaveTo=wxFileName(wxT("")), a2dDocumentFlagMask flags=a2dREFDOC_NON)
 Tries to save the document by sending a a2dDocumentEvent ::wxEVT_EXPORT_DOCUMENT event. More...
 
bool Import (a2dDocumentTemplate *doctemplate, const wxFileName &fileToImport=wxFileName(wxT("")), a2dDocumentFlagMask flags=a2dREFDOC_NON)
 Tries to read a file into the document by sending a a2dDocumentEvent ::wxEVT_IMPORT_DOCUMENT event. More...
 
virtual bool Revert ()
 Normally should undo all changes by rereading the file again. More...
 
void SetLastError (a2dError lastError)
 can be set by a2dIOHandler's by e.g LoadObject(). More...
 
a2dError GetLastError ()
 is set by a2dIOHandler's and is tested by LoadObject(). More...
 
void Save (a2dIOHandlerXmlSerOut &out, wxObject *start=NULL)
 called from a2dIOHandlerXmlSerOut after a SaveObject. More...
 
virtual int SaveModifiedDialog (bool canCancel=true)
 dialog when the user needs to confirm saving a document More...
 
a2dCommandProcessorGetCommandProcessor () const
 Returns a pointer to the command processor associated with this document.
 
void SetCommandProcessor (a2dCommandProcessor *proc)
 Sets the command processor to be used for this document. More...
 
virtual bool Draw (wxDC &context)
 Might be used to draw the contents of a document to a a2dView using a wxDc as the drawing context. More...
 
bool IsModified () const
 Has the document been modified.
 
void Modify (bool mod)
 set the docuent as modified or not More...
 
void AskSaveWhenOwned (bool askSaveWhenOwned)
 Ask to save when document is modified and last view is closed? More...
 
virtual void UpdateAllViews (a2dView *sender=(a2dView *) NULL, unsigned int hint=a2dVIEW_UPDATE_ALL, wxObject *objecthint=(wxObject *) NULL)
 sent Update events to all a2dView which display or use this document. More...
 
void ReportViews (a2dViewList *allviews)
 sents a ::wxEVT_REPORT_VIEWS to all views, via the a2dDocumentCommandProcessor. More...
 
void EnableAllViews (bool enable, a2dView *sender=(a2dView *) NULL)
 calls Enable( true/false ) for each view. More...
 
void DisConnectAllViews ()
 Disconnect a2dView's using this document. More...
 
a2dDocumentTemplateGetDocumentTemplate () const
 Gets a2dDocumentTemplate pointer which was used to create the a2dView.
 
void SetDocumentTemplate (a2dDocumentTemplate *temp)
 Set a2dDocumentTemplate pointer.
 
wxString GetPrintableName () const
 Get title, or filename if no title, else [unnamed].
 
virtual wxWindow * GetAssociatedWindow () const
 Returns a window that can be used as a parent for document-related dialogs. Override if necessary.
 
void SetModificationTime (const wxDateTime &datatime)
 Sets a time of last modification. More...
 
wxDateTime & GetModificationTime ()
 Returns the time of last modification when the document was saved. More...
 
- Public Member Functions inherited from a2dObject
virtual bool ProcessEvent (wxEvent &event)
 
bool SearchDynamicEventTable (wxEvent &event)
 
void Connect (int winid, int lastId, int eventType, wxObjectEventFunction func, wxObject *userData=(wxObject *) NULL, wxEvtHandler *eventSink=(wxEvtHandler *) NULL)
 
bool Disconnect (int winid, int lastId, wxEventType eventType, wxObjectEventFunction func=NULL, wxObject *userData=(wxObject *) NULL, wxEvtHandler *eventSink=(wxEvtHandler *) NULL)
 
void ProcessConnectedEvent (wxEvent &event)
 wxCHECK_VERSION(2,9,0) More...
 
void ConnectEvent (wxEventType type, wxEvtHandler *eventSink)
 
bool DisconnectEvent (wxEventType type, wxEvtHandler *eventSink)
 
bool DisconnectEventAll (wxEvtHandler *eventSink)
 Remove all dynamic events in classA, going to classB (eventSink) More...
 
 a2dObject ()
 constructor
 
virtual ~a2dObject ()
 destructor
 
void operator= (const a2dObject &other)
 assignment operator
 
int GetOwnedBy ()
 like it to be protected, but this does not work with wxList macros More...
 
virtual a2dObjectSetNonDynamic ()
 Call to mark this object as non-dynamic (static/local/auto) More...
 
void CheckReferences ()
 Check zero reference count and delete if count is 0. More...
 
a2dObjectClone (CloneOptions options, a2dRefMap *refs=NULL) const
 create an exact copy of this property
 
 a2dObject (const a2dObject &other, CloneOptions options, a2dRefMap *refs)
 
virtual wxString GetName () const
 Returns the name of this object, if no name is given the internal id will be returned. More...
 
virtual void SetName (const wxString &name)
 Creates the a2dStringProperty PROPID_Name. More...
 
virtual bool IsTemporary_DontSave () const
 Check if this is a temporary object, which should not be saved.
 
void SaveAsDocument (a2dIOHandlerXmlSerOut &out)
 Save this object and all below as an XML document. More...
 
void LoadFromDocument (a2dIOHandlerXmlSerIn &parser)
 Load this object and all below from an XML document. More...
 
wxInt64 GetUniqueSerializationId () const
 return a unique id for this object More...
 
virtual bool AlwaysWriteSerializationId () const
 If true, always write an id. More...
 
virtual bool LinkReference (a2dObject *other)
 link a reference in the object to the given value More...
 
virtual void ResolveInform ()
 inform an object that reference resolution was done More...
 
void Walker (wxObject *parent, a2dWalkerIOHandler &handler)
 This is used to recursively walk through an object tree.
 
void SetCheck (bool check)
 general flag use at will. More...
 
bool GetCheck () const
 general flag use at will.
 
void SetRelease (bool value)
 set release flag More...
 
bool GetRelease () const
 get release flag More...
 
a2dAutoZeroPtr< a2dObject > ** GetAutoZeroPtrList ()
 return the list head pointer for autozero pointers to this object More...
 
 DECLARE_PROPERTIES ()
 
a2dNamedPropertyGetProperty (const a2dPropertyId *propertyId, a2dPropertyId::Flags flags=a2dPropertyId::flag_none) const
 get property on this object More...
 
void SetProperty (a2dNamedProperty *propertyHolder, a2dPropertyId::SetFlags flags=a2dPropertyId::set_none)
 Set the property to the this object. More...
 
void SetProperty (const a2dNamedProperty &propertyHolder, a2dPropertyId::SetFlags flags=a2dPropertyId::set_none)
 Set the property to the this object and if enabled, to all childs and object members. More...
 
virtual a2dNamedPropertyFindProperty (const a2dPropertyId *id, a2dPropertyId::Flags flags=a2dPropertyId::flag_none)
 Find a dynamic property with given id in the property list. More...
 
virtual const a2dNamedPropertyFindProperty (const a2dPropertyId *id, a2dPropertyId::Flags flags=a2dPropertyId::flag_none) const
 Find a dynamic property with given id in the property list. More...
 
virtual bool HasProperty (const a2dPropertyId *id, const wxString &stringvalue=wxEmptyString) const
 Check if the object has a property with given id and string representation. More...
 
virtual void OnPropertyChanged (const a2dPropertyId *id)
 This function is called after a property changed. More...
 
virtual bool EditProperties (const a2dPropertyId *id, bool withUndo=true)
 edit properties of the object More...
 
void TakeOverProperties (a2dObject *from, a2dPropertyIdList *listOfIds)
 Properties in the id list are taken from the given object, en set to this. More...
 
wxURI GetURI () const
 quick way to get to PROPID_URI property More...
 
void SetURI (const wxURI &url)
 quickly set a property PROPID_URI More...
 
const a2dNamedPropertyListGetPropertyList () const
 Get the Property List. More...
 
bool HasDynamicProperties () const
 test if there are dynamic properties in the m_propertylist
 
virtual bool RemoveProperty (const a2dPropertyId *id, bool all=true)
 This function is called by a2dPropertyId to remove a property from the list. More...
 
void RemoveTemporaryProperties ()
 remove all temporary properties
 
virtual bool AddProperty (a2dNamedProperty *property)
 This function is called by a2dPropertyId to add a property to the list. More...
 

Public Attributes

wxString m_libraryname
 name of library or document
 
wxString m_description
 description for document
 
wxString m_version
 version of library or document
 

Static Public Attributes

static const a2dSignal sig_layersetupChanged = wxNewId()
 layer info changed id sent around when m_layersetup is changed.
 
static const a2dSignal sig_changedLayer = wxNewId()
 when an object is removed from a layer,
 
- Static Public Attributes inherited from a2dObject
static a2dPropertyIdBoolPROPID_Check = NULL
 used for linking multiple referenced objects when serializing
 
static a2dPropertyIdUriPROPID_URI = NULL
 attach an URL to the object
 
static a2dPropertyIdStringPROPID_Name = NULL
 Name property, to return name of this object.
 
static a2dPropertyIdVoidPtrPROPID_autozeroptrlist = NULL
 
static const a2dSignal sm_Edit_properties = wxNewId()
 edit properties event, see EditProperties()
 

Protected Member Functions

void OnIdle (wxIdleEvent &event)
 Called by ProcessEvent(wxEvent& event) of document. More...
 
void OnOpenDocument (a2dDocumentEvent &event)
 uses wxBufferedInputStream instead of a2dDocumentInputStream
 
void OnDoEvent (a2dCommandProcessorEvent &event)
 track modification of document
 
void OnRedoEvent (a2dCommandProcessorEvent &event)
 track modification of document
 
void OnUndoEvent (a2dCommandProcessorEvent &event)
 track modification of document
 
void OnChangeDrawings (a2dDrawingEvent &event)
 called when a drawing in a document did change.
 
a2dObjectDoClone (a2dObject::CloneOptions options, a2dRefMap *refs) const
 Clone document.
 
void DoSave (a2dIOHandlerCVGOut &out, a2dCanvasObjectList *towrite)
 do not use directly, part of CVG format writing
 
- Protected Member Functions inherited from a2dDocument
void OnCreateDocument (a2dDocumentEvent &event)
 default handler for ::wxEVT_CREATE_DOCUMENT, Called after creation of document from a template. More...
 
void OnSaveDocument (a2dDocumentEvent &event)
 Called by wxWindows when a file needs to be saved. More...
 
void OnSaveAsDocument (a2dDocumentEvent &event)
 default handler for a2dDocumentEvent of type ::wxEVT_SAVEAS_DOCUMENT More...
 
void OnOpenDocument (a2dDocumentEvent &event)
 load a document from a file into this document More...
 
void OnNewDocument (a2dDocumentEvent &event)
 called after creating a new document from a template , in order to initialize it. More...
 
void OnCloseDocument (a2dCloseDocumentEvent &event)
 called when document is closed More...
 
void OnCloseView (a2dCloseViewEvent &event)
 Intercept to do cleanup/veto closing of a view. More...
 
void OnRemoveView (a2dDocumentEvent &event)
 what to do when a view using this document will stop using it. More...
 
void OnAddView (a2dDocumentEvent &event)
 what to do when a view starts using this document
 
void OnExportDocument (a2dDocumentEvent &event)
 The default handler for ::wxEVT_EXPORT_DOCUMENT. More...
 
void OnImportDocument (a2dDocumentEvent &event)
 The default handler for ::wxEVT_IMPORT_DOCUMENT. More...
 
- Protected Member Functions inherited from a2dObject
virtual bool DoIgnoreIfNotMember (const a2dPropertyId *id) const
 used to decide if a property shall be ignored, if it is not a member More...
 
virtual void DoWalker (wxObject *parent, a2dWalkerIOHandler &handler)
 iterate over this object and its children More...
 
virtual void DoSave (wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
 Save settings.
 
virtual void DoLoad (wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
 Load settings.
 

Protected Attributes

a2dDrawingPtr m_drawing
 start a2dCanvasObject containing all primitives
 
a2dSmrtPtr< a2dCameleonm_main
 what is the root a2dcameleon in the drawing to display after opening a document, when m_show is not set.
 
a2dCanvasObjectPtr m_show
 what to display when document is openened
 
a2dSmrtPtr< a2dLayersm_layersetup
 setup for layers in this document More...
 
bool m_multiRoot
 multi root document
 
double m_units_accuracy
 how many decimal places in fraction are valid
 
double m_units_scale
 scaling factor (how many "m_units_measure" is one unit)
 
double m_normalize_scale
 normalization factor to scale normalized objects.
 
wxString m_units
 unit (e.g. Meters Inch Microns etc.)
 
wxString m_units_measure
 measuring unit (e.g. Meters Inch Microns etc.)
 
wxDateTime m_accesstime
 when was the document last accessed.
 
wxDateTime m_changedInternalAccesstime
 gives time when a change was made to the document which may effect rendering More...
 
- Protected Attributes inherited from a2dDocument
bool m_askSaveWhenOwned
 Set when Owners become zero and document will be deleted. May also be overruled by user.
 
wxFileName m_documentFile
 Filename associated with this document ("" if none).
 
wxDateTime m_modificationtime
 last modification time when this document was stored.
 
wxString m_documentTitle
 Document title. More...
 
wxString m_documentTypeName
 The document type name given to the a2dDocumentTemplate constructor,. More...
 
a2dDocumentTemplatePtr m_documentTemplate
 A pointer to the template from which this document was created.
 
long m_documentModified
 modified flag
 
a2dDocumentm_documentParent
 parant document if set.
 
a2dSmrtPtr< a2dCommandProcessorm_commandProcessor
 A pointer to the command processor associated with this document.
 
bool m_savedYet
 saved flag
 
bool m_isClosed
 set true when document is closed or when busy closing document.
 
wxUint32 m_id
 This identifies the document in event processing. More...
 
a2dError m_lastError
 error code used when LoadObject is returning.
 
- Protected Attributes inherited from a2dObject
a2dNamedPropertyList m_propertylist
 properties
 
int m_refcount
 how many references to this object do exist
 
bool m_check: 1
 used for linking multiple referenced objects when serializing
 
bool m_release: 1
 when set object is treated as being deleted, and wil be deleted in idle time.
 
bool m_recursion_active: 1
 this is used as a recursion stopper
 
bool m_pendingDisconnects: 1
 
unsigned int m_iteratorCount
 
a2dAutoZeroPtr< a2dObject > * m_autozeroptrlist
 this is a list of all a2dAutoZeroPtr object pointing to this object
 

Additional Inherited Members

- Public Types inherited from a2dObject
enum  CloneOptions {
  clone_members = 0x00000001, clone_properties = 0x00000002, clone_childs = 0x00000004, clone_unused = 0x00000008,
  clone_setoriginal = 0x00000010, clone_seteditcopy = 0x00000020, clone_noReference = 0x00000040, clone_noCameleonRef = 0x00000080,
  clone_toDrag = 0x00000100, clone_flat = 0x00000000, clone_deep = clone_members | clone_properties | clone_childs
}
 options for cloning More...
 
typedef a2dAutoZeroPtr< a2dObjectTAutoZeroPtrListClass
 this is needed inside the smart pointer template code
 
- Protected Types inherited from a2dObject
enum  { refcount_nondynamic = 0x76543210 }
 special refcount value for non-dynamic objects
 

Detailed Description

Each a2dCanvasView needs to have a a2dCanvasDocument set in order to render data.

Several a2dCanvasView objects can share the same a2dCanvasDocument.
The a2dCanvasDocument has one top a2dCanvasObject, called m_drawing.
All other a2dCanvasObject's are added as children to this root object.
The docuemnt also contains the layer settings for the canvas objects to be rendered.
The a2dCanvasDocument is derived from a2dDocument, and it is used to store a hierarchy of a2dCanvasObject's.
The updating of modified a2dCanvasObject's is also organized as part of this class. One can load a canvas document from
a file, and save it to a file, in the CVG format. But other formats are possible, via the document its a2dDocumentTemplate and
associated a2dIOHandlers.

Rendering a a2dCanvasDocument is started at a given a2dCanvasObject,
which needs to be part of the data structure below the a2dCanvasDocument.
Since a2dCanvasDocument owns a a2dCanvasObject as root, rendering the complete document will start at the m_drawing.
But any nested child a2dCanvasObject can be used to start rendering, and only that object and it children will be displayed
on the a2dCanvasView ( and a2dCanvas which is the display window ).
The a2dCanvasObject to be displayed on a certain a2dCanvasView is maintained in the
a2dCanvasView object. It can be different for all a2dCanvasView objects sharing the same a2dCanvasDocument.

a2dCanvasDocument senets update events when a2dCanvasObject have changed internal. The a2dView's using the document
are intercepting the update events, and react by updating the data that they display. For a a2dCanvasView this means
redrawing those parts that have changed.

Any nested child from a a2dCanvasDocument Object can be displayed on several a2dCanvasView Objects at the same time.
The child displayed does not have to be the same on each a2dCanvasView.
The active a2dCanvasView is used to render and convert coordinates from world to device.
So it is important to set the active a2dCanvasView based on the a2dCanvasView that has the focus
or is scrolled etc. This is normally done within a2dCanvasView when appropriate.


\remark Use a2dDocumentTemplate's to get the type of the file, where this data was read from.
        based on this the document can be saved in the same type as read from.
See Also
a2dCanvasView
a2dCanvas
wxWorldCanvas
a2dCanvasObject

Definition at line 374 of file candoc.h.

Constructor & Destructor Documentation

a2dCanvasDocument::a2dCanvasDocument ( )

Construct a a2dCanvasDocument to store a complete drawing in.

This class contains nested a2dCanvasObject's and other drawing object derived from a2dCanvasObject's. The class itself is derived from a2dDocument. All objects are stored are as childs of the m_drawing. A complete drawing is stored here, and displaying the drawing, is done by setting a pointer to this a2dCanvasDocument for a a2dCanvasView derived class. Every change inside the wxCavasObject's stored inside this class, will report themselfs as pending to an instance of this class. The a2dCanvasView classes, having this instance of a2dCanvasDocument set, will be updated from the document via update events. a2dCanvasObject that are changed or set pending. Those pending objects are reported to the document also. In Idle time the pending objects are redrawn on the a2dCanvasView's that display the document. The same a2dCanvasDocument can be displayed on reveral a2dCanvasView's at the same time. And therefore a pending a2dCanvasObject maybe be (re)displayed on several a2dCanvasView's also. The a2dCanvasObjects stored in a a2dCanvasDocument, will have their m_root member set in order to get to the a2dCanvasDocument in which they are stored. Through the a2dCanvasDocument they will be able to reach the a2dCanvasView class that is currently active. The a2dCanvasView class is set to the document when needed on a higher level. e.g. when rendering a a2dCanvasDocument. This way each a2dCanvasObject stored inside the a2dCanvasDocument, can draw itself on the active a2dCanvasView. The a2dCanvasView in this case can be seen as a sort of drawing context. Indirectly a a2dCanvasView can use a2dCanvas as the window/device to draw up on. Another type of a2dCanvasView can draw to a bitmap, image or printer device.

Remarks
The initially layer setup is defined my a2dCanvasGlobal::GetLayerSetup
See Also
SetLayerSetup for an example for introduce your own layers

Definition at line 619 of file candoc.cpp.

a2dCanvasDocument::a2dCanvasDocument ( const a2dCanvasDocument other)

like it to be protected, but this does not work with wxList macros

constructor with other document

Definition at line 658 of file candoc.cpp.

Member Function Documentation

void a2dCanvasDocument::CreateCommandProcessor ( )
virtual

create a command processor and set it for the document.

If available the existing commandprocessor will be deleted. A new CommandProcessor will be created and set for the document.

Override if you need a more application specific commandhandler.

Reimplemented from a2dDocument.

Definition at line 698 of file candoc.cpp.

wxString& a2dCanvasDocument::GetDescription ( )
inline

Returns the description of the document.

See Also
SetDescription
Returns
the description

Definition at line 438 of file candoc.h.

wxDateTime& a2dCanvasDocument::GetInternalChangedTime ( )
inline

gives time when a change was made to the document which may effect rendering

Comparing this time in a dialogs its own update time, one can easily keep them up to date.

e.g. set in SetUpdatesPending()

Definition at line 660 of file candoc.h.

a2dLayers* a2dCanvasDocument::GetLayerSetup ( )
inline

Get the layersettings for the canvas.

A default Layer Setting is taken from a2dCanvasGlobal.

See Also
a2dCanvasGlobal for central layers settings, used for initializing a a2dCanvasDocument

Definition at line 555 of file candoc.h.

bool a2dCanvasDocument::GetMultiRoot ( )
inline
See Also
SetMultiRoot()

Definition at line 566 of file candoc.h.

double a2dCanvasDocument::GetNormalizeScale ( )
inline

Normalize objects ( defined in coordinates -1 to 1 ranges ) will be multiplied by this factor.

Libraries containing object which are defined in normalized coordinates, need to be multiplied by a certain factor before they can be added to a document. This factor defines by how much that should be done. As an example a libary containing arrow objects for placing at the end of a2dEndsLine objects, will use this factor.

Definition at line 618 of file candoc.h.

wxString a2dCanvasDocument::GetUnits ( )
inline

this string defines the unit e.g. meters / inch/ etc.

numbers used for storing length or position or always stored as doubles. The real dimension is: (anynumber) * GetUnitsScale() * GetUnits()

Remarks
the value may also be "trees" "pixels" or "people" etc.
conversion to other units is not just simply changing this string. You must Change the SetUnitsScale(double) or really scale the data itself.

Definition at line 632 of file candoc.h.

double a2dCanvasDocument::GetUnitsAccuracy ( )
inline

this is the number that defines the number of decimal places in the fraction

when writing numbers to a file. When reading a file, this number is set to the accuracy information available in the file. 1/GetUnitsAccuracy() == 100 means 2 decimal places will be written, or the data just read is accurate to this number of decimal places.

Remarks
GetUnitsAccuracy() can also be > 1

Definition at line 586 of file candoc.h.

double a2dCanvasDocument::GetUnitsScale ( )
inline

this is the number that defines the physical dimension in meters / inch/ etc.

numbers used for storing length or position or always stored as doubles. The real dimension is: (anynumber) * GetUnitsScale() * GetUnits()

Definition at line 601 of file candoc.h.

void a2dCanvasDocument::Load ( wxObject *  parent,
a2dIOHandlerXmlSerIn parser 
)
virtual

used by CVG parser

Remarks
do not use directly

Reimplemented from a2dDocument.

Definition at line 926 of file candoc.cpp.

bool a2dCanvasDocument::LoadLayers ( const wxString &  filename)

load layers from another file

Only the layer settings are read from the file and put in place of the current layers settings in the document.

Definition at line 1010 of file candoc.cpp.

void a2dCanvasDocument::OnIdle ( wxIdleEvent &  event)
protected

Called by ProcessEvent(wxEvent& event) of document.

Event processing is called by wxView and therefore a2dCanvasView. In a a2dDocumentCommandProcessor controller application wxDocChildFrame and wxDocParentFrame redirect events to wxView and a2dDocumentCommandProcessor. In a non a2dDocumentCommandProcessor the a2dCanvas is calling ProcessEvent(wxEvent& event) of document. Onidle updates all drawers if pending updates are available

Definition at line 1268 of file candoc.cpp.

void a2dCanvasDocument::Save ( wxObject *  parent,
a2dIOHandlerXmlSerOut out,
a2dObjectList towrite 
)
virtual

called from a2dIOHandlerXmlSerOut after a SaveObject.

Parameters
parentparent object from which Save was called
outCVG io handler
towriteobject to write later

Reimplemented from a2dDocument.

Definition at line 1173 of file candoc.cpp.

void a2dCanvasDocument::Save ( a2dIOHandlerCVGOut out,
a2dCanvasObject start = 0 
)

called from a2dIOHandlerCVGOut after a SaveObject.

Parameters
outCVG io handler
startstart wrting from this object

Definition at line 1205 of file candoc.cpp.

void a2dCanvasDocument::SetAccessTime ( const wxDateTime &  datatime)
inline

Sets the time of last access to this doc.

Parameters
datatimenew last access time

Definition at line 649 of file candoc.h.

void a2dCanvasDocument::SetDescription ( const wxString &  desc)
inline

Sets a description of the document.

A description may describe the content of this document or contain keywords etc. The default value is "a2dCanvasDocument generated by wxArt2D".

Parameters
descdescription of the document

Definition at line 430 of file candoc.h.

void a2dCanvasDocument::SetLayerSetup ( a2dLayers layersetup)

set the layersettings for the canvas.

A default Layer Setting is created in the constructor a2dCanvasDocument::a2dCanvasDocument

An example how to set another layer setup

// Clone the current layer setup
a2dLayers* docLayers = doc->GetLayerSetup()->Clone( bool deep = true );
// Create a new layer with an index above the predefined layers
a2dLayerInfo* lr = new a2dLayerInfo(wxLAYER_USER_FIRST, "MyLayer");
// Set layer available
lr->Set_Available(true);
// Add layer to to the a2dLayers
docLayers->Append(lr);
doc->SetLayerSetup(docLayers);
Remarks
You don't have to call Set_UpdateAvailableLayers it will be done automatically
Parameters
layersetupthe new layersetup

Definition at line 780 of file candoc.cpp.

void a2dCanvasDocument::SetMultiRoot ( bool  multiRoot = true)
inline

Set true if the document read from a file did not have on erootobject but several.

Some formats as GDS-II and KEY, can contain many structure, which are not placed in a single parent object. Still in a a2dCanvasDocument they will be placed in the m_drawing. This flag can be used when writing the data back in the same way, skipping the rootobject if possible.

Definition at line 563 of file candoc.h.

void a2dCanvasDocument::SetUnits ( const wxString &  unitString)
inline

this string defines the unit e.g. meters / inch/ etc.

numbers used for storing length or position or always stored as doubles. The real dimension is: (anynumber) * GetUnitsScale() * GetUnits()

Remarks
the value may also be "trees" "pixels" or "people" etc.
conversion to other units is not just simply changing this string. You must Change the SetUnitsScale(double) or really scale the data itself.

Definition at line 643 of file candoc.h.

void a2dCanvasDocument::SetUnitsAccuracy ( double  accuracy)
inline

this is the number that defines the number of decimal places in the fraction

when writing numbers to a file. When reading a file, this number is set to the accuracy information available in the file. 1/GetAccuracyUserUnits() == 100 means 2 decimal places will be written, or the data just read is accurate to this number of decimal places.

Remarks
SetUnitsAccuracy() can also be > 1

Definition at line 595 of file candoc.h.

void a2dCanvasDocument::SetUnitsScale ( double  scale)
inline

this is the number that defines the physical dimension in meters / inch/ etc.

numbers used for storing length or position or always stored as doubles. The real dimension is: (anynumber) * GetUnitsScale() * GetUnits()

Definition at line 608 of file candoc.h.

void a2dCanvasDocument::UpdateLoadedLayerSetup ( )
virtual

Update a loaded layer setup.

This is called after loading a layer setup. The base class function does nothing. It is usefull to override this to update a loaded layer setup to e.g. a new software version

Definition at line 1064 of file candoc.cpp.

bool a2dCanvasDocument::WriteSVG ( a2dCanvasView drawer,
const wxString &  filename,
a2dCanvasObject top,
double  Width,
double  Height,
wxString  unit 
)

write as SVG to a file starting at given object

Parameters
drawerdrawing view context
filenamefilename of stream to write the SVG content to.
topstart writting at this object.
Widthwidth in unit will be the physical width of the drawing.
Heightheight in unit will be the physical height of the drawing.
unitUnit of width and height e.g. "cm" "um".

Definition at line 1242 of file candoc.cpp.

Member Data Documentation

wxDateTime a2dCanvasDocument::m_changedInternalAccesstime
protected

gives time when a change was made to the document which may effect rendering

e.g. set in SetUpdatesPending()

Definition at line 742 of file candoc.h.

a2dSmrtPtr<a2dLayers> a2dCanvasDocument::m_layersetup
protected

setup for layers in this document

Remarks
will contain if a layer is available/visible for rendering
object without style will take the layer style to draw itself.

Definition at line 715 of file candoc.h.


The documentation for this class was generated from the following files:
a2dCanvasDocument Class Reference -- Sun Oct 12 2014 17:04:29 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation