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

Detailed Description

This utility class contains static methods to support printing.

Current methods support printing of multiple drawing surfaces via a print template. The print template is drawn using an editor. It should contain one or more item templates. These are rectangles, referenced by name, which indicate where on the page a drawing surface may be placed. Item templates may be embedded in the print template when it is loaded, or added at run-time using the 'addItemTemplate' method. In this way, items may be moved dynamically around the printed page.

Note that the layers are copied from the Drawing Surfaces specified in the TSLPrintItems to an internal one held within the Print Helper class. This means that any 'id' on the specified Drawing Surfaces will not be available during the print.

Note
: This class is not supported on non-Windows platforms.

Static Public Member Functions

static bool addItemTemplate (TSLEntitySet *printTemplate, const TSLEnvelope &templateExtent, const char *templateName="map")
 
static bool itemTemplateExtent (const TSLEntitySet *printTemplate, TSLEnvelope &templateExtent, const char *templateName="map")
 
static TSLEntitySetloadTemplate (const char *name, TSLFileLoader *loader=0, TSLPathList *pathlist=0)
 
static bool printUsingTemplate (TSLPrintContext &context, int numItems, const TSLPrintItem *items, const TSLEntitySet *printTemplate, int numTextMappings, const char *textMapping[][2], bool newPage=false, bool printTemplateFirst=true)
 

Member Function Documentation

◆ addItemTemplate()

static bool TSLPrintHelper::addItemTemplate ( TSLEntitySet * printTemplate,
const TSLEnvelope & templateExtent,
const char * templateName = "map" )
static

Adds a new item template rectangle to the specified print template.

An item template specifies where on the printed page an item (drawing surface) should be printed.

Essentially, this method adds a named rectangle to the print template. The name is used it indicate which rectangle a particular drawing surface should be printed in.

Parameters
printTemplateThis is the print template. It may be loaded using loadTemplate or created dynamically using TSLEntitySet::create. Geometry added to a printTemplate will be rendered.
templateExtentExtent, in TMC units, of the item template. This defines the position and size, within the printTemplate, where an item should be printed.
templateNameName to attach to the item template rectangle. This is used when items are specified.
Returns
true on success, false otherwise.

◆ itemTemplateExtent()

static bool TSLPrintHelper::itemTemplateExtent ( const TSLEntitySet * printTemplate,
TSLEnvelope & templateExtent,
const char * templateName = "map" )
static

Query for extent of template item.

The extent returned is the TMC extent of the named item template rectangle. It may be used when calculating positions for other items, or when performing scaling calculations.

Parameters
printTemplatethe template to query
templateExtentStorage for returned extent
templateNameName of item template rectangle. Defaults to 'map'
Returns
true on success, false otherwise.

◆ loadTemplate()

static TSLEntitySet * TSLPrintHelper::loadTemplate ( const char * name,
TSLFileLoader * loader = 0,
TSLPathList * pathlist = 0 )
static

Loads specified template.

Parameters
nameFilename of template to load
loaderFile loader to use, 0 if default.
pathlistPath list to use, 0 if default (if filename is fully qualified, for example if TSLDrawingSurface::findFile used).
Returns
template on success, 0 otherwise.

◆ printUsingTemplate()

static bool TSLPrintHelper::printUsingTemplate ( TSLPrintContext & context,
int numItems,
const TSLPrintItem * items,
const TSLEntitySet * printTemplate,
int numTextMappings,
const char * textMapping[][2],
bool newPage = false,
bool printTemplateFirst = true )
static

This method allows printing of multiple drawingSurfaces using a page template to provide a frame.

Multiple items may be printed, for example a main map, with additional overlaid enlargements. Text mappings may be made which convert placeholder text in the framework template to new text. For example, a copyright message in the template may be kept up to date by adding some placeholder text in the template, say 'YEAR'. By supplying a text mapping of 'YEAR' to '2001', the copyright message may be modified dynamically without editing the framework

Parameters
contextPrint context to print to. HDC on Windows.
numItemsThis is the number of items to be printed within the template.
itemsThis points to an array of the items required to be printed.
printTemplateThis is the entity set containing the framework of the printed page.
numTextMappingsNumber of text mappings supplied.
textMappingArray of text mappings, with the framework text first, followed by the new text.
newPageIf the flag is true, then startPage/endPage calls are made.
printTemplateFirstIf the flag is true, then the template is printed before the items, otherwise it is printed afterwards.
Returns
true if successful, false otherwise.
Note
Not supported on X11 targets.