![]() |
MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
|
This abstract base class represents a generic object from the 'real' world. These objects may also have different visual representations of themselves (through TSLDisplayObject class objects). Derived classes will represent concrete real world objects (such as e.g. Accidents, Roadworks, ...).
TSLDynamicDataObject (DDO) objects should be added to a TSLObjectDataLayer. Once added to it, the object data layer then assumes ownership of the DDO object & the client need not worry about deleting those DDO pointers.
When a TSLObjectDataLayer is added to a TSLDrawingSurface, a TSLDisplay Object is created for each DDO by calling instantiateDO on the DDO class. Derived-DDO classes should return an appropriate TSLDisplayObject* in their implementation of this method.
The TSLDynamicDataObject class provides two macros which allow derived-DDO classes to be streamed (through TSLofstream and TSLifstream objects). In order to register a derived-DDO class for streaming, clients must incorporate the following in their class declaration (e.g.):
#define ACCIDENT_CLASS_ID 101 class Accident : public TSLDynamicDataObject { public: TSL_DECLARE_DDO_CLASS(Accident, ACCIDENT_CLASS_ID) // ... };
The class must then be registered in accident.cpp:
TSL_REGISTER_DDO_CLASS(Accident, ACCIDENT_CLASS_ID)
This would be typically done to enable an object data layer to save its contained DDOs to disk & restore them later.
Note: this requires that the derived class provides a default constructor.
The virtual methods write() and read() are provided to allow derived-DDO classes to stream object attributes specific to their derived classes.
Classes | |
class | Registration_ |
Public Member Functions | |
virtual int | classID__ () const |
TSLDynamicDataObject () | |
TSLDynamicDataObject (TSLTMC x1, TSLTMC y1, TSLTMC x2, TSLTMC y2) | |
virtual | ~TSLDynamicDataObject () |
bool | attached () const |
virtual void | destroy () |
void | grab () |
void | clearEntity () |
void | move (TSLTMC x, TSLTMC y, bool updateDOextent=false) |
void | move (TSLCoord pos, bool updateDOextent=false) |
bool | ownsEntity () const |
virtual TSLDisplayObject * | instantiateDO (TSLDisplayType key, int dsID=0) const |
virtual void | read (TSLifstream &stream) |
void | release () |
void | setEntity (TSLEntity *entity, bool owner=false) |
void | translate (TSLCoord pos, bool updateDOextent=false) |
void | translate (TSLTMC x, TSLTMC y, bool updateDOextent=false) |
virtual void | write (TSLofstream &stream) const |
const TSLvector< TSLDisplayObject * > & | getDisplayObjects () const |
TSLEntity * | getEntity () const |
TSLEnvelope | getExtent () const |
void | position (const TSLCoord &newPos) |
void | position (TSLTMC x, TSLTMC y) |
TSLCoord | position () const |
void | selectable (bool selectability) |
bool | selectable () const |
void | setExtent (const TSLEnvelope &extent) |
void | setExtent (TSLTMC x1, TSLTMC y1, TSLTMC x2, TSLTMC y2) |
void | visible (bool visibility) |
bool | visible () const |
Protected Member Functions | |
void | initialiseClone (const TSLDynamicDataObject &rhs) |
Protected Attributes | |
TSLvector< TSLDisplayObject * > * | m_displayObjects |
TSLDynamicDataObject::TSLDynamicDataObject | ( | ) |
Default constructor.
After construction, the TSLDynamicDataObject has zero extent, is visible and selectable.
TSLDynamicDataObject::TSLDynamicDataObject | ( | TSLTMC | x1, |
TSLTMC | y1, | ||
TSLTMC | x2, | ||
TSLTMC | y2 ) |
Constructor with position supplied.
(x1,y1) | Bottom left co-ordinate (in TMC units) of TSLDynamicDataObject (DDO) extent. |
(x2,y2) | Upper right co-ordinate (in TMC units) of DDO extent. |
After construction, the DDO has the specified extent, is visible and selectable.
|
virtual |
Virtual destructor.
Removes itself from the object data layer and deletes all its associated TSLDisplayObjects.
bool TSLDynamicDataObject::attached | ( | ) | const |
Query for whether TSLDynamicDataObject (DDO) is attached to an object data layer.
Note that this method is const.
Returns true if DDO is already attached, false otherwise.
|
inlinevirtual |
void TSLDynamicDataObject::clearEntity | ( | ) |
Causes the dynamic data object to forget the entity added with setEntity. If the entity is owned by the dynamic data object (i.e. if the owner parameter was true when setEntity was called) then the entity will be deleted.
|
virtual |
This method is called to delete the instance of TSLDynamicDataObject.
You should provide an implementation of this method if you are not using the same Windows compiler that MapLink has been built with.
|
inline |
Query method for the TSLDynamicDataObject's (DDO) associated TSLDisplay Objects (DO).
Note that this method is const.
Returns a constant reference to this DDO's vector of DO pointers.
Class TSLDynamicDataObject
|
inline |
Query method for the entity associated with this TSLDynamicDataObject (DDO). This is for use by the application specific portion of the TSLDynamic DataObject or its associated TSLDisplayObjects.
Note that this method is const.
Returns the TSLEntity pointer associated with the DDO.
|
inline |
Query method for the extent of a TSLDynamicDataObject (DDO) in TMC Units.
Note that this method is const.
Returns the extent of the DDO as a TSLEnvelope.
void TSLDynamicDataObject::grab | ( | ) |
Increment the reference count. The Object Data Layer uses this reference count to decide whether to delete the TSLDynamicDataObject. When the reference count is zero, the DDO is deleted.
The Object Data Layer increments the reference count when a DDO is added to it.
This mechanism is typically used for objects that need to be persistent and can be transferred between Object Data Layers.
|
protected |
This method sets the member attributes of a cloned-copy.
|
virtual |
Called to create the TSLDisplayObject* (DO) to be used for this instance of the TSLDynamicDataObject (DDO).
Note that this method is const.
key | One of TSLDisplayType values. Determines the type of visualisation manager to use. Currently always tslTMS. |
dsID | The ID of the TSLDrawingSurface to which the DDO is being added. |
The dsID allows clients to supply different classes of Display Object for different TSLDrawingSurfaces, or provide Drawing Surface specific positions for the Display Objects. This assumes that the client has tagged all drawing surfaces in his app with different (known) ids.
void TSLDynamicDataObject::move | ( | TSLCoord | pos, |
bool | updateDOextent = false ) |
Move the TSLDynamicDataObject (DDO) to the given (TSLCoord) position. This method also recalculates the DDO's extent.
pos | The position to move to (as a TSLCoord) in TMC units. |
updateDOextent | If true, will update the extent of all TSLDisplayObjects associated with this DDO (default=false). |
void TSLDynamicDataObject::move | ( | TSLTMC | x, |
TSLTMC | y, | ||
bool | updateDOextent = false ) |
Move the TSLDynamicDataObject (DDO) to the given (x,y) position. This method also recalculates the DDO's extent.
(x,y) | The new position in TMC units. |
updateDOextent | If true, will update the extent of all TSLDisplayObjects associated with this DDO. |
bool TSLDynamicDataObject::ownsEntity | ( | ) | const |
Returns true if the dynamic data object owns its entity. This is the value given to the owner parameter of setEntity.
Note that this method is const.
|
inline |
Query method for the position of the TSLDynamicDataObject (DDO).
Note that this method is const.
Returns the DDO position in TMC units.
|
inline |
Set the TSLDynamicDataObject position (given a TSLCoord). This does not affect the extent and is typically used only during initialisation.
newPos | Const reference to the new position in TMC units. |
|
inline |
Set the TSLDynamicDataObject position (given x & y). This does not affect the extent and is typically used only during initialisation.
(x,y) | The new position in TMC units. |
|
virtual |
This virtual method streams in derived-class specifics. It should be overridden by derived classes.
The stream passed is a binary stream. Therefore use only the read method of the stream.
stream | A reference to a TSLifstream object. |
void TSLDynamicDataObject::release | ( | ) |
Release the object by decrementing the reference count. The Object Data Layer decrements the reference count when a DDO is removed from it or the Object Data Layer is deleted.
he Object Data Layer uses this reference count to decide whether to delete the TSLDynamicDataObject. When the reference count is zero, the DDO is deleted.
This mechanism is typically used for objects that need to be persistent and can be transferred between Object Data Layers.
|
inline |
Query method for selectability of the TSLDynamicDataObject (DDO).
Note that this method is const.
Returns true if DDO is selectable, false otherwise.
|
inline |
Set the selectability of the TSLDynamicDataObject (DDO).
selectability | If true, then the DDO is selectable. |
void TSLDynamicDataObject::setEntity | ( | TSLEntity * | entity, |
bool | owner = false ) |
Sets this object's entity.
entity | Pointer to the entity. |
owner | If true, then the object is responsible for deleting its entity. Default is false. |
|
inline |
Set the extent of the TSLDynamicDataObject (DDO).
extent | The TSLEnvelope (in TMC units) describing the DDO extent. |
|
inline |
Set the extent of the TSLDynamicDataObject (DDO).
(x1,y1) | Bottom left co-ordinate (in TMC units) of DDO extent. |
(x2,y2) | Upper right co-ordinate (in TMC units) of DDO extent. |
void TSLDynamicDataObject::translate | ( | TSLCoord | pos, |
bool | updateDOextent = false ) |
Move the TSLDynamicDataObject (DDO) by the given (TSLCoord) offset. This method also recalculates the DDO's extent.
pos | The delta to move by in TMC units. |
updateDOextent | If true, will update the extent of all TSLDisplayObjects associated with this DDO. |
void TSLDynamicDataObject::translate | ( | TSLTMC | x, |
TSLTMC | y, | ||
bool | updateDOextent = false ) |
Move the TSLDynamicDataObject (DDO) by the given (x,y) offset. This method also recalculates the DDO's extent.
(x,y) | The delta values to move by in TMC units. |
updateDOextent | If true, will update the extent of all TSLDisplayObjects associated with this DDO. |
|
inline |
Query method for visibility of the TSLDynamicDataObject (DDO).
Note that this operation is const.
Returns true if DDO is visible, false otherwise.
|
inline |
Set the visibility of the TSLDynamicDataObject (DDO).
visibility | If true, then DDO is visible. |
|
virtual |
This virtual method streams out derived-class specifics. It should be overridden by derived classes.
Note that this method is const.
The stream passed is a binary stream. Therefore use only the write method of the stream.
stream | A reference to the binary stream object. |
|
protected |
Data Members for Associations