wxArt2D
Public Member Functions | Protected Attributes | List of all members
a2dCanvasDocumentIOHandlerImageOut Class Reference

Input and output handler for a2dCanvasDocument to/from a wxImage. More...

#include <imageioh.h>

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

Public Member Functions

 a2dCanvasDocumentIOHandlerImageOut (wxBitmapType type=wxBITMAP_TYPE_ANY)
 Constructor.
 
 ~a2dCanvasDocumentIOHandlerImageOut ()
 Destructor.
 
bool CanSave (const wxObject *obj=NULL)
 this handler can also save as CVG
 
virtual bool Save (a2dDocumentOutputStream &stream, const wxObject *obj)
 save a2dCanvasDocument as image
 
void SetShowObject (a2dCanvasObject *showObject)
 document will be rendered as seen from this object, if NULL, the root of the document will be used.
 
a2dCanvasObjectGetShowObject () const
 return pointer of then currently shown object on the drawer. More...
 
wxImage RenderImage (a2dCanvasDocument *document)
 render the document into an image.
 
void SetImageSize (const wxSize &size)
 Set the size of the image to create.
 
void SetViewRectangle (double minx, double miny, double maxx, double maxy)
 Give the virtual size to be rendered to an image. More...
 
void SetViewRectangle (a2dBoundingBox viewBox)
 Give the virtual size to be rendered to an image as boundingbox. More...
 
void SetYaxis (bool up)
 set if the Yaxis goes up or down
 
bool GetYaxis () const
 get y axis orientation
 
void SetType (wxBitmapType type)
 set the image type to save to, wxBITMAP_TYPE_ANY means outdetect from filename in CanSave().
 
long GetType () const
 return the image type to save to, wxBITMAP_TYPE_ANY means outdetect from filename in CanSave().
 
void SetMaxWidthHeight (long maxWidthHeight)
 when image size is calculated, this is the maximum size possible
 
void SetBorder (wxUint16 border, bool percentual=true)
 leafs a border of this amount of pixels around the drawing
 
void SetDrawer2D (a2dDrawer2D *drawer2d)
 set the internal m_drawer2D to be used for rendering the document
 
a2dDrawer2DGetDrawer2D () const
 get the internal m_drawer2D that is used for rendering the document
 
- Public Member Functions inherited from a2dIOHandlerStrOut
 a2dIOHandlerStrOut (wxMBConv &conv=wxConvUTF8)
 constructor
 
 ~a2dIOHandlerStrOut ()
 destructor
 
virtual void InitializeSave ()
 Inits the handler for writing.
 
virtual void ResetSave ()
 Reset the object after saving.
 
void SetFileName (const wxFileName &filename)
 
const wxFileName & GetFileName () const
 
- Public Member Functions inherited from a2dIOHandler
 a2dIOHandler ()
 constructor
 
 ~a2dIOHandler ()
 destructor
 
virtual wxObject * CreateObject (const wxString &symbolicName)
 Creates an specific object by name. More...
 
- Public Member Functions inherited from a2dRefMap
 a2dRefMap ()
 constructor
 
 ~a2dRefMap ()
 destructor
 
virtual void Initialize ()
 initialize mapping tables
 
a2dHashMapIntToObject & GetObjectHashMap ()
 This is used to find multiple referenced objects by id.
 
a2dHashMapCreateObject & GetObjectCreateHashMap ()
 has to map symbolic names to real classnames.
 
a2dResolveIdList & GetResolveIdList ()
 list of not resolved objects
 
bool ResolveOrAdd (a2dSmrtPtr< a2dObject > *storedHere, const wxString &id=wxT(""))
 try to resolve the object that is in storedHere when it is a reference. More...
 
bool ResolveOrAdd (a2dAutoZeroPtr< a2dObject > *storedHere, const wxString &id=wxT(""))
 try to resolve the object that is in storedHere when it is a reference.
 
bool ResolveOrAddLink (a2dObject *obj, const wxString &id=wxT(""))
 try to resolve an object referenced by obj using the LinkReference function
 
void ResolveInform (a2dObject *obj)
 call the objects LinkReference function (ptr=0) to inform it that links are done
 
void SetLastObjectLoadedId (const wxString &lastid)
 set by RefObject when finding a reference id during loading.
 
virtual bool LinkReferences (bool ignoreNonResolved=false)
 link references to their destination More...
 
bool RemoveReference (const wxString &idToRemove)
 remove given reference if from reference map.
 
a2dError GetLastError () const
 get last error encountered
 
void SetLastError (a2dError error)
 set last error encountered
 
- 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...
 
virtual void Save (wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dObjectList *towrite)
 write all needed to an XML type of file called the CVG format More...
 
void LoadFromDocument (a2dIOHandlerXmlSerIn &parser)
 Load this object and all below from an XML document. More...
 
virtual void Load (wxObject *parent, a2dIOHandlerXmlSerIn &parser)
 load object from CVG file 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...
 

Protected Attributes

a2dDrawer2Dm_drawer2D
 the drawing engine to use
 
a2dCanvasDocumentm_doc
 the document to store/load the data found into
 
wxSize m_imageSize
 image size that will be created.
 
wxSize m_imageSizeCalc
 calculate image size as set by user when m_imageSize = (0,0) else eqauls m_imageSize
 
a2dCanvasObjectm_showObject
 render the document using this object as ShowObject.
 
int m_border
 create a border in this ammount of pixels.
 
bool m_borderpercentual
 border is not in pixel but a percentage of the smallest height/width
 
wxBitmapType m_type
 image type
 
wxBitmapType m_typeDetectedFromFilename
 image type as detected in CanSave(), wil be used in Save() if m_type is wxBITMAP_TYPE_ANY
 
bool m_yaxis
 axis is up or down
 
a2dBoundingBox m_viewBox
 viewing area in world coordinates to display on bitmap
 
long m_maxWidthHeight
 
- Protected Attributes inherited from a2dIOHandlerStrOut
wxFileName m_filename
 
wxMBConv & m_conv
 unicode conversion
 
a2dDocumentOutputStreamm_streamo
 file or other string stream containing the format to output to.
 
wxEOL m_mode
 end of line mode
 
- Protected Attributes inherited from a2dRefMap
a2dHashMapIntToObject m_objecthashmap
 This is used to find multiple referenced objects by id.
 
a2dHashMapCreateObject m_objectCreate
 This is used to find a classname using a symbolic name.
 
a2dResolveIdList m_toResolve
 refernces to object which have not bin resolved yet ( e.g not read yet, but already referenced )
 
wxString m_lastObjectId
 
a2dError m_lastError
 set to last error found when parsing
 
- 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
 
- 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 Types inherited from a2dObject
enum  { refcount_nondynamic = 0x76543210 }
 special refcount value for non-dynamic objects
 
- Protected Member Functions inherited from a2dIOHandlerStrOut
void SetMode (wxEOL mode=wxEOL_NATIVE)
 define the line end mode for textual files
 
wxEOL GetMode ()
 get line end mode for textual files
 
void Write32 (wxUint32 i)
 write a 32 bits integer
 
void Write16 (wxUint16 i)
 write a 16 bits integer
 
void Write8 (wxUint8 i)
 write a 8 bits integer
 
virtual void WriteDouble (double d)
 write a double
 
virtual void WriteString (const wxString &string)
 write a string
 
bool IsOk () const
 is the stream Oke to write
 
a2dIOHandlerStrOutPutChar (wxChar c)
 write on character
 
- 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...
 

Detailed Description

Input and output handler for a2dCanvasDocument to/from a wxImage.

This IoHandler is to render parts of a a2dCanvasDocument to an wxImage, and save this as a bitmap to a stream. The maximum size of the bitmap in X or Y is given upfront or else asked for. The a2dCanvasObject to display is set, or the root object of the a2dCanvasDocument is used. The part to display is set as a rectangle defined in world coordinates. That part seen from the m_showObject, is rendered to the image. The image is sized, taking into account the maximum size, such that the view rectangle fits it. The image size can be set upfront, in which case the drawing will be centered on that image size.

The rendering itself is done via a a2dDrawer2D, which can be set. The default is a2dMemDcDrawer. You can use a2dAggDrawer for antialiased drawing etc.

Definition at line 97 of file imageioh.h.

Member Function Documentation

a2dCanvasObject* a2dCanvasDocumentIOHandlerImageOut::GetShowObject ( ) const
inline

return pointer of then currently shown object on the drawer.

Returns
pointer to the current object that is shown.

Definition at line 119 of file imageioh.h.

void a2dCanvasDocumentIOHandlerImageOut::SetViewRectangle ( double  minx,
double  miny,
double  maxx,
double  maxy 
)

Give the virtual size to be rendered to an image.

Here you give the minimum and maximum in world coordinates, which must be displayed on the bitmap.

SetImageSize() is used for the image size itself.

Parameters
minxminimum x coordinate of display area
minyminimum y coordinate of display area
maxxmaximum x coordinate of display area
maxymaximum y coordinate of display area
Remarks
these setting are only used when m_automaticScale is set false.

Definition at line 190 of file imageioh.cpp.

void a2dCanvasDocumentIOHandlerImageOut::SetViewRectangle ( a2dBoundingBox  viewBox)
inline

Give the virtual size to be rendered to an image as boundingbox.

Here you give the minimum and maximum in world coordinates, which must be displayed on the bitmap.

Parameters
viewBoxboundingbox in world coordinates to display

Definition at line 148 of file imageioh.h.


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