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

Detailed Description

TSLRenderingInterface class acts as an interface between the geometry model and the actual surface on which it will be drawn.

This allows the Geometry Model to be used independently of any specific drawing surface type since the RenderingInterface will act as a NULL interface in its own right.

It is only used in MapLink when using Display Objects.

To draw a particular object, call any 'setupXxxAttributes' methods, followed by any 'drawXxx' methods required.

Alternatively, the query methods of this class allow the entity's position to be determined and the entity drawn using, for example, raw GDI or X calls.

The types used to return OS specific drawing are as follows:

TSLDeviceContext : Windows 'HDC'. TSLWindowHandle : Windows 'HWND'. TSLBitmapHandle : Windows 'HBITMAP', X11 a pointer to a structure declared in tslplatformtypes.h. TSLDrawableHandle : X11 'Drawable'. TSLVisualHandle : X11 'Visual *'. TSLColourmapHandle : X11 'Colormap'. TSLScreenHandle : X11 'Screen *'. TSLDisplayHandle : X11 'Display *'.

If you pass a specific OS type to a method or you are querying a method which returns an OS specific type as defined above you may need to cast the result or argument to the type expected.

The methods that take a wchar_t should be avoided on non-Windows platforms as the character conversion is platform and potentially compiler specific.

Realtime Reprojection

Realtime reprojection introduces a number of complexities that need to be handled by the application, if enabled.

Drawing

If the layer we are in has been enabled for realtime reprojection then drawing raster and vector is limited to Text and Symbols only.

The position of the Text and Symbols need to be updated as the TSLCoordinateSystem projection center or projection may have changed.

Public Member Functions

TSLStyleID createFontID (const TSLSimpleString &name, TSLFontType meaningOfName, int fontWeight, bool italic=false, bool underline=false, bool antiAliased=false, const unsigned char *memoryBlock=NULL, TSLSize memoryBlockSize=0)
 
TSLRasterBuffercreateRasterBuffer (unsigned int width, unsigned int height, TSLRasterBuffer::Format format, TSLRasterBuffer::FilterMode filterMode=TSLRasterBuffer::Linear)
 
bool drawArc (const TSLCoord &centre_point, TSLTMC xradius, TSLTMC yradius, double start_angle, double end_angle, double rot_angle=0.0)
 
bool drawEllipse (const TSLCoord &centre_point, TSLTMC xradius, TSLTMC yradius, double rot_angle=0.0)
 
bool drawEntity (TSLEntity *entity, const TSLEnvelope *tmcExtent=NULL)
 
int drawingSurfaceID () const
 
bool drawPolygon (const TSLCoordSet *outer, int numInners=0, const TSLCoordSet **inners=0, TSLEnvelope *extent=0)
 
bool drawPolygon (const TSLCoord *outer, int numOuterCoords, int numInners=0, const TSLCoord **inners=0, int *numCoordsInInner=0, TSLEnvelope *extent=0)
 
bool drawPolyline (const TSLCoordSet *edge, bool closed=false, TSLEnvelope *extent=0)
 
bool drawPolyline (const TSLCoord *edge, int numCoords, bool closed=false, TSLEnvelope *extent=0)
 
bool drawRaster (TSLTMC x, TSLTMC y, unsigned int width, unsigned int height, double angle, TSLRasterBuffer *raster)
 
bool drawSymbol (const TSLCoord &point, TSLTMC size=0, TSLEnvelope *rnd_env=0)
 
bool drawText (const TSLText *textObject, TSLEnvelope *rnd_env=0)
 
bool drawText (const TSLCoord &point, const char *value, TSLEnvelope *rnd_env=0)
 
bool drawText (const TSLCoord &point, const wchar_t *value, TSLEnvelope *rnd_env=0)
 
TSLDrawModeEnum drawPass () const
 
void DUToTMC (TSLDeviceUnits x_in, TSLDeviceUnits y_in, TSLTMC *x_out, TSLTMC *y_out) const
 
void DUToTMC (int num, TSLDeviceUnits *x_ins, TSLDeviceUnits *y_ins, TSLTMC *x_outs, TSLTMC *y_outs) const
 
TSLEnvelope extent ()
 
bool extentExceedsDU (const TSLEnvelope &extentInTMC)
 
TSLStyleID getIDofNearestColour (int red, int green, int blue)
 
TSLDeviceContext handleToDrawable () const
 
TSLDrawableHandle handleToDrawable (TSLDisplayHandle &xDisplay) const
 
bool handleToX11DrawingParameters (TSLVisualHandle &visual, TSLScreenHandle &screen, TSLColourmapHandle &colourmap) const
 
bool isDecluttered (const char *featureName, TSLFeatureID featureID) const
 
void notifyRenderExtent (const TSLEnvelope &extent)
 
const TSLCoordinateSystemqueryCoordinateSystem () const
 
const TSLCoordinateSystemqueryScaledLatLongCoordinateSystem () const
 
bool realtimeReprojectionActive () const
 
double rotation () const
 
bool rotationActive () const
 
TSLCoord rotationCentre () const
 
bool scaledLatLonDrawingExtent (TSLEnvelope &left, TSLEnvelope &right) const
 
void screenResolution (double &xr, double &yr) const
 
bool setupAreaAttributes (TSLStyleID style, TSLStyleID colour, short opacity=-1, TSLStyleID backgroundColour=0)
 
bool setupEdgeAttributes (TSLStyleID style, TSLStyleID colour, double thickness, TSLDimensionUnits thicknessUnits=TSLDimensionUnitsPixels, int passNumber=0, bool *morePassesRequired=0, TSLEdgeJoinStyle joinStyle=TSLEdgeJoinStyleUndefined, TSLEdgeEndCapStyle endCapStyle=TSLEdgeEndCapStyleUndefined, short opacity=-1)
 
bool setupSymbolAttributes (TSLStyleID style, TSLStyleID colour, double sizeFactor=1.0, TSLDimensionUnits sizeFactorUnits=TSLDimensionUnitsMapUnits, TSLDeviceUnits minPixelSize=1, TSLDeviceUnits maxPixelSize=2000, double orientation=0.0, uint32_t fontCharacter=-1, short opacity=-1, TSLSymbolRotation symbolRotation=TSLSymbolRotationEnabled)
 
bool setupTextAttributes (TSLStyleID font, TSLStyleID colour, double sizeFactor=1.0, TSLDimensionUnits sizeFactorUnits=TSLDimensionUnitsMapUnits, TSLDeviceUnits minPixelHeight=1, TSLDeviceUnits maxPixelHeight=2000, double offsetX=0.0, double offsetY=0.0, TSLDimensionUnits offsetUnits=TSLDimensionUnitsUndefined, double orientation=0.0, TSLHorizontalAlignment halignment=TSLHorizontalAlignmentLeft, TSLVerticalAlignment valignment=TSLVerticalAlignmentFullBottom, TSLTextBackgroundMode backgroundMode=TSLTextBackgroundModeNone, TSLStyleID backgroundFillStyle=0, TSLStyleID backgroundFillOrHaloColour=0, TSLStyleID backgroundEdgeColour=0, TSLTextRotation textRotation=TSLTextRotationEnabled, short opacity=-1, TSLStyleID fillStyle=0, TSLStyleID fillBackgroundColour=0, float complexHaloRadius=-1.0f, TSLDimensionUnits complexHaloUnits=TSLDimensionUnitsUndefined)
 
void TMCPerDU (TSLTMC &xr, TSLTMC &yr) const
 
double TMCPerMU () const
 
void TMCToDU (TSLTMC x_in, TSLTMC y_in, TSLDeviceUnits *x_out, TSLDeviceUnits *y_out) const
 
void TMCToDU (int num, TSLTMC *x_ins, TSLTMC *y_ins, TSLDeviceUnits *x_outs, TSLDeviceUnits *y_outs) const
 
void TMCToDuAccurate (double &x, double &y) const
 
void TMCToDuAccurate (int num, double *xs, double *ys) const
 
TSLDrawingSurfaceTypeEnum type () const
 
void * userWord () const
 

Member Function Documentation

◆ createFontID()

TSLStyleID TSLRenderingInterface::createFontID ( const TSLSimpleString & name,
TSLFontType meaningOfName,
int fontWeight,
bool italic = false,
bool underline = false,
bool antiAliased = false,
const unsigned char * memoryBlock = NULL,
TSLSize memoryBlockSize = 0 )

Creates a new font identifier object that can be used to specify a font used in drawing. Example usage:

*int fontId = m_surface->createFontID("Haettenschweiler", TSLFontType::TSLFontTypeFontName, 20, true);*
basicAttribs.m_textFont = *fontId*;
basicAttribs.m_textColour = TSLComposeRGB(0x00, 0x00, 0x00);
basicAttribs.m_textSizeFactor = 15.0;
basicAttribs.m_textSizeFactorUnits = TSLDimensionUnitsPixels;
#define TSLComposeRGB(r, g, b)
Definition tslcolourhelper.h:21
@ TSLDimensionUnitsPixels
Pixels.
Definition tsldimensionunits.h:32
Parameters
nameThe font name.
meaningOfNameSpecify TSLFontType::TSLFontTypeFontName.
fontWeight
italictrue for italics
underlinetrue for underline
Returns
the ID of the font. -1 on failure.

◆ createRasterBuffer()

TSLRasterBuffer * TSLRenderingInterface::createRasterBuffer ( unsigned int width,
unsigned int height,
TSLRasterBuffer::Format format,
TSLRasterBuffer::FilterMode filterMode = TSLRasterBuffer::Linear )

Creates a new object that can be used to draw rasters to a MapLink drawing surface through the TSLRenderingInterface. For details on how to use the returned object refer to the class documentation for TSLRasterBuffer.

Parameters
widthThe width in pixels of the raster to create.
heightThe height in pixels of the raster to create.
formatThe image format to use for the raster.
filterModeThe filtering mode to use when drawing the raster at a different resolution to the underlying image data.

◆ drawArc()

bool TSLRenderingInterface::drawArc ( const TSLCoord & centre_point,
TSLTMC xradius,
TSLTMC yradius,
double start_angle,
double end_angle,
double rot_angle = 0.0 )

Draw an arc.

The current edge attributes are used when drawing the edge. These should have been defined using the setupEdgeAttributes method.

All angles are specified in radians, +ve anti-clockwise from the +ve X axis. The arc is drawn anti-clockwise from the start_angle to the end_angle.

Parameters
centre_pointCentre of the ellipse forming the arc.
xradiusX radius of the ellipse forming the arc, before rotation.
yradiusY radius of the ellipse forming the arc, before rotation.
start_angleAngle to start drawing arc from.
end_angleAngle to stop drawing arc at.
rot_angleAngle of rotation of ellipse forming arc.
Returns
true if the arc was drawn successfully, false otherwise.
Note
{ X11 Notes drawEllipse & drawArc have been partially implemented.

A Circle is drawn regardless of rotation. An Ellipse is always drawn if there is no rotation on the Ellipse or drawing surface.

An Arc is drawn (if it forms part of a Circle). Rotation is not applied to the start/end angles if a rotation is specified. An Ellipse Arc is drawn if there is no rotation on the Arc or drawing surface.

An Ellipse/Arc will not be drawn if the coordinates when converted to X coordinates wrap. This occurs when you are zoomed in very close.

When the size of the Arc/Ellipse is > 3000 pixels a straight line approximation is drawn. This will usually occur when you are zoomed in.

If you require the drawing concept of Range Rings you should examine the NT C2Demo example code. The Range Ring DDO is easily ported to X. }

◆ drawEllipse()

bool TSLRenderingInterface::drawEllipse ( const TSLCoord & centre_point,
TSLTMC xradius,
TSLTMC yradius,
double rot_angle = 0.0 )

Draw an ellipse.

The current edge and area attributes are used when drawing the edge. These should have been defined using the setupEdgeAttributes and setupAreaAttributes methods.

All angles are specified in radians, +ve anti-clockwise from the +ve X axis.

Parameters
centre_pointCentre of ellipse.
xradiusX radius of ellipse, before rotation.
yradiusY radius of ellipse, before rotation.
rot_angleAngle of rotation of ellipse.
Returns
true if the ellipse was drawn successfully, false otherwise.
Note
{ X11 Notes drawEllipse & drawArc have been partially implemented.

A Circle is drawn regardless of rotation. An Ellipse is always drawn if there is no rotation on the Ellipse or drawing surface.

An Arc is drawn (if it forms part of a Circle). Rotation is not applied to the start/end angles if a rotation is specified. An Ellipse Arc is drawn if there is no rotation on the Arc or drawing surface.

An Ellipse/Arc will not be drawn if the coordinates when converted to X coordinates wrap. This occurs when you are zoomed in very close.

When the size of the Arc/Ellipse is > 3000 pixels a straight line approximation is drawn. This will usually occur when you are zoomed in.

If you require the drawing concept of Range Rings you should examine the NT C2Demo example code. The Range Ring DDO is easily ported to X. }

◆ drawEntity()

bool TSLRenderingInterface::drawEntity ( TSLEntity * entity,
const TSLEnvelope * tmcExtent = NULL )

Draw a TSLEntity.

The entity should can be created using the static 'create*' method for the particular entity to be drawn.

Entity rendering styles should be set up using the setRendering function.

Parameters
entitythe entity to draw
tmcExtentThe tmc extent of the drawing area. For a Dynamic Data Object this should be the extent passed to the draw method. The default extent is the un-rotated display extent.

◆ drawingSurfaceID()

int TSLRenderingInterface::drawingSurfaceID ( ) const

Returns the user drawing surface ID.

◆ drawPass()

TSLDrawModeEnum TSLRenderingInterface::drawPass ( ) const

The current draw pass.

The draw pass provides a hint as to what stage the drawing pipeline is currently executing.

Different Drawing Surfaces will have different pipeline stages. Normally there is only one stage.

You may get multiple stages for the TSLOpenGLSurface depending on if the layer has been marked for Realtime-Reprojection.

◆ drawPolygon() [1/2]

bool TSLRenderingInterface::drawPolygon ( const TSLCoord * outer,
int numOuterCoords,
int numInners = 0,
const TSLCoord ** inners = 0,
int * numCoordsInInner = 0,
TSLEnvelope * extent = 0 )

Draw a polygon.

The current edge and area attributes are used when drawing the polygon. These should have been defined using the setupEdgeAttributes and setupAreaAttributes methods.

Parameters
outerCoordinates of outer of polygon. The first and last points will be joined automatically.
numOuterCoordsNumber of coordinates in outer array
numInnersNumber of inners in the 'inners' array. Defaults to 0.
innersArray of inners (holes) to removed from the polygon. Each entry is a pointer to an array of coordinates
numCoordsInInnerArray of counts for each of the inners
extentExtent of polygon. This improves performance if specified. If not specified, then the outer coords array is analysed to determine the extent.
Returns
true if the polygon was drawn successfully, false otherwise.

◆ drawPolygon() [2/2]

bool TSLRenderingInterface::drawPolygon ( const TSLCoordSet * outer,
int numInners = 0,
const TSLCoordSet ** inners = 0,
TSLEnvelope * extent = 0 )

Draw a polygon.

The current edge and area attributes are used when drawing the polygon. These should have been defined using the setupEdgeAttributes and setupAreaAttributes methods.

Parameters
outerCoordinates of outer of polygon. The first and last points will be joined automatically.
numInnersNumber of inners in the 'inners' array. Defaults to 0.
innersArray of inners (holes) to removed from the polygon.
extentExtent of polygon. This improves performance if specified. If not specified, then the outer coordset is analysed to determine the extent.
Returns
true if the polygon was drawn successfully, false otherwise.

◆ drawPolyline() [1/2]

bool TSLRenderingInterface::drawPolyline ( const TSLCoord * edge,
int numCoords,
bool closed = false,
TSLEnvelope * extent = 0 )

Draw a polyline, using basic TSLCoords - used typically for dynamic rendering of Multi-part lines

The current edge attributes are used when drawing the polyline. These should have been defined using the setupEdgeAttributes method.

Parameters
edgeCoordinates of polyline.
numCoordsNumber of coordinates in the 'edge' array
closedIf true, then an additional segment is drawn between the first and last coordinate.
extentExtent of polyline. This improves performance if specified. If not specified, then the edge coords array is analysed to determine the extent.
Returns
true if the polyline was drawn successfully, false otherwise.

◆ drawPolyline() [2/2]

bool TSLRenderingInterface::drawPolyline ( const TSLCoordSet * edge,
bool closed = false,
TSLEnvelope * extent = 0 )

Draw a polyline.

The current edge attributes are used when drawing the polyline. These should have been defined using the setupEdgeAttributes method.

Parameters
edgeCoordinates of polyline.
closedIf true, then an additional segment is drawn between the first and last coordinate.
extentExtent of polyline. This improves performance if specified. If not specified, then the edge coordset is analysed to determine the extent.
Returns
true if the polyline was drawn successfully, false otherwise.

◆ drawRaster()

bool TSLRenderingInterface::drawRaster ( TSLTMC x,
TSLTMC y,
unsigned int width,
unsigned int height,
double angle,
TSLRasterBuffer * raster )

Draws a previously created raster.

The raster will be drawn such that the centre of the raster is at the given position. If the display width and height do not match the resolution of the raster being drawn, the raster will be scaled to the requested display size.

Parameters
xThe x coordinate of the centre of the unrotated raster in TMCs.
yThe t coordinate of the centre of the unrotated raster in TMCs.
widthThe display width of the unrotated raster in TMCs.
heightThe display height of the unrotated raster in TMCs.
angleThe anti-clockwise rotation of the raster in radians. Rasters are rotated around their centre.
rasterThe raster object to display.

◆ drawSymbol()

bool TSLRenderingInterface::drawSymbol ( const TSLCoord & point,
TSLTMC size = 0,
TSLEnvelope * rnd_env = 0 )

Draw a symbol.

The current attributes are used when drawing the symbol. These should have been defined using the setupSymbolAttributes method.

Parameters
pointPosition to draw symbol.
sizeSize of the symbol in internal TMC co-ordinates.
rnd_envFor symbols that are fixed size in device coordinate space, the actual extent rendered may change each time the symbol is drawn. If this envelope is specified, then it is populated by the extent of the drawn symbol.
Returns
true if the symbol was drawn successfully, false otherwise.

◆ drawText() [1/3]

bool TSLRenderingInterface::drawText ( const TSLCoord & point,
const char * value,
TSLEnvelope * rnd_env = 0 )

Draw some text.

The current attributes are used when drawing the text. These should have been defined using the setupTextAttributes method.

Parameters
pointPosition to draw text.
valueString to draw.
rnd_envFor raster text, the actual extent rendered may change each time the text is drawn. If this envelope is specified, then it is populated by the extent of the drawn text.
Returns
true if the text was drawn successfully, false otherwise.

◆ drawText() [2/3]

bool TSLRenderingInterface::drawText ( const TSLCoord & point,
const wchar_t * value,
TSLEnvelope * rnd_env = 0 )

Draw some text.

The current attributes are used when drawing the text. These should have been defined using the setupTextAttributes method.

Parameters
pointPosition to draw text.
valueString to draw.
rnd_envFor raster text, the actual extent rendered may change each time the text is drawn. If this envelope is specified, then it is populated by the extent of the drawn text.
Returns
true if the text was drawn successfully, false otherwise.

◆ drawText() [3/3]

bool TSLRenderingInterface::drawText ( const TSLText * textObject,
TSLEnvelope * rnd_env = 0 )

Draw text from the specified object.

The current attributes are used when drawing the text. These should have been defined using the setupTextAttributes method.

Parameters
textObjectObject containing text to draw. Text string and encoding are used.
rnd_envFor raster text, the actual extent rendered may change each time the text is drawn. If this envelope is specified, then it is populated by the extent of the drawn text.
Returns
true if the text was drawn successfully, false otherwise.

◆ DUToTMC() [1/2]

void TSLRenderingInterface::DUToTMC ( int num,
TSLDeviceUnits * x_ins,
TSLDeviceUnits * y_ins,
TSLTMC * x_outs,
TSLTMC * y_outs ) const

This method converts a set of device unit (usually in pixel) values to their internal co-ordinate values.

Parameters
(num)the number of co-ordinates to convert.
(x_ins,y_ins)incoming device units
(x_outs,y_outs)array to receive the results of the conversions in internal co-ordinates. These arrays should be large enough to hold num values.

◆ DUToTMC() [2/2]

void TSLRenderingInterface::DUToTMC ( TSLDeviceUnits x_in,
TSLDeviceUnits y_in,
TSLTMC * x_out,
TSLTMC * y_out ) const

This method converts a device unit (usually in pixel) value to an internal co-ordinate value.

Parameters
(x_in,y_in)incoming device unit
(x_out,y_out)reference to variables to receive the result of the conversion in internal co-ordinate.

◆ extent()

TSLEnvelope TSLRenderingInterface::extent ( )

Returns the current TMC extent displayed on the drawing surface. This is not necessarily the same as the area being rendered.

◆ extentExceedsDU()

bool TSLRenderingInterface::extentExceedsDU ( const TSLEnvelope & extentInTMC)

Check for numeric overflow in screen space.

When zoomed in on a large entity, the extent of the entity may exceed the device unit coordinate space. This is an operating system dependent limit, typically 16 bit values. If the specified TMC extent would surpass these limits, then the transformation may cause distortion of the rendered object due to coordinates wrapping round.

If this method returns true, then the caller must take proper steps to ensure that the image is displayed correctly.

Returns true if the TMC extent passed in would exceed the device coordinate limits given the current view.

◆ getIDofNearestColour()

TSLStyleID TSLRenderingInterface::getIDofNearestColour ( int red,
int green,
int blue )

Returns ID of the nearest colour to the specified RGB values. This will be an index in the currently loaded palette.

◆ handleToDrawable() [1/2]

TSLDeviceContext TSLRenderingInterface::handleToDrawable ( ) const

Query the handle to the drawable. Microsoft Windows specific method

This allows the called to directly draw to the handle that is attached to the TSLDrawingSurface, bypassing the MapLink rendering.

Returns a HDC under Windows.

◆ handleToDrawable() [2/2]

TSLDrawableHandle TSLRenderingInterface::handleToDrawable ( TSLDisplayHandle & xDisplay) const

Query the handle to the drawable. X11 specific function.

This allows the called to directly draw to the handle that is attached to the TSLDrawingSurface, bypassing the MapLink rendering.

Parameters
xDisplayThe Display* is stored in this parameter by the method.
Returns
handle to the associated Drawable under X.

◆ handleToX11DrawingParameters()

bool TSLRenderingInterface::handleToX11DrawingParameters ( TSLVisualHandle & visual,
TSLScreenHandle & screen,
TSLColourmapHandle & colourmap ) const

This method is specific to X11.

The method provides access to the additional parameters passed into the associated Drawing Surface on construction.

These parameters will not change unless you do an attach or detach on the Drawing Surface.

The Drawable should always be queried as this will more then likely change. The drawable and Display connection can be queried via handleToDrawable().

Parameters
visualA TSLVisualHandle reference.This is used to store a pointer to a Visual.
screenA TSLScreenHandle reference. This is used to store a pointer to a Screen.
colourmapA TSLColourmapHandle reference. This is used to store the colourmap identifier.
Note
Depth is available via the Visual and Screen structures.
Returns
true if data is returned, false otherwise.

◆ isDecluttered()

bool TSLRenderingInterface::isDecluttered ( const char * featureName,
TSLFeatureID featureID ) const

Returns the Decluttered status of the feature.

Can pass in the featureName or the featureID. The featureID takes precedence over the featueName.

◆ notifyRenderExtent()

void TSLRenderingInterface::notifyRenderExtent ( const TSLEnvelope & extent)

Notifies the rendering interface of the extent about to be rendered.

This method should be called before rendering commences. It allows the TSLDrawingSurface to use optimised integer maths to allow fast display.

Parameters
extentExtent about to be rendered.

◆ queryCoordinateSystem()

const TSLCoordinateSystem * TSLRenderingInterface::queryCoordinateSystem ( ) const

Returns the TSLCoordinateSystem for the associated Drawing Surface's Coordinate Providing Layer.

If the associated Drawing Surface does not have a Coordinate Providing DataLayer or the layer does not have a valid Coordinate System, NULL is returned.

◆ queryScaledLatLongCoordinateSystem()

const TSLCoordinateSystem * TSLRenderingInterface::queryScaledLatLongCoordinateSystem ( ) const

Returns the Data TSLCoordinateSystem when realtime re-projection is enabled for the layer.

If the associated Drawing Surface does not have a Coordinate Providing DataLayer or the layer does not have a valid Data Coordinate System, NULL is returned.

◆ realtimeReprojectionActive()

bool TSLRenderingInterface::realtimeReprojectionActive ( ) const

Returns true if the layer being drawn is being realtime re-projected.

The draw pass can be queried by calling drawMode().

◆ rotation()

double TSLRenderingInterface::rotation ( ) const

Returns the current rotation angle of the view. This is in radians, +ve anti-clockwise from the +ve X axis.

◆ rotationActive()

bool TSLRenderingInterface::rotationActive ( ) const

Return true if the view is rotated.

◆ rotationCentre()

TSLCoord TSLRenderingInterface::rotationCentre ( ) const

Returns the current centre of rotation.

◆ scaledLatLonDrawingExtent()

bool TSLRenderingInterface::scaledLatLonDrawingExtent ( TSLEnvelope & left,
TSLEnvelope & right ) const

This method allows the caller to query the extent of the area being displayed as scaled latitude and longitude, if realtime re-projection is enabled for the layer.

The extent passed to the drawLayer() is the TMC extent of the currently displayed area. The TMC extent can be converted to latitude/longitude using the TSLCoordinateSystem returned by queryCoordinateSystem().

When realtime re-projection is active the data is stored as a scaled latitude and longitude.

This means that when drawing we need to take account of the dateline and thus we need to know what the left and right extents.

Parameters
leftis the extent to the left of the screen. If the width and height is zero this extent should be ignored.
rightis the extent to the right of the screen. if the width and height is zero this extent should be ignored.
Returns
true, if the left and/or right extent have been populated.

◆ screenResolution()

void TSLRenderingInterface::screenResolution ( double & xr,
double & yr ) const

Query the current view resolution, in both X and Y axis. These are usually the same value, but may differ when Dynamic Arc projections are used.

Parameters
xrStorage for X axis internal TMC units per Device Unit
yrStorage for Y axis internal TMC units per Device Unit

◆ setupAreaAttributes()

bool TSLRenderingInterface::setupAreaAttributes ( TSLStyleID style,
TSLStyleID colour,
short opacity = -1,
TSLStyleID backgroundColour = 0 )

Setup the attributes to be used when rendering an area.

Parameters
styleFill style of object, index as specified via TSLDrawingSurface::setupFillstyles. 0 is no fill.
colourFill colour of object, index as specified via TSLDrawingSurface::setupColours. 0 is no fill

The following parameters are reserved for future enhancements

Parameters
opacityreserved
backgroundColourreserved
Returns
true if should be rendered, false otherwise.

◆ setupEdgeAttributes()

bool TSLRenderingInterface::setupEdgeAttributes ( TSLStyleID style,
TSLStyleID colour,
double thickness,
TSLDimensionUnits thicknessUnits = TSLDimensionUnitsPixels,
int passNumber = 0,
bool * morePassesRequired = 0,
TSLEdgeJoinStyle joinStyle = TSLEdgeJoinStyleUndefined,
TSLEdgeEndCapStyle endCapStyle = TSLEdgeEndCapStyleUndefined,
short opacity = -1 )

Setup the attributes to be used when rendering an edge.

Parameters
styleEdge style of object, index as specified via TSLDrawingSurface::setupEdgestyles. 0 is no edge.
colourEdge colour of object, index as specified via TSLDrawingSurface::setupColours. 0 is no edge.
thicknessWidth of edge in device units or map units. 0 is no edge.
thicknessUnitsEnum value specifying the line thickness units e.g. Map units, Pixels etc.
passNumberThe number of the current pass. This is used for rendering complex line styles, such as those for representing major roads etc.
morePassesRequiredThis parameter is used to determine whether another rendering pass is required when rendering complex line styles. Set to true if another pass is required.

The following parameters are reserved for future enhancements

Parameters
joinStylereserved
endCapStylereserved
opacityreserved
Returns
true if the object should be rendered, false otherwise.

◆ setupSymbolAttributes()

bool TSLRenderingInterface::setupSymbolAttributes ( TSLStyleID style,
TSLStyleID colour,
double sizeFactor = 1.0,
TSLDimensionUnits sizeFactorUnits = TSLDimensionUnitsMapUnits,
TSLDeviceUnits minPixelSize = 1,
TSLDeviceUnits maxPixelSize = 2000,
double orientation = 0.0,
uint32_t fontCharacter = -1,
short opacity = -1,
TSLSymbolRotation symbolRotation = TSLSymbolRotationEnabled )

Setup the attributes to be used when rendering a symbol.

Parameters
styleSymbol style of object, index as specified via TSLDrawingSurface::setupSymbols. 0 is no symbol.
colourColour of object, index as specified via TSLDrawingSurface::setupColours. 0 is no symbol. Note that this will not apply to TMF or raster symbols, only vector symbols.
sizeFactorSpecifies a scaling factor for the symbol size. Defaults to 1.0.
sizeFactorUnitsSpecifies the units to use for sizing the symbol, e.g. Map Units, pixels etc.
minPixelSizeSpecifies the minimum pixel size for the symbol.
maxPixelSizeSpecifies the maximum pixel size for the symbol.
orientationRotation of symbol in radians, +ve anti-clockwise from the +ve X axis.
fontCharacterWhen using a font symbol, this character will be displayed in the font defined by the font symbol style. For all other symbol types, this value will be ignored.
symbolRotationThe type of rotation to use when drawing symbols. If set to TSLSymbolRotationEnabled, symbols will be rotated with the drawing surface. If set to TSLSymbolRotationDisabled symbols will not be rotated with the drawing surface.

The following parameters are reserved for future enhancements:

Parameters
opacityreserved
Returns
true if the object should be rendered, false otherwise.
Note
For fixed pixel size symbols set sizeFactorUnits to TSLDimensionUnitsPixels and set both the min/maxPixelSize parameters to the desired height.

◆ setupTextAttributes()

bool TSLRenderingInterface::setupTextAttributes ( TSLStyleID font,
TSLStyleID colour,
double sizeFactor = 1.0,
TSLDimensionUnits sizeFactorUnits = TSLDimensionUnitsMapUnits,
TSLDeviceUnits minPixelHeight = 1,
TSLDeviceUnits maxPixelHeight = 2000,
double offsetX = 0.0,
double offsetY = 0.0,
TSLDimensionUnits offsetUnits = TSLDimensionUnitsUndefined,
double orientation = 0.0,
TSLHorizontalAlignment halignment = TSLHorizontalAlignmentLeft,
TSLVerticalAlignment valignment = TSLVerticalAlignmentFullBottom,
TSLTextBackgroundMode backgroundMode = TSLTextBackgroundModeNone,
TSLStyleID backgroundFillStyle = 0,
TSLStyleID backgroundFillOrHaloColour = 0,
TSLStyleID backgroundEdgeColour = 0,
TSLTextRotation textRotation = TSLTextRotationEnabled,
short opacity = -1,
TSLStyleID fillStyle = 0,
TSLStyleID fillBackgroundColour = 0,
float complexHaloRadius = -1.0f,
TSLDimensionUnits complexHaloUnits = TSLDimensionUnitsUndefined )

Setup the attributes to be used when rendering text.

Parameters
fontFont style of object, index as specified via TSLDrawingSurface::setupFonts. 0 is no text.
colourColour of object, index as specified via TSLDrawingSurface::setupColours. 0 is no text.
sizeFactorSpecifies the scaling factor for the text.
sizeFactorUnitsSpecifies the units to use for the text height, e.g. Map Units, Pixels etc.
minPixelHeightSpecifies the minimum height for the text in pixels.
maxPixelHeightSpecifies the maximum height for the text in pixels.
offsetXSpecifies a horizontal offset for positioning the text. How this offset is applied depends on the 'offsetUnits' and 'textRotation' arguments.
offsetYSpecifies a vertical offset for positioning the text. How this offset is applied depends on the 'offsetUnits' and 'textRotation' arguments.
offsetUnitsSpecifies the units to use when calculating the X and Y offsets specified in the previous two parameters.
orientationRotation of text in radians, +ve anti-clockwise from the +ve X axis. Note that on Unix, only vector fonts may be rotated. If the 'textRotation' parameter is set to TSLTextRotationDisabled, this parameter is ignored.
halignmentHorizontal text alignment.
valignmentVertical text alignment.
backgroundModeSpecifies the type of background for the text, e.g. None, Halo, Rectangle etc.
backgroundFillStyleSpecifies the fill style for the text background,
backgroundFillOrHaloColourSpecifies the fill colour for the text background.
backgroundEdgeColourSpecifies the edge colour for the text background.
textRotationThe type of rotation to use when drawing text. If set to TSLTextRotationEnabled, text will be rotated with the drawing surface, and the X/Y offsets will be geographic. If set to TSLTextRotationDisabled, text will always be drawn horizontal, and the X/Y offsets will be relative to the screen.

The following parameters are reserved for future enhancements

Parameters
opacityreserved
fillStylereserved
fillBackgroundColourreserved
complexHaloRadiusreserved
complexHaloUnitsreserved
Returns
true if the object should be rendered, false otherwise.
Note
For fixed pixel size text set sizeFactorUnits to TSLDimensionUnitsPixels and set both the min/maxPixelSize parameters to the desired height.

◆ TMCPerDU()

void TSLRenderingInterface::TMCPerDU ( TSLTMC & xr,
TSLTMC & yr ) const

Query the current view resolution, in both X and Y axis. These are usually the same value, but may differ when Dynamic Arc projections are used.

This method is the same as screenResolution, but added for naming consistency.

Parameters
xrStorage for X axis internal TMC units per Device Unit
yrStorage for Y axis internal TMC units per Device Unit

◆ TMCPerMU()

double TSLRenderingInterface::TMCPerMU ( ) const

Returns the number of internal (TMC) coordinates per map unit.

◆ TMCToDU() [1/2]

void TSLRenderingInterface::TMCToDU ( int num,
TSLTMC * x_ins,
TSLTMC * y_ins,
TSLDeviceUnits * x_outs,
TSLDeviceUnits * y_outs ) const

This method converts a set of internal co-ordinate values to their device unit (usually in pixel) values.

Parameters
(num)the number of co-ordinates to convert.
(x_ins,y_ins)incoming internal co-ordinates
(x_outs,y_outs)array to receive the results of the conversions in device units. These arrays should be large enough to hold num values.

◆ TMCToDU() [2/2]

void TSLRenderingInterface::TMCToDU ( TSLTMC x_in,
TSLTMC y_in,
TSLDeviceUnits * x_out,
TSLDeviceUnits * y_out ) const

This method converts an internal co-ordinate value to a device unit (usually in pixel) value.

Parameters
(x_in,y_in)incoming internal co-ordinate
(x_out,y_out)reference to variables to receive the result of the conversion in device unit.

◆ TMCToDuAccurate() [1/2]

void TSLRenderingInterface::TMCToDuAccurate ( double & x,
double & y ) const

This method converts an internal co-ordinate value to a device unit (usually in pixel) value.

This differs from TMCToDu, since the values returned are double-precision, not rounded, and may exceed the operating system dependent device unit limits.

Parameters
(x,y)Co-ordinate reference. It is modified with the DU coordinates.

◆ TMCToDuAccurate() [2/2]

void TSLRenderingInterface::TMCToDuAccurate ( int num,
double * xs,
double * ys ) const

This method converts a set of internal co-ordinate values to their equivalent device unit (usually in pixel) values.

This differs from TMCToDu, since the values returned are double-precision, not rounded, and may exceed the operating system dependent device unit limits.

Parameters
(num)The number of co-ordinates to convert.
(xs,ys)Array of co-ordinates. It is modified with the equivalent DU coordinates.

◆ type()

TSLDrawingSurfaceTypeEnum TSLRenderingInterface::type ( ) const

This method returns the type of the drawing surface.

There is no way of obtaining the actual Drawing Surface via the Rendering Interface. If necessary a pointer may be stored to the Drawing Surface using the userWord method on the Drawing Surface and accessed via the userWord method on the Rendering Interface.

◆ userWord()

void * TSLRenderingInterface::userWord ( ) const

Returns a pointer to the user data stored on the drawing surface.