mapscript.labelObj¶
- class mapscript.labelObj¶
The LABEL object
Overview
The labelObj has the following relationships:
Attributes
align
int See ALIGN
angle
double See ANGLE
anglemode
enum MS_POSITIONS_ENUM One of
AUTO
AUTO2
, orFOLLOW
- see ANGLEautominfeaturesize
buffer
int Space to reserve around a label (padding) - see BUFFER
color
encoding
char Supported encoding format to be used for labels - see ENCODING
font
char Name of TrueType font see FONT
force
int Indicates if labels must be drawn - see FORCE
maxlength
int See MAXLENGTH
maxoverlapangle
double See MAXOVERLAPANGLE
maxscaledenom
double See MAXSCALEDENOM
maxsize
int Maximum height in pixels for scaled labels.
mindistance
int Minimum distance in pixels between duplicate labels - see MINDISTANCE
minfeaturesize
int Minimum feature size (in pixels) to label, features of this size or greater will be labeled - see MINFEATURESIZE
minlength
int This is a valid Mapfile keyword but is currently unused
minscaledenom
double See MINSCALEDENOM
minsize
int Minimum height in pixels - see MINSIZE
numstyles
int The number of styles associated with the label
offsetx
int Horizontal offset of label - see OFFSET
offsety
int Vertical offset of label - see OFFSET
outlinecolor
colorObj
Color of one point outline - see OUTLINECOLORoutlinewidth
int See OUTLINEWIDTH
partials
int Indicates if labels can run off the edge of an image, either
MS_TRUE
orMS_FALSE
(default) - see PARTIALSposition
int See POSTION
priority
int Priority level 1 to
MS_MAX_LABEL_PRIORITY
, default=1 - see PRIORITYrefcount
int immutable TODO Add documentation
repeatdistance
int See REPEATDISTANCE
shadowcolor
colorObj
See SHADOWCOLORshadowsizex
int See SHADOWSIZE
shadowsizey
int See SHADOWSIZE
size
int Annotation height in pixels - see SIZE
sizeunits
int Supersedes class's sizeunits, defaults to
MS_INHERIT
.space_size_10
double Cached size of a single space character used for label text alignment of rfc40
thisown
The membership flag
wrap
char See WRAP
Methods
- __init__()[source]¶
Create a new
labelObj
. AlabelObj
is associated with aclassObj
ascalebarObj
or alegendObj
. An instance oflabelObj
can exist outside of aclassObj
container and be explicitly inserted into theclassObj
:>>> new_label = new labelObj()
>>> the_class.addLabel(new_label)
- convertToString() char [source]¶
Output the
labelObj
object as a Mapfile string. Provides the inverse option forlabelObj.updateFromString()
.
- getBinding(binding: int) char [source]¶
Get the attribute binding for a specified label property. Returns NULL if there is no binding for this property.
- getStyle(i: int) mapscript.styleObj [source]¶
Return a reference to the
styleObj
at index i in the styles array.
- insertStyle(style: mapscript.styleObj, index: int = - 1) int [source]¶
Insert a copy of style into the styles array at index index. Default is -1, or the end of the array. Returns the index at which the style was inserted.
- removeBinding(binding: int) int [source]¶
Remove the attribute binding for a specified label property.
- removeStyle(index: int) mapscript.styleObj [source]¶
Remove the styleObj at index from the styles array and return a copy.
- setBinding(binding: int, item: char) int [source]¶
Set the attribute binding for a specified label property. Binding constants look like this:
MS_LABEL_BINDING_[attribute name]
:>>> new_label.setBinding(MS_LABEL_BINDING_COLOR, "FIELD_NAME_COLOR")
- updateFromString(snippet: char) int [source]¶
Update a
labelObj
from a string snippet. ReturnsMS_SUCCESS
orMS_FAILURE