|
"http://www.w3.org/TR/html40/loose.dtd">
Table of Contents
Class: PDFMap
|
pdfmap.py |
Our Map class.
Methods
|
|
|
|
__del__
|
__del__ ( self )
Frees some more memory.
|
|
__init__
|
__init__ (
self,
author,
title,
subtitle,
papersize,
extremequality=0,
)
Initialize a PDF Map.
|
|
__str__
|
__str__ ( self )
Returns the PDF document as a string of text.
|
|
_available_shapes
|
_available_shapes ( self )
Returns the list of available shapes as defined in this module.
|
|
_draw_call_logo
|
_draw_call_logo ( self )
|
|
_draw_grid
|
_draw_grid ( self )
Draws the grid on the page.
|
|
_draw_legend
|
_draw_legend (
self,
config,
total,
rejected,
)
Draws the map legend.
|
|
_draw_north
|
_draw_north ( self )
Draws the North arrow.
|
|
_draw_object
|
_draw_object ( self, linesplit )
Draws an object on the map.
linesplit : a tuple containing the corresponding
entry in the configuration file and
the fields from the input file : (confobject, [ nature, x, y, length, width, orientation, url ])
|
|
_draw_scales
|
_draw_scales ( self )
Draws the x and optionally y scales.
This code is actually deactivated.
|
|
_draw_titles
|
_draw_titles ( self )
Draws the different titles and copyright messages.
|
|
_read_config
|
_read_config ( self, filename )
Reads a configuration file and returns a Python dictionnary.
Exceptions
|
|
PDFMapError, "%s : file doesn't exist" % filename
PDFMapError, "Error in configuration file %s\n\tduplicated line : '%s'" %( filename, confline )
PDFMapError, "Error in configuration file %s\n\tincomplete line : '%s'" %( filename, confline )
PDFMapError, "Error in configuration file %s\n\tinvalid Magnify field : '%s'" %( filename, confline )
PDFMapError, "Error in configuration file %s\n\tinvalid MaximalSize field : '%s'" %( filename, confline )
|
PDFMapError, "Error in configuration file %s\n\tinvalid MinimalSize field : '%s'" %( filename, confline )
PDFMapError, "Error in configuration file %s\n\tinvalid RGBin field : '%s'" %( filename, confline )
PDFMapError, "Error in configuration file %s\n\tinvalid RGBout field : '%s'" %( filename, confline )
PDFMapError, "Error in configuration file %s\n\tinvalid Thickness field : '%s'" %( filename, confline )
PDFMapError, "Error in configuration file %s\n\tunknown shape type : '%s'" %( filename, confline )
|
|
|
|
_splitline
|
_splitline (
self,
configuration,
line,
)
Splits a data line, trying to be intelligent about the line format at the same time.
The datas read from the input file must be of the form :
nature x y length width orientation url
or nature,x,y,length,width,orientation,url
or nature;x;y;length;width;orientation;url
or all the fields separated by any amount of whitespace
The url field is optionnal.
Exceptions
|
|
PDFMapError, "Nature %s unknown and no DEFAULT entry in configuration file" % nature
|
|
|
draw_datas
|
draw_datas (
self,
configfile,
inputfile,
legend=1,
)
Draws all objects of an input file on the map.
configfile : the configuration file name
inputfile : the datas file name or handle,
or "-" or None which both mean sys.stdin
legend : 1 indicates that we want a legend, 0 that we don't
Exceptions
|
|
PDFMapError, "%s : file doesn't exist" % inputfile
PDFMapError, "%s : invalid configuration file" % configfile
|
|
|
endpage
|
endpage ( self )
Ends the previous page and creates a new one.
|
|
formatpage
|
formatpage (
self,
orientation="portrait",
leftmargin="1.5cm",
bottommargin="1.5cm",
rightmargin="1.5cm",
topmargin="1.5cm",
)
Set the page orientation and margins.
The page dimensions are set from the constructor's papersize
parameter, because having multiple different page sizes is
probably possible but not convenient for printing. However
having a different orientation from page to page is
interesting.
orientation : "portrait" or "landscape", defaults to "portrait"
leftmargin : left margin, defaults to 1.5cm
bottommargin : bottom margin, defaults to 1.5cm
rightmargin : right margin, defaults to 1.5cm
topmargin : top margin, defaults to 1.5cm
Exceptions
|
|
PDFMapError, "Invalid bottommargin %s" % bottommargin
PDFMapError, "Invalid leftmargin %s" % leftmargin
PDFMapError, "Invalid rightmargin %s" % rightmargin
PDFMapError, "Invalid topmargin %s" % topmargin
|
|
|
initpage
|
initpage (
self,
background,
xorigin,
yorigin,
xscale,
yscale,
xstep,
ystep,
rotation,
)
Creates a new page in the PDF document.
background : a MapBackground object
xorigin, yorigin : origin coordinates in meters
xscale, yscale : x and y scales (e.g. 1.0/25000.0)
xstep, ystep : grid cell's dimensions in meters
rotation : orientation wrt. the North, in degres.
|
|
output
|
output ( self, file="-" )
Outputs the PDF document to the specified file.
file : "-" or None both mean sys.stdout, which is the default
you can also pass a file object
|
|
setaxis
|
setaxis (
self,
xaxis=[],
yaxis=[],
xaxisalign=1,
yaxisalign=1,
)
Sets the two axis labels.
xaxis : list of labels for x
yaxis : list of labels for y
xaxisalign : 1 if x labels are aligned with grid, 0 if they are centered in cell's width
yaxisalign : 1 if y labels are aligned with grid, 0 if they are centered in cell's height
|
|
unit_to_points
|
unit_to_points ( self, value )
Converts a value expressed in centimeters, inches, points into points.
value : The number to convert. If it doesn't contain a unit string
like pt for points, cm for centimeters or in for inches, then
centimeters is assumed.
|
|
Table of Contents
This document was automatically generated
on Mon Feb 4 12:33:53 2002 by
HappyDoc version
2.0
|