All Cadcorp SIS API Methods

RenderTile Method

Description

Renders and caches the specified tile at the specified level into an image.

Syntax

Visual Basic
Public Function RenderTile( _
   ByVal strFormat As String, _
   ByVal level As Integer, _
   ByVal x As Integer, _
   ByVal y As Integer, _
   ByVal mode As Integer _
) As Integer

Parameters

strFormat
The format you want the image to be rendered in. The valid formats are:
image/jpeg JPEG is suitable for photographs, and is understood by almost all browsers.
image/gif GIF is suitable for displaying linework and is preferable to JPEG.
image/png PNG is the preferred format, suitable for displaying a mixture of vector and raster data, and understood by latest versions of most browsers.
image/x-MS-bmp Windows BMP is an image file format understood by almost all browsers.
application/x-msmetafile Windows Meta File is understood by Internet Explorer and other browsers.
application/pdf;PaperFormat=… PDF will normally require a browser plugin. The PaperFormat parameter is mandatory; additional standard PDF formatting parameters can be supplied.

The following list gives the parameter names and values for image formats:

PhotometricInterpretation: (for PNG only, GIF & JPEG are implicitly PaletteColor)
- PaletteColor
- RGB
- RGBA

DitherPalette: (for PaletteColor only)
- ColorCube125
- ColorCube216
- BlackWhite
- GrayScale/GreyScale
- Adaptive
- OctTree
- Custom
- a literal palette, in the form RRGGBBRRGGBBRRGGBBRRGGBB....

DitherAlgorithm: (for PaletteColor only)
- Default
- SystemSnap
- SystemDither
- PaletteSnap
- FloydSteinberg

Transparent: (for PaletteColor and RGB only)
- True
- False

BGColor: (for PaletteColor and RGB only)
- RGB color in format 0xRRGGBB

Quality: (for JPEG only)
- number from 1 to 10

 

level
level 0 corresponds to a scale of 1:1, Level 8 corresponds to a scale of 1:10, Level 16 corresponds to a scale of 1:100 and so on.

The intermediate levels (1 to 7, 9-15, and so on) have scale multipliers 1.25, 2.5, 3.75, 5.0, 6.25, 7.5 and 8.75.

The size of a map extent which is covered by a tile depends not only on the coordinate reference system, but also on the setting of the _outputDpi& system variable. The maximum cache size is configured with the registry value MaxMapCacheSize, specified in Megabytes. The default value is 16MB.

x, y
These values define the tile location at the current level. The tile at x=0, y=0 has its lower-left corner at the origin of the coordinate system. Tiles always have a width and height of 256 pixels. To calculate the tile extent in coordinate system units at scale 1:1 (= level 0), use these expressions:
 
double toMetre = GetPrjScaleAtCentre("current prj");
double pixmm = 25.4 / GetInt("_OutputDPI&");
double tileWH = 256 * pixmm / 1000.0 / toMetre;

At larger levels, multiply with the scale factor corresponding to the level.
The tile at (level, x, y) has its lower-left corner at:
 
(x*tileWH*scale[level], y*tileWH*scale[level])

and its upper-right corner at:

((x+1)*tileWH*scale[level], (y+1)*tileWH*scale[level])
 
mode
SIS_RF_BACKGROUND draws the background SWD
SIS_RF_FOREGROUND draws the foreground SWD
SIS_RF_WATERMARK draws the watermark as specified by the GeognoSIS manager

This is a bitfield, so any of the constants can be combined by bit-wise OR.

Remarks

Available: GEO

Groups:

Example

sis.RenderTile ("image/png", level, posX + X, posY + Y, SIS_RF_BACKGROUND)

Some example format strings with parameters:

image/png;PhotometricInterpretation=RGB
image/png;PhotometricInterpretation=PaletteColor,DitherPalette=OctTree
image/png;PhotometricInterpretation=PaletteColor,DitherPalette=OctTree,DitherAlgorithm=SystemSnap
image/gif;DitherPalette=OctTree,DitherAlgorithm=SystemSnap
image/jpeg;Quality=95
application/pdf;paperformat=A4,... + the usual parameters