MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
Loading...
Searching...
No Matches
TSLDisplayObject Class Referenceabstract

Detailed Description

This abstract base class represents the visualisation of a TSLDynamicData Object (DDO). Derived classes will represent concrete display objects (such as e.g. AccidentDO, RoadworksDO, ...).

Derived-TSLDisplayObject (DO) classes must provide an implementation of the draw() method, which is actually responsible for painting the object on screen.

When a TSLObjectDataLayer is added to a TSLDrawingSurface, a DO is created for each DDO by calling the instantiateDO method associated with that DDO class.

A derived-DDO class can have several classes of DOs associated with it. This allows clients to use different visualisation in different drawing surfaces.

Public Member Functions

 TSLDisplayObject (bool visibility=true)
 
 TSLDisplayObject (const TSLDisplayObject &rhs)
 
virtual ~TSLDisplayObject ()
 
bool bringToFront ()
 
virtual bool draw (TSLRenderingInterface *d_surface, TSLEnvelope *d_extent)=0
 
void move (TSLTMC x, TSLTMC y)
 
void move (TSLCoord pos)
 
virtual bool pick (const TSLEnvelope &extent)
 
bool positionIsSet ()
 
virtual void releaseResources (int surfaceID)
 
void selectable (bool selectability)
 
bool sendToBack ()
 
void translate (TSLCoord pos)
 
void translate (TSLTMC x, TSLTMC y)
 
virtual void unclone ()
 
void visible (bool visibility)
 
const TSLDynamicDataObjectDDO () const
 
TSLDynamicDataObjectDDO ()
 
bool fixedPixSize () const
 
TSLEnvelope getExtent ()
 
TSLEnvelope getPixSize () const
 
void position (const TSLCoord &newPos)
 
void position (TSLTMC x, TSLTMC y)
 
TSLCoord position () const
 
bool selectable () const
 
void setExtent (const TSLEnvelope &extent)
 
void setExtent (TSLTMC x1, TSLTMC y1, TSLTMC x2, TSLTMC y2)
 
void setPixSize (TSLDeviceUnits x1, TSLDeviceUnits y1, TSLDeviceUnits x2, TSLDeviceUnits y2)
 
void setSize (TSLTMC x1, TSLTMC y1, TSLTMC x2, TSLTMC y2)
 
bool visible () const
 

Protected Attributes

TSLEnvelope m_extent
 
TSLCoord m_position
 
bool m_selectability
 
bool m_visibility
 
TSLDynamicDataObjectm_ddo
 
void * m_doMgr
 

Constructor & Destructor Documentation

◆ TSLDisplayObject() [1/2]

TSLDisplayObject::TSLDisplayObject ( bool visibility = true)

Default constructor.

Parameters
visibilityIf true, then the TSLDisplayObject (DO) is visible.

After construction, the DO has the specified visibility, is selectable and has zero extent.

◆ TSLDisplayObject() [2/2]

TSLDisplayObject::TSLDisplayObject ( const TSLDisplayObject & rhs)

Copy constructor.

Parameters
rhsThe display object to be copied.

◆ ~TSLDisplayObject()

virtual TSLDisplayObject::~TSLDisplayObject ( )
virtual

Virtual destructor.

Removes itself from its visualisation manager & requests its associated TSLDynamicDataObject to remove it from its list of TSLDisplayObjects.

Member Function Documentation

◆ bringToFront()

bool TSLDisplayObject::bringToFront ( )

Move the DisplayObject to the top of the DrawingSurface display list.

Returns true on success, false otherwise.

◆ DDO() [1/2]

TSLDynamicDataObject * TSLDisplayObject::DDO ( )
inline

Query method for the TSLDynamicDataObject (DDO) that this TSLDisplayObject represents.

Returns a pointer to the associated DDO, 0 otherwise.

◆ DDO() [2/2]

const TSLDynamicDataObject * TSLDisplayObject::DDO ( ) const
inline

Query method for the TSLDynamicDataObject (DDO) that this TSLDisplayObject represents.

Returns a pointer to the associated (const) DDO, 0 otherwise.

Class TSLDisplayObject

◆ draw()

virtual bool TSLDisplayObject::draw ( TSLRenderingInterface * d_surface,
TSLEnvelope * d_extent )
pure virtual

Paints the Display Object. This method must be overridden by the application specific class to provide the visualisation of the Display Object

Parameters
d_surfaceThe interface into which to draw.
d_extentThe extent (in TMC units) of the draw area.
Returns
true on success, false otherwise.

◆ fixedPixSize()

bool TSLDisplayObject::fixedPixSize ( ) const
inline

Query method for whether the extent of a TSLDisplayObject (DO) is a fixed pixel size.

Returns true if the extent is a fixed pixel size, false otherwise.

◆ getExtent()

TSLEnvelope TSLDisplayObject::getExtent ( )
inline

Query method for the extent of a TSLDisplayObject (DO).

If the display object is fixed size and the containing object layer hasn't been added to a drawing surface, this function will return a default constructed extent and an error message will be posted to the Errorstack.

Returns the extent of the DO.

◆ getPixSize()

TSLEnvelope TSLDisplayObject::getPixSize ( ) const
inline

Query method for the pixel size of a TSLDisplayObject (DO).

Note: this method should only be called if setPixSize() has been previously called.

Returns the size of the DO (in pixels).

◆ move() [1/2]

void TSLDisplayObject::move ( TSLCoord pos)

Move the TSLDisplayObject (DO) to the given (TSLCoord) position. This method also recalculates the DO's extent.

Parameters
posThe position to move to in TMC units.

◆ move() [2/2]

void TSLDisplayObject::move ( TSLTMC x,
TSLTMC y )

Move the TSLDisplayObject (DO) to the given (x,y) position. This method also recalculates the DO's extent.

Parameters
(x,y)The new position in TMC units.

◆ pick()

virtual bool TSLDisplayObject::pick ( const TSLEnvelope & extent)
virtual

Virtual function that notifies the display object that a Pick operation is being performed on the display object.

Derived display object classes should check using the given extent to see if the display object has been picked and if so return true to pick it.

Parameters
extentTMC extent of the are being picked.

The function should true if the DO is picked else it should return 0.

◆ position() [1/3]

TSLCoord TSLDisplayObject::position ( ) const
inline

Query method for the position of the TSLDisplayObject (DO).

Returns the DO position in TMC units.

◆ position() [2/3]

void TSLDisplayObject::position ( const TSLCoord & newPos)
inline

Set the TSLDisplayObject position (given a TSLCoord).

Does not modify the extent. Usually only used during initialisation.

Parameters
newPosThe new position in TMC units.

◆ position() [3/3]

void TSLDisplayObject::position ( TSLTMC x,
TSLTMC y )
inline

Set the TSLDisplayObject position (given x & y). Does not modify the extent.

Usually only used during initialisation.

Parameters
(x,y)The new position in TMC units.

◆ positionIsSet()

bool TSLDisplayObject::positionIsSet ( )

Queries whether the Display Object position has been set.

This is used by the Object Data Layer after the Display Object has been instantiated. If the position has not already been set, then the Display Objects position is set to the position of the owning Dynamic Data Object.

◆ releaseResources()

virtual void TSLDisplayObject::releaseResources ( int surfaceID)
virtual

This method is called when the Drawing Surface invalidates its native drawing resources.

The user will need to release any surface specific resources.

The use of this method is very dependent upon the Drawing Surface technology.

Parameters
surfaceIDA unique surface number.

◆ selectable() [1/2]

bool TSLDisplayObject::selectable ( ) const
inline

Query method for selectability of the TSLDisplayObject (DO).

Returns true if DO is selectable, false otherwise.

◆ selectable() [2/2]

void TSLDisplayObject::selectable ( bool selectability)

Set the selectability of the TSLDisplayObject (DO).

Parameters
selectabilityIf true, then DO is selectable.

◆ sendToBack()

bool TSLDisplayObject::sendToBack ( )

Move the DisplayObject to the bottom of the DrawingSurface display list.

Returns true on success, false otherwise.

◆ setExtent() [1/2]

void TSLDisplayObject::setExtent ( const TSLEnvelope & extent)
inline

Set the extent of the TSLDisplayObject (DO) - mutually exclusive with set Size and setPixSize.

Parameters
extentThe TSLEnvelope (in TMC units) describing the DO extent.

◆ setExtent() [2/2]

void TSLDisplayObject::setExtent ( TSLTMC x1,
TSLTMC y1,
TSLTMC x2,
TSLTMC y2 )
inline

Set the extent of the TSLDisplayObject (DO) in TMC units - mutually exclusive with setSize and setPixSize

Parameters
(x1,y1)Bottom left co-ordinate (in TMC units) of DO extent.
(x2,y2)Upper right co-ordinate (in TMC units) of DO extent.

◆ setPixSize()

void TSLDisplayObject::setPixSize ( TSLDeviceUnits x1,
TSLDeviceUnits y1,
TSLDeviceUnits x2,
TSLDeviceUnits y2 )
inline

Set the pixel size of the TSLDisplayObject (DO) - mutually exclusive with extent and TMC size.

This size should be centred around (0,0). For example, for a 10x10 symbol, whose position is at the centre of the symbol, use (-5,-5),(5,5)

Parameters
(x1,y1)Bottom left co-ordinate (in pixels) of DO size.
(x2,y2)Upper right co-ordinate (in pixels) of DO size.

◆ setSize()

void TSLDisplayObject::setSize ( TSLTMC x1,
TSLTMC y1,
TSLTMC x2,
TSLTMC y2 )
inline

Set the 'size' of the TSLDisplayObject (DO).

This is useful, if the actual extent of the DO is not known at the time of construction but its 'size' is. After the DO has been instantiated, its actual extent will be set based on its position (or its TSLDynamicData Object's position) & this size.

Parameters
(x1,y1)Bottom left co-ordinate (in TMC units) of DO size.
(x2,y2)Upper right co-ordinate (in TMC units) of DO size.

◆ translate() [1/2]

void TSLDisplayObject::translate ( TSLCoord pos)

Move the TSLDisplayObject (DO) by the given (TSLCoord) offset. This method also recalculates the DO's extent.

Parameters
posCoord containing TMC delta values to move existing position to the new position.

◆ translate() [2/2]

void TSLDisplayObject::translate ( TSLTMC x,
TSLTMC y )

Move the TSLDisplayObject (DO) by the given (x,y) offset. This method also recalculates the DO's extent.

Parameters
(x,y)The TMC delta values to move existing position to the new position.

◆ unclone()

virtual void TSLDisplayObject::unclone ( )
virtual

This virtual method is used to destroy TSLDisplayObjects which are no longer required. By default, it calls delete for the TSLDisplayObject.

This allows derived classes to use custom memory-management for TSLDisplay Objects (such as pre-allocated memory pools). In these cases, this method would simply return the TSLDisplayObject to the memory pool.

You should provide an implementation of this method if you are not using the same Windows compiler that MapLink has been built with.

◆ visible() [1/2]

bool TSLDisplayObject::visible ( ) const
inline

Query method for visibility of the TSLDisplayObject (DO).

Returns true if DO is visible, false otherwise.

◆ visible() [2/2]

void TSLDisplayObject::visible ( bool visibility)

Set the visibility of the TSLDisplayObject (DO).

Parameters
visibilityIf true, then DO is visible.

Member Data Documentation

◆ m_ddo

TSLDynamicDataObject* TSLDisplayObject::m_ddo
protected

Data Members for Associations

◆ m_doMgr

void* TSLDisplayObject::m_doMgr
protected

◆ m_extent

TSLEnvelope TSLDisplayObject::m_extent
protected
Initial value:
{
return tslTMS

Deprecated method Deprecated method Deprecated method Deprecated method Data Members for Class Attributes The extent of the TSLDisplayObject.

◆ m_position

TSLCoord TSLDisplayObject::m_position
protected

The map position (TMC) of this TSLDisplayObject.

◆ m_selectability

bool TSLDisplayObject::m_selectability
protected

Selectability of TSLDisplayObject.

◆ m_visibility

bool TSLDisplayObject::m_visibility
protected

Visibility of TSLDisplayObject.