320 |
defines a single symbol which is used in the Symbolset |
defines a single symbol which is used in the Symbolset |
321 |
|
|
322 |
the following settings are used: |
the following settings are used: |
323 |
name, type, |
name, type, filled, |
324 |
|
|
325 |
the following settings are not used: |
the following settings are not used: |
326 |
sizex, sizey, points, numpoints, filled, stylelength, |
sizex, sizey, points, numpoints, stylelength, |
327 |
style, imagepath, transparent, transparentcolor, character, antialias, |
style, imagepath, transparent, transparentcolor, character, antialias, |
328 |
font, gap, position, linecap, linejoin, linejoinmaxsize, setPoints(), |
font, gap, position, linecap, linejoin, linejoinmaxsize, setPoints(), |
329 |
getPoints(), setStyle() |
getPoints(), setStyle() |
424 |
createLegendIcon(), insertStyle(), removeStyle(), moveStyleUp(), |
createLegendIcon(), insertStyle(), removeStyle(), moveStyleUp(), |
425 |
moveStyleDown() |
moveStyleDown() |
426 |
""" |
""" |
427 |
def __init__(self, mf_class): |
def __init__(self, mf_class, map): |
428 |
""" |
""" |
429 |
Initialized a class from them given mapscript Class Object |
Initialized a class from them given mapscript Class Object |
430 |
with a list of the included styles. |
with a list of the included styles. |
432 |
wich are holt as a List i think. |
wich are holt as a List i think. |
433 |
""" |
""" |
434 |
self._clazz = mf_class |
self._clazz = mf_class |
435 |
|
self.map = map |
436 |
self._styles = [] |
self._styles = [] |
437 |
self._numstyles = mf_class.numstyles |
self._numstyles = mf_class.numstyles |
438 |
for i in range(0,self._numstyles,1): |
for i in range(0,self._numstyles,1): |
439 |
self._styles.append(MF_Style(mf_class.getStyle(i))) |
self._styles.append(MF_Style(mf_class.getStyle(i)), self.map) |
440 |
|
|
441 |
if self._clazz.getExpressionString() == '"(null)"': |
if self._clazz.getExpressionString() == '"(null)"': |
442 |
self._expression = None |
self._expression = None |
480 |
""" |
""" |
481 |
added a thuban style object to the mapobject |
added a thuban style object to the mapobject |
482 |
""" |
""" |
|
new_styleobj = MF_Style(styleObj(self._clazz)) |
|
483 |
if type == "line": |
if type == "line": |
484 |
|
new_styleobj = MF_Style(styleObj(self._clazz), self.map) |
485 |
new_styleobj.set_color(tb_style.GetLineColor()) |
new_styleobj.set_color(tb_style.GetLineColor()) |
486 |
new_styleobj.set_width(tb_style.GetLineWidth()) |
new_styleobj.set_width(tb_style.GetLineWidth()) |
487 |
elif type == "point": |
elif type == "point": |
489 |
# symbol "circle" must create before |
# symbol "circle" must create before |
490 |
# TODO: create a Symbol (more see MF_SymbolSet) |
# TODO: create a Symbol (more see MF_SymbolSet) |
491 |
# first the default symbol circle will be created and the size 8 |
# first the default symbol circle will be created and the size 8 |
492 |
new_styleobj.set_symbolname('circle') |
new_styleobj = MF_Style(styleObj(self._clazz), self.map) |
493 |
new_styleobj.set_size(8) |
if tb_style.GetFill() == Transparent: |
494 |
if tb_style.GetLineColor() != Transparent: |
new_styleobj.set_symbolname('circle') |
495 |
new_styleobj.set_linecolor(tb_style.GetLineColor()) |
if tb_style.GetLineColor() != Transparent: |
496 |
new_styleobj.set_color(tb_style.GetFill()) |
new_styleobj.set_color(tb_style.GetLineColor()) |
497 |
|
else: |
498 |
|
new_styleobj.set_symbolname('circle_filled') |
499 |
|
new_styleobj.set_color(tb_style.GetFill()) |
500 |
|
if tb_style.GetLineColor() != Transparent: |
501 |
|
new_styleobj.set_linecolor(tb_style.GetLineColor()) |
502 |
|
new_styleobj.set_size(9) |
503 |
else: |
else: |
504 |
# Suppose this is a polygon. We'll need two styles for applying |
# Suppose this is a polygon. We'll need two styles for applying |
505 |
# the background color and outline width, as explained in |
# the background color and outline width, as explained in |
506 |
# http://mapserver.gis.umn.edu/docs/faq/faqsection_view?section=Map%20Output |
# http://mapserver.gis.umn.edu/docs/faq/faqsection_view?section=Map%20Output |
507 |
new_styleobj.set_color(tb_style.GetFill()) |
if tb_style.GetFill() != Transparent: |
508 |
|
new_styleobj = MF_Style(styleObj(self._clazz), self.map) |
509 |
|
new_styleobj.set_color(tb_style.GetFill()) |
510 |
# And a second style. |
# And a second style. |
511 |
# The order here matters (first the background, then the |
# The order here matters (first the background, then the |
|
new_styleobj = MF_Style(styleObj(self._clazz)) |
|
|
new_styleobj.set_width(tb_style.GetLineWidth()) |
|
512 |
if tb_style.GetLineColor() != Transparent: |
if tb_style.GetLineColor() != Transparent: |
513 |
|
new_styleobj = MF_Style(styleObj(self._clazz), self.map) |
514 |
new_styleobj.set_linecolor(tb_style.GetLineColor()) |
new_styleobj.set_linecolor(tb_style.GetLineColor()) |
515 |
|
new_styleobj.set_width(tb_style.GetLineWidth()) |
516 |
|
|
517 |
|
|
518 |
|
|
544 |
getProcessing(), clearProcessing() |
getProcessing(), clearProcessing() |
545 |
""" |
""" |
546 |
|
|
547 |
def __init__(self, mf_layer): |
def __init__(self, mf_layer, map): |
548 |
""" |
""" |
549 |
Creates the Layer Object from the mapscript Layer Object. |
Creates the Layer Object from the mapscript Layer Object. |
550 |
the class objects in the layer object will be stored in |
the class objects in the layer object will be stored in |
551 |
an array. The metadata are created as a new object. |
an array. The metadata are created as a new object. |
552 |
""" |
""" |
553 |
self._mf_layer = mf_layer |
self._mf_layer = mf_layer |
554 |
|
self.map = map |
555 |
# Create Classes |
# Create Classes |
556 |
# there could be more then 1 |
# there could be more then 1 |
557 |
self._classes = [] |
self._classes = [] |
558 |
for i in range (self._mf_layer.numclasses): |
for i in range (self._mf_layer.numclasses): |
559 |
self._classes.append(MF_Class(self._mf_layer.getClass(i))) |
self._classes.append(MF_Class(self._mf_layer.getClass(i), self.map)) |
560 |
|
|
561 |
self._projection = MF_Projection(self._mf_layer.getProjection()) |
self._projection = MF_Projection(self._mf_layer.getProjection()) |
562 |
|
|
663 |
""" |
""" |
664 |
Add a thuban class object |
Add a thuban class object |
665 |
""" |
""" |
666 |
new_class = MF_Class(classObj(self._mf_layer)) |
new_class = MF_Class(classObj(self._mf_layer), self.map) |
667 |
self._classes.append(new_class) |
self._classes.append(new_class) |
668 |
# set the class name to the Label form thuban if given, |
# set the class name to the Label form thuban if given, |
669 |
# else set it to the value |
# else set it to the value |
910 |
self._layers = [] |
self._layers = [] |
911 |
self._i = 0 |
self._i = 0 |
912 |
while self._i < self._mf_map.numlayers: |
while self._i < self._mf_map.numlayers: |
913 |
self._layers.append(MF_Layer(self._mf_map.getLayer(self._i))) |
self._layers.append(MF_Layer(self._mf_map.getLayer(self._i)), self) |
914 |
self._i += 1 |
self._i += 1 |
915 |
|
|
916 |
# Shapepath if not set, shapepath will be empty |
# Shapepath if not set, shapepath will be empty |
927 |
the new layer must create inside the mapobj, because mapscript |
the new layer must create inside the mapobj, because mapscript |
928 |
need the mapscript object as parameter for layerObj |
need the mapscript object as parameter for layerObj |
929 |
""" |
""" |
930 |
new_layer = MF_Layer(layerObj(self._mf_map)) |
new_layer = MF_Layer(layerObj(self._mf_map), self) |
931 |
self._layers.append(new_layer) |
self._layers.append(new_layer) |
932 |
# the new created layer must remove from the mapobject |
# the new created layer must remove from the mapobject |
933 |
# because all layer will create new in export. |
# because all layer will create new in export. |
1077 |
from Thuban.Model.postgisdb import PostGISShapeStore |
from Thuban.Model.postgisdb import PostGISShapeStore |
1078 |
if hasattr(tb_layer,"extension_umn_layerobj"): |
if hasattr(tb_layer,"extension_umn_layerobj"): |
1079 |
#print tb_layer.extension_umn_layerobj |
#print tb_layer.extension_umn_layerobj |
1080 |
#new_layer = MF_Layer(layerObj(self._mf_map)) |
#new_layer = MF_Layer(layerObj(self._mf_map), self) |
1081 |
new_layer = tb_layer.extension_umn_layerobj |
new_layer = tb_layer.extension_umn_layerobj |
1082 |
else: |
else: |
1083 |
new_layer = MF_Layer(layerObj(self._mf_map)) |
new_layer = MF_Layer(layerObj(self._mf_map), self) |
1084 |
self._layers.append(new_layer) |
self._layers.append(new_layer) |
1085 |
tb_layer.extension_umn_layerobj = new_layer |
tb_layer.extension_umn_layerobj = new_layer |
1086 |
new_layer.remove_allclasses() |
new_layer.remove_allclasses() |
1463 |
antialias |
antialias |
1464 |
""" |
""" |
1465 |
|
|
1466 |
def __init__(self, mf_style): |
def __init__(self, mf_style, map): |
1467 |
""" |
""" |
1468 |
Create a style object from the given mapscript style object. |
Create a style object from the given mapscript style object. |
1469 |
The color Object from the color and the outlinecolor parameter |
The color Object from the color and the outlinecolor parameter |
1472 |
it will set to 'None'. |
it will set to 'None'. |
1473 |
""" |
""" |
1474 |
self._style = mf_style |
self._style = mf_style |
1475 |
|
self.map = map |
1476 |
if self._style.color.red == -1: |
if self._style.color.red == -1: |
1477 |
self._color = None |
self._color = None |
1478 |
else: |
else: |
1516 |
|
|
1517 |
def set_symbolname(self, newsymbol): |
def set_symbolname(self, newsymbol): |
1518 |
# its possible to use stringnames instead of numbers |
# its possible to use stringnames instead of numbers |
1519 |
self._style.symbolname = newsymbol |
self._style.setSymbolByName (self.map._mf_map, newsymbol) |
1520 |
|
|