User Tools

Site Tools


api:dk11:net:tatukgis.ndk.tgis_templateprint

TGIS_TemplatePrint class

DK11 for .NET | TatukGIS.NDK.TGIS_TemplatePrint | Classes | Constructors | Methods | Properties

Encapsulation of template based printing according to *.tpl file.

Available also on: Delphi | Java | ActiveX.

Syntax

// C#
public class TGIS_TemplatePrint 
{
}
' VisualBasic
Public Class TGIS_TemplatePrint
End Class
// Oxygene
type
  TGIS_TemplatePrint = public class
  end;

Constructors

Inherited Overrides Protected
Name Visibility Description
TGIS_TemplatePrint() public Create an instance.

Methods

Inherited Overrides Protected
Name Visibility Description
Dispose public Destroy an instance and free all items.
Reset public Clear all object and texts assigned to template.

Properties

Inherited Protected
Name Visibility Description
GIS_Legend public The TGIS_ControlLegend object attached to the template.
GIS_NorthArrow public The TGIS_ControNorthArrow object attached to the template.
GIS_Scale public The TGIS_ControScale object attached to the template.
GIS_Viewer public The TGIS_Viewer object attached to the template.
GIS_ViewerExtent public Map Extent to be used for printing.
GIS_ViewerScale public Map Scale to be used for printing.
TemplatePath public Path to the template file.
TemplateStream public Stream with the template file.
TemplateText public Text with the template file content.
Text public The text attached to the template.

Remarks

Structure of this file in ini format must be:

 [TatukGIS PrintTemplate]
 PAGESIZE=pagewidth,pageheight
 GRAPHICm=left,top,right,bottom,path
 TEXTn=left,top,right,bottom,alignment,color,fontname,fontsize,fontstyle,charset,value,bgColor,bgWidth
 BOXn=left,top,right,bottom,color
 FRAMEn=left,top,right,bottom,color,width
 MAPn=left,top,right,bottom
 LEGENDn=left,top,right,bottom
 SCALEn=left,top,right,bottom
 NORTHARROWn=left,top,right,bottom

or in xml format must be:

<?xml version="1.0" encoding="windows-1250" standalone="yes"?>
<TatukGIS>
 <PrintTemplate>
  <PAGESIZE width="" height=""/>
  <FRAME name="" left="" top="" right="" bottom="" color="" width=""/>
  <GRAPHIC name="" left="" top="" right="" bottom="" path=""/>
  <TEXT index="" name="" left="" top="" right="" bottom="" alignment="" color="" font="" fontSize="" fontStyle="" text="" bgColor="" bgWidth="" />
  <BOX name="" left="" top="" right="" bottom="" color=""/>
  <MAP index="" name="" left="" top="" right="" bottom=""/>
  <SCALE index="" name="" left="" top="" right="" bottom=""/>
  <NORTHARROW index="" name="" left="" top="" right="" bottom=""/>
  <LEGEND index="" name="" left="" top="" right="" bottom=""/>
 </PrintTemplate>
</TatukGIS>
Element Description
PAGESIZE size of the page (valid only for TGIS_PrinterPDF) device
GRAPHIC graphic (bmp, wmf) placeholder
TEXT text placeholder
BOX filled box placeholder
FRAME frame placeholder
MAP TGIS_Viewer object placeholder
LEGEND TGIS_ControlLegend object placeholder
SCALE TGIS_ControlScale object placeholder
NORTHARROW TGIS_ControlNorthArrow object placeholder
parameters description
pagewidth width; can be expressed in twips (default), pixels (px), centimeters (cm), millimeters (mm), point (pt) and inches (in)
pageheight height; can be expressed in twips (default), pixels (px), centimeters (cm), millimeters (mm), point (pt) and inches (in)
name name of element
index index of element value read from TGIS_TemplatePrint properties like GIS_Viewer, GIS_ViewerExtent, GIS_ViewerScale, GIS_Legend, GIS_Scale, GIS_NorthArrow, Text
left placeholder position; can be expressed in twips (default), pixels (px), centimeters (cm), millimeters (mm), point (pt) and inches (in); if expressed with '*' then calculation will be performed relative to printer margins; if expressed without '*' then calculations will be performed relative to page size; positive values are relative to left border, negative to right
top placeholder position; can be expressed in twips (default), pixels (px), centimeters (cm), millimeters (mm), point (pt) and inches (in); if expressed with '*' then calculation will be performed relative to printer margins; if expressed without '*' then calculations will be performed relative to page size; positive values are relative to top border, negative to bottom
right placeholder position; can be expressed in twips (default), pixels (px), centimeters (cm), millimeters (mm), point (pt) and inches (in); if expressed with '*' then calculation will be performed relative to printer margins; if expressed without '*' then calculations will be performed relative to page size; positive values are relative to left border, negative to right
bottom placeholder position; can be expressed in twips (default), pixels (px), centimeters (cm), millimeters (mm), point (pt) and inches (in); if expressed with '*' then calculation will be performed relative to printer margins; if expressed without '*' then calculations will be performed relative to page size; positive values are relative to top border, negative to bottom
width element width; can be expressed in twips (default), pixels (px), centimeters (cm), millimeters (mm), point (pt) and inches (in)
path path to the graphic file; relative to template file location
color color of the item; can be: integer value (BGR), red:green:blue (eg. 213:24:58) or AQUA, GRAY, NAVY, SILVER, BLACK, GREEN, OLIVE, TEAL, BLUE, LIME, PURPLE, WHITE, FUCHSIA, MAROON, RED, YELLOW
alignment text alignment within placeholder; can be: LEFTJUSTIFY, CENTER, RIGHTJUSTIFY
fontname font name; if empty then Arial will be used
fontsize size of the font in points
fontstyle font style; can be: val1:val2:…:valN (eg. BOLD:ITALIC) from set of NORMAL, BOLD, ITALIC, UNDERLINE, STRIKEOUT
charset font character set; IGNORED!
text text to be displayed, can be overwritten by text provided in TGIS_TemplatePrint.Text property
bgColor background color of text rectangle, expressed like color
bgWidth background border width, expressed like width

Sample file in ini format:

[TatukGIS PrintTemplate]
; PAGESIZE can be set only on PDF device
PAGESIZE=210.00mm,297.00mm

; place graphic and text at the top
GRAPHIC1= *1.00cm, *0.75cm, *5.00cm, *2.25cm,"logo_outline.WMF"

; place text at the top
TEXT1=    *5.00cm, *0.75cm,*-0.75cm, *3.00cm,RIGHTJUSTIFY,NAVY,,38,BOLD:ITALIC,ANSI,

; place text at the top
TEXT2=    *0.75cm,*-0.50cm,*-0.75cm,*-0.02cm,RIGHTJUSTIFY,BLACK,,8,,DEFAULT,My Text

; draw background border for the map & the map itself
BOX1=     *0.75cm, *3.00cm,*-6.75cm,*-0.75cm,Blue
BOX2=     *0.85cm, *3.10cm,*-6.85cm,*-0.85cm,Yellow
MAP1=     *1.00cm, *3.25cm,*-7.00cm,*-1.00cm

; draw background border for the legend & the legend itself
BOX3=    *-6.50cm, *3.00cm,*-0.75cm,*-0.75cm,Blue
BOX4=    *-6.40cm, *3.10cm,*-0.85cm,*-0.85cm,Yellow
;white background because legend is transparent by default
BOX5=    *-6.25cm, *3.25cm,*-1.00cm,*-1.00cm,White
LEGEND1= *-6.15cm, *3.30cm,*-1.00cm,*-1.00cm

; draw thin line around the map
FRAME1=   *0.01cm, *0.01cm,*-0.01cm,*-0.01cm,BLACK,0.01mm

Sample file in xml format:

<?xml version="1.0" encoding="windows-1250" standalone="yes"?>
<TatukGIS>
 <PrintTemplate>
  <!-- PAGESIZE can be set only on PDF device-->
  <PAGESIZE width="297.00mm" height="210.00mm"/>	
  <!-- draw thin line around the map-->
  <FRAME name="frame1" left="*0.02cm" top="*0.02cm" right="*-0.02cm" bottom="*-0.01cm" color="BLACK" width="0.01mm"/>
  <!-- place graphic and text at the top-->
  <GRAPHIC name="logo1" left="*0.75cm" top="*0.25cm" right="*3.25cm" bottom="*2.75cm" path="DK_logo.png"/>	
  <!-- place text at the top-->
  <TEXT index="1" name="text1" left="*10.00cm" top="*0.75cm" right="*-0.75cm" bottom="*3.00cm" alignment="LEFTJUSTIFY" color="NAVY" font="Arial" fontSize="30" fontStyle="BOLD:ITALIC" text="My text" bgColor="255:255:255:255" bgWidth="0.01mm"/>	
  <!-- place text at the top-->
  <TEXT index="2" name="text2" left="*0.75cm" top="*1.85cm" right="*-0.75cm" bottom="*3.85cm" alignment="RIGHTJUSTIFY" color="BLACK" fontSize="18"/>
  <!-- place text at the bottom-->
  <TEXT index="3" name="text3" left="*0.75cm" top="*-0.50cm" right="*-0.75cm" bottom="*-0.02cm" alignment="RIGHTJUSTIFY" color="BLACK" fontSize="10"/>	
  <!-- draw backround border for the map & the map itself-->
  <BOX name="box1" left="*0.75cm" top="*3.00cm" right="*-6.75cm" bottom="*-0.75cm" color="Blue"/>
  <BOX name="box2" left="*0.85cm" top="*3.10cm" right="*-6.85cm" bottom="*-0.85cm" color="Yellow"/>
  <MAP index="1" name="gis" left="*1.00cm" top="*3.25cm" right="*-7.00cm" bottom="*-1.00cm"/>	
  <!-- draw the scale-->
  <SCALE index="1" name="scale" left="*-15.00cm" top="*-2cm" right="*-7.00cm" bottom="*-1.00cm"/>	
  <!-- draw the nort harrow-->
  <NORTHARROW index="1" name="northarrow" left="*-9.00cm" top="*3.25cm" right="*-7.00cm" bottom="*5.25cm"/>	
  <!-- draw background border for the legend & the legend itself-->
  <BOX name="box3" left="*-6.50cm" top="*3.00cm" right="*-0.75cm" bottom="*-0.75cm" color="Blue"/>
  <BOX name="box4" left="*-6.40cm" top="*3.10cm" right="*-0.85cm" bottom="*-0.85cm" color="Yellow"/>
  <!--white background because legend is transparent by default-->
  <BOX name="box5" left="*-6.25cm" top="*3.25cm" right="*-1.00cm" bottom="*-1.00cm" color="White"/>
  <LEGEND index="1" name="legend" left="*-6.15cm" top="*3.30cm" right="*-1.00cm" bottom="*-1.00cm"/>	
 </PrintTemplate>
</TatukGIS>

References

2019/03/08 22:17