/[thuban]/trunk/thuban/Extensions/umn_mapserver/mapfile.py
ViewVC logotype

Contents of /trunk/thuban/Extensions/umn_mapserver/mapfile.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2859 - (show annotations)
Tue Jul 29 07:14:45 2008 UTC (16 years, 7 months ago) by elachuni
File MIME type: text/x-python
File size: 51695 byte(s)
Replacing numeric constant for symbolic one in umn_mapserver extension,
to make the circle symbol work with new versions of mapscript.

1 # -*- coding:latin1 -*-
2 # Copyright (C) 2004 by Intevation GmbH
3 # Authors:
4 # Jan Schüngel <[email protected]>
5 #
6 # This program is free software under the GPL (>=v2)
7 # Read the file COPYING coming with Thuban for details.
8
9 """
10 Classes to represent '.map'-file Objects.
11
12 The following Classes, which are implemented in
13 mapscript are not implemented yet in this extension:
14
15 DBFInfo, errorObj, fontSetObj, graticuleObj, imageObj, itemObj,
16 labelCacheMemberObj, labelCacheObj,
17 markerCacheMembet, msTiledSHPLayerInfo, queryMapObj,
18 referenzMapObj, resultCacheMemberObj, resultCacheObj,
19 shapefileObj, shapeObj, VectorObj
20
21 the following are only used to create a necessary object. They are not
22 realy created as a MF_Object.
23
24 lineObj, pointObj
25 """
26
27 __version__ = "$Revision$"
28 # $Source$
29 # $Id$
30
31
32 # ##################################################
33 #
34 # import necessary modules from python and/or thuban
35 #
36 # ##################################################
37
38 import os
39
40 from Thuban.Model.color import Color, Transparent
41
42 from Thuban.Model.classification import ClassGroupDefault, \
43 ClassGroupSingleton, ClassGroupRange
44
45 import mapscript
46 from mapscript import layerObj, classObj, colorObj, styleObj, rectObj, symbolObj, \
47 pointObj, lineObj
48
49 from Thuban.Model.layer import RasterLayer
50
51 # ###################################
52 #
53 # Definition of dictionaries
54 #
55 # the dictonaries are like in mapscript and are used to make it
56 # easear to unterstand the key from mapscript for the settings
57 #
58 # ###################################
59
60 shp_type = { 0:'point',
61 1:'line',
62 2:'polygon',
63 3:'raster',
64 4:'annotation',
65 5:'circle',
66 6:'query'}
67
68 unit_type = { 0:"inches",
69 1:"feet",
70 2:"miles",
71 3:"meters",
72 4:"kilometers",
73 5:"dd"}
74
75 legend_status_type = { 0:"OFF",
76 1:"ON",
77 3:"embed" }
78 # 2 = Default but is not allowed here
79
80 scalebar_status_type = { 0:"OFF",
81 1:"ON",
82 3:"embed" }
83 # 2 = Default but is not allowed here
84
85 scalebar_style_type = { 0:"0",
86 1:"1" }
87
88 scalebar_position_type = { mapscript.MS_UL:"ul",
89 mapscript.MS_LR:"lr",
90 mapscript.MS_UR:"ur",
91 mapscript.MS_LL:"ll",
92 mapscript.MS_UC:"uc",
93 mapscript.MS_LC:"lc"}
94
95 layer_status_type = { 0:"OFF",
96 1:"ON",
97 2:"default"}
98
99 layer_connection_type = { mapscript.MS_INLINE:"inline",
100 mapscript.MS_SHAPEFILE:"shapefile",
101 mapscript.MS_TILED_SHAPEFILE:"tiled shapefile",
102 mapscript.MS_SDE:"sde",
103 mapscript.MS_OGR:"ogr",
104 mapscript.MS_POSTGIS:"postgis",
105 mapscript.MS_WMS:"wms",
106 mapscript.MS_ORACLESPATIAL:"oracle spatial",
107 mapscript.MS_WFS:"wfs",
108 mapscript.MS_GRATICULE:"graticule",
109 mapscript.MS_MYGIS:"mygis",
110 mapscript.MS_RASTER:"raster"}
111
112 legend_position_type = { 0:"ul",
113 1:"lr",
114 2:"ur",
115 3:"ll",
116 6:"uc",
117 7:"lc"}
118
119 label_size_type = { 0:"tiny",
120 1:"small",
121 2:"medium",
122 3:"large",
123 4:"giant" }
124
125 #TODO: build in truetype (0:"truetype") support
126 label_font_type = { 1:"bitmap" }
127
128 label_position_type = { 0:"ul",
129 1:"lr",
130 2:"ur",
131 3:"ll",
132 4:"cr",
133 5:"cl",
134 6:"uc",
135 7:"lc",
136 8:"cc",
137 10:"auto"}
138
139
140 # ##################################################
141 #
142 # Class Definition
143 #
144 # ##################################################
145
146 # ##################################################
147 # General Classes that are not all explicitly defined through
148 # a mapfile, but rather some helper-classes.
149
150 class MF_Rectangle:
151 """
152 Represents an rectanle with the bottom left
153 and top right corner.
154 """
155 def __init__(self,mf_rect):
156 self._rect = mf_rect
157
158 def get_minx(self):
159 return self._rect.minx
160
161 def get_miny(self):
162 return self._rect.miny
163
164 def get_maxx(self):
165 return self._rect.maxx
166
167 def get_maxy(self):
168 return self._rect.maxy
169
170 def get_rect(self):
171 return (self._rect.minx,self._rect.miny,self._rect.maxx,self._rect.maxy)
172
173 def set_rect(self, minx, miny, maxx, maxy):
174 self._rect.minx = minx
175 self._rect.miny = miny
176 self._rect.maxx = maxx
177 self._rect.maxy = maxy
178
179 class MF_Color:
180 """
181 The corresponding MapScript object contains also the
182 attribute pen which defines the stroke of the feature.
183 But this actually has nothing to do with the color and
184 therefore is not support here.
185
186 It needs to be discussed with the MapServer developers
187 whether pen would better be moved to another class.
188
189 The hex color definition which is also supported by
190 mapscript and Thuban is not supported as it does
191 not add any capability.
192
193 color is definied as RGB 0..255
194 """
195 def __init__(self, mf_color):
196 self._color = mf_color
197 self._tbc_red = (float(self.get_red())/255)
198 self._tbc_green = (float(self.get_green())/255)
199 self._tbc_blue = (float(self.get_blue())/255)
200 self._thubancolor = Color(self._tbc_red,
201 self._tbc_green,
202 self._tbc_blue)
203
204 # TODO : Check if it is necessary to use rgb colors alone
205 # or whether it is sufficient to only use the Thuban Color.
206 # In some it is necessary as red == -1 indicates that no color
207 # is set.
208 def get_red(self):
209 return self._color.red
210
211 def get_green(self):
212 return self._color.green
213
214 def get_blue(self):
215 return self._color.blue
216
217 def set_rgbcolor(self, red, green, blue):
218 self._color.red = red
219 self._color.green = green
220 self._color.blue = blue
221
222 self._tbc_red = (float(self.get_red())/255)
223 self._tbc_green = (float(self.get_green())/255)
224 self._tbc_blue = (float(self.get_blue())/255)
225 self._thubancolor = Color(self._tbc_red,
226 self._tbc_green,
227 self._tbc_blue)
228
229 def get_mfcolor(self):
230 return self._color
231
232 def get_thubancolor(self):
233 return self._thubancolor
234
235 def set_thubancolor(self, thuban_color):
236 if thuban_color != Transparent:
237 self._color.red = int(thuban_color.red * 255)
238 self._color.green = int(thuban_color.green * 255)
239 self._color.blue = int(thuban_color.blue * 255)
240 self._thubancolor = thuban_color
241
242
243 class MF_Metadata:
244 """
245 Metadata is not a Object in mapscript witch can be used
246 by ease. Only the infos can get with the functions
247 "getFirstMetaDataKey", "getNextMetaDataKey" and "getMetaData".
248 To get some special Metadata you need a key. So there is a special
249 function which create a list of the metadatakeys.
250 """
251 def __init__(self, mapobj):
252 self.mapobj = mapobj
253
254 def remove_allmetadata(self):
255 keylist = self.get_metadatakeys()
256 if keylist:
257 for key in keylist:
258 self.mapobj.removeMetaData(key)
259
260 def get_metadatakeys(self):
261 keylist = []
262 try:
263 metafkey =self.mapobj.getFirstMetaDataKey()
264 keylist.append(metafkey)
265 except:
266 return None
267 else:
268 if metafkey:
269 while metafkey:
270 metafkey = self.mapobj.getNextMetaDataKey(metafkey)
271 if metafkey:
272 keylist.append(metafkey)
273 return keylist
274
275 def get_metadata(self):
276 keylist = self.get_metadatakeys()
277 metadatalist = []
278 if keylist:
279 for key in keylist:
280 metadatalist.append([key,self.mapobj.getMetaData(key)])
281 return metadatalist
282 else:
283 return None
284
285 def get_metadatabykey(self, key):
286 return self.mapobj.getMetaData(key)
287
288 def remove_metadatabykey(self, key):
289 self.mapobj.removeMetaData(key)
290
291 def add_metadata(self, key, data):
292 self.mapobj.setMetaData(key,data)
293
294 # ################################################
295 # Classes for MapServer Objects as they are
296 # explicitly defined in a mapfile
297
298 class MF_Outputformat:
299 """
300 The Outputformat defines which and how the image is
301 created by the mapserver.
302
303 The following settings are used:
304 name
305
306 The following settings are not used:
307 mimetye, driver, extension, renderer, imagemode, transparent,
308 bands, numfrotmatoptions, formatoptions, refcount, inmapfile
309 setExtension(), setMimetype(), setOption(), getOption()
310 """
311 def __init__(self, mf_outputformat):
312 self._outputformat = mf_outputformat
313
314 def get_name(self):
315 return self._outputformat.name
316
317
318 class MF_Symbol:
319 """
320 defines a single symbol which is used in the Symbolset
321
322 the following settings are used:
323 name, type,
324
325 the following settings are not used:
326 sizex, sizey, points, numpoints, filled, stylelength,
327 style, imagepath, transparent, transparentcolor, character, antialias,
328 font, gap, position, linecap, linejoin, linejoinmaxsize, setPoints(),
329 getPoints(), setStyle()
330 """
331 def __init__(self, mf_symbol = "newone"):
332 # create a circle Object like shown in Thuban
333 # because Thuban don't support other symbols
334
335 # TODO: include the options to create a symbol, but
336 # first implement a methode to edit Symbols in Thuban
337 if mf_symbol == "newone":
338 mf_symbol = symbolObj("")
339 newpoint = pointObj()
340 newpoint.x = 1
341 newpoint.y = 1
342 newline = lineObj()
343 newline.add(newpoint)
344 mf_symbol.setPoints(newline)
345 mf_symbol.type = mapscript.MS_SYMBOL_ELLIPSE
346
347 self._symbol = mf_symbol
348
349 def get_symbolObj(self):
350 return self._symbol
351
352 def get_name(self):
353 return self._symbol.name
354
355 def set_name(self, new_name):
356 self._symbol.name = new_name
357
358 def get_type(self):
359 return self._symbol.type
360
361 def set_type(self, new_type):
362 # TODO include a function to set the type by a string
363 self._symbol.type = new_type
364
365 def get_filled(self):
366 return self._symbol.filled
367
368 def set_filled(self, new_filled):
369 if new_filled:
370 self._symbol.filled = 1
371 else:
372 self._symbol.filled = 0
373
374
375 class MF_SymbolSet:
376 """
377 defines a set of symbols, may be there can only be one
378
379 the following settings are used:
380 numsymbols,
381 appendSymbol()
382
383 filename, imagecachesize, symbol, getSymbol(),
384 getSymbolByName(), index(), removeSymbol(),
385 save()
386 """
387 def __init__(self, mf_symbolset):
388 self._symbolset = mf_symbolset
389
390 # Initial Symbol List
391 self._symbols = []
392 self._i = 1
393 while self._i < self._symbolset.numsymbols:
394 self._symbols.append(MF_Symbol(self._symbolset.getSymbol(self._i)))
395 self._i += 1
396
397 def add_symbol(self, new_symbol):
398 self._symbolset.appendSymbol(new_symbol.get_symbolObj())
399 self._symbols.append(new_symbol)
400 # the save function must be run to set the symbols to the
401 # mapfile. I don't know why this ist so but it must be.
402 # the file is empty then an we can delete it
403 self._symbolset.save("tempsymbol")
404 os.remove("tempsymbol")
405
406 def get_symbol(self, symbolnr):
407 if symbolnr < self._symbolset.numsymbols:
408 return self._symbols[symbolnr-1]
409 else:
410 return None
411
412
413 class MF_Class:
414 """
415 The following parameters and functions, which the mapscript style obj
416 contains, are used:
417 styles, numstyles, name, status, keyimage, layer,
418 getExpressionString(), setExpression(), getMetaData(), getFirstMetaDataKey(),
419 getNextMetaDataKey(), getStyle()
420
421 The following parameters and functions are not used:
422 label, title, template, type, minscale, maxscale, debug,
423 setExpression(), setText(), setMetaData(), drawLegendIcon(),
424 createLegendIcon(), insertStyle(), removeStyle(), moveStyleUp(),
425 moveStyleDown()
426 """
427 def __init__(self, mf_class):
428 """
429 Initialized a class from them given mapscript Class Object
430 with a list of the included styles.
431 Metadata Object will be created from the Metadata informations
432 wich are holt as a List i think.
433 """
434 self._clazz = mf_class
435 self._styles = []
436 self._numstyles = mf_class.numstyles
437 for i in range(0,self._numstyles,1):
438 self._styles.append(MF_Style(mf_class.getStyle(i)))
439
440 if self._clazz.getExpressionString() == '"(null)"':
441 self._expression = None
442 else:
443 self._expression = self._clazz.getExpressionString()
444
445 self.metadata = MF_Metadata(self._clazz)
446
447 def get_styles(self):
448 return self._styles
449
450 def get_name(self):
451 return self._clazz.name
452
453 def get_keyimage(self):
454 return self._clazz.keyimage
455
456 def get_expressionstring(self):
457 return self._expression
458
459 def set_name(self, newname):
460 self._clazz.name = newname
461
462 def set_expressionstring(self, newstring):
463 self._clazz.setExpression(newstring)
464 self._expression = self._clazz.getExpressionString()
465
466 def get_status(self):
467 if self._clazz.status == 1:
468 return True
469 else:
470 return False
471
472 def set_status(self, new_status):
473 if new_status:
474 self._clazz.status = 1
475 else:
476 self._clazz.status = 0
477
478 def add_thubanstyle(self, tb_style, type="default"):
479 """
480 added a thuban style object to the mapobject
481 """
482 new_styleobj = MF_Style(styleObj(self._clazz))
483 if type == "line":
484 new_styleobj.set_color(tb_style.GetLineColor())
485 elif type == "point":
486 # set a default symbol to show circles not only a small dot
487 # symbol "circle" must create before
488 # TODO: create a Symbol (more see MF_SymbolSet)
489 # first the default symbol circle will be created and the size 8
490 new_styleobj.set_symbolname('circle')
491 new_styleobj.set_size(8)
492 if tb_style.GetLineColor() != Transparent:
493 new_styleobj.set_linecolor(tb_style.GetLineColor())
494 new_styleobj.set_color(tb_style.GetFill())
495 else:
496 new_styleobj.set_size(tb_style.GetLineWidth())
497 if tb_style.GetLineColor() != Transparent:
498 new_styleobj.set_linecolor(tb_style.GetLineColor())
499 new_styleobj.set_color(tb_style.GetFill())
500
501
502
503 class MF_Layer:
504 """
505 The following parameters and functions, which the mapscript style obj
506 contains, are used:
507
508 classitem, numclasses, name, data, type
509 getClass(), getProjection(), getExtent(), getMetaData(),
510 getFirstMetaDataKey(), getNextMetaDataKey(), status,
511
512
513 The following paramters and functions are not used:
514 index, map, header, footer, template, groupe, tolerance,
515 toleranceunits, symbolscale, minscale, maxscale, labelminscale
516 labelmaxscale, sizeunits, maxfeatures, offsite, transform, labelcache
517 postlabelcache, labelitem, labelsizeitem, labelangleitem, labelitemindex
518 labelsizeitemindex, labelangleitemindex, tileitem, tileindex, units
519 numitems, filteritem, styleitem, requires
520 labelrequires, transparency, dump, debug, numprocessing, numjoins,
521 removeClass(), open(), close(), getShape(), getNumResults(), getResult()
522 getItem(), promote(), demote(), draw(), drawQuery(), queryByAttributes()
523 queryByPoint(), queryByRect(), queryByFeatures(), queryByShape(),
524 setFilter(), setFilterString(), setWKTProjection(), setProjection()
525 addFeature(), getNumFeatures(), setMetaData(), removeMetaData(),
526 getWMSFeatureInfoURL(), executeWFSGetFeature(), applySLD(), applySLDURL()
527 enerateSLD(), moveClassUp(), moveClassDown(), setProcessing(),
528 getProcessing(), clearProcessing()
529 """
530
531 def __init__(self, mf_layer):
532 """
533 Creates the Layer Object from the mapscript Layer Object.
534 the class objects in the layer object will be stored in
535 an array. The metadata are created as a new object.
536 """
537 self._mf_layer = mf_layer
538
539 # Create Classes
540 # there could be more then 1
541 self._classes = []
542 for i in range (self._mf_layer.numclasses):
543 self._classes.append(MF_Class(self._mf_layer.getClass(i)))
544
545 self._projection = MF_Projection(self._mf_layer.getProjection())
546
547 # Create Metadata
548 self._metadata = MF_Metadata(self._mf_layer)
549
550 def get_index(self):
551 return self._mf_layer.index
552
553 def get_name(self):
554 return self._mf_layer.name
555
556 def get_data(self):
557 return self._mf_layer.data
558
559 def get_connection(self):
560 return self._mf_layer.connnection
561
562 def get_connectiontype(self):
563 return self._mf_layer.connectiontype
564
565 def get_classes(self):
566 return self._classes
567
568 def set_classes(self, new_classes):
569 self._classes = new_classes
570
571 def get_metadata(self):
572 return self._metadata
573
574 def set_metadata(self, new_metadata):
575 self._metadata = new_metadata
576
577 def get_type(self):
578 return shp_type[self._mf_layer.type]
579
580 def get_classitem(self):
581 return self._mf_layer.classitem
582
583 def get_projection(self):
584 return self._projection
585
586 def get_status(self):
587 # returns a integer value
588 # 0 = off, 1 = on, 2 = default(always on)
589 if self._mf_layer.status == 0:
590 return False
591 else:
592 return True
593
594 def get_group(self):
595 return self._mf_layer.group
596
597 def set_group(self, new_group):
598 self._mf_layer.group = new_group
599
600 def set_name(self, newname):
601 self._mf_layer.name = newname
602
603 def set_data(self, newdata, type="shape"):
604 if type == "shape":
605 self._mf_layer.data = newdata[:-4]
606 else:
607 self._mf_layer.data = newdata
608
609 def set_connection (self, newconnection):
610 self._mf_layer.connection = newconnection
611
612 def set_connectiontype (self, newtype):
613 self._mf_layer.connectiontype = newtype
614
615 def set_status(self, newstatus):
616 # status can set to true or false from thuban.
617 # but mapserver supports the default value
618 self._mf_layer.status = newstatus
619
620 def set_classitem(self, tb_field):
621 self._mf_layer.classitem = tb_field
622
623 def set_type(self, tb_type):
624 # if type = arc its a in shapetype line
625 if tb_type == "arc":
626 self._mf_layer.type = 1
627 if tb_type == "raster":
628 self._mf_layer.type = 3
629 if shp_type.has_key(tb_type):
630 self._mf_layer.type = tb_type
631 else:
632 for shp_paar_nr in shp_type:
633 if shp_type[shp_paar_nr] == tb_type:
634 self._mf_layer.type = shp_paar_nr
635 return
636
637 def set_projection(self, newprojection):
638 self._mfnewprojstring = ""
639 if newprojection:
640 self._newparams = newprojection.GetAllParameters()
641 for field in self._newparams:
642 self._mfnewprojstring = self._mfnewprojstring+ "," + field
643 self._mf_layer.setProjection(self._mfnewprojstring[1:])
644 self._projection.set_projection(newprojection)
645
646 def add_thubanclass(self, tb_class, type=""):
647 """
648 Add a thuban class object
649 """
650 new_class = MF_Class(classObj(self._mf_layer))
651 self._classes.append(new_class)
652 # set the class name to the Label form thuban if given,
653 # else set it to the value
654 if tb_class.GetLabel() != "":
655 new_class.set_name(tb_class.GetLabel())
656 else:
657 if isinstance(tb_class, ClassGroupDefault):
658 new_class.set_name("default")
659 elif isinstance(tb_class, ClassGroupSingleton):
660 new_class.set_name(str(tb_class.GetValue()))
661 else:
662 new_class.set_name(None)
663 if self.get_type() == "line":
664 new_class.add_thubanstyle(tb_class.GetProperties(), type="line")
665 elif self.get_type() == "point":
666 new_class.add_thubanstyle(tb_class.GetProperties(), type="point")
667 else:
668 new_class.add_thubanstyle(tb_class.GetProperties())
669 if (type == "default"):
670 return
671 # removed the following two lines to check if the expressionstring
672 # is needed for points, because if expressionstring is a range type,
673 # no expressionstring in the default group is allowed
674 elif (tb_class.Matches("DEFAULT")):
675 return
676 # new_class.set_expressionstring('/./')
677 else:
678 #check which type of expression
679 if isinstance(tb_class, ClassGroupRange):
680 # get the needed infos from the Range-String
681 self._range_begin = tb_class.GetRange()[0]
682 self._range_min = str(tb_class.GetMin())
683 self._range_max = str(tb_class.GetMax())
684 self._range_end = tb_class.GetRange()[len(tb_class.GetRange())-1]
685 self._range_umn = ""
686 self._range_classitem = self.get_classitem()
687 # generate the operator
688 if self._range_begin == "[":
689 self._range_op1 = ">="
690 elif self._range_begin == "]":
691 self._range_op1 = ">"
692 else:
693 print "error in Thuban class properties"
694 #build op1 string for the lower limit
695 self._range_op1 = "[" + self._range_classitem + "] " + \
696 self._range_op1 + " " +\
697 self._range_min
698 # build op2 string for the upper limit
699 if self._range_end == "[":
700 self._range_op2 = "<"
701 elif self._range_end == "]":
702 self._range_op2 = "<="
703 else:
704 print "error in Thuban class properties"
705
706 self._range_op2 = "[" + self._range_classitem + "] " + \
707 self._range_op2 + " " +\
708 self._range_max
709 # we only need AND here at the moment, becaus of the limits
710 # in thuban
711 self._range_combine = "AND"
712 # check if the one limit is set to inf and then
713 # remove the second expression becaus is not needed.
714 if self._range_min == "-inf":
715 self._range_combine = ""
716 self._range_op1 = ""
717 elif self._range_max == "inf":
718 self._range_combine = ""
719 self._range_op2 = ""
720 # build the expression together
721 self._range_umn = "(" + self._range_umn + \
722 self._range_op1 + " " +\
723 self._range_combine + \
724 self._range_op2 + " )"
725
726 #set the expression to the mapscript
727 new_class.set_expressionstring(self._range_umn)
728 else:
729 new_class.set_expressionstring(str(tb_class.GetValue()))
730 new_class.set_status(tb_class.IsVisible())
731
732 def remove_allclasses(self):
733 for i in range(0,len(self.get_classes()), 1):
734 self._mf_layer.removeClass(i)
735 self.set_classes([])
736
737 class MF_Scalebar:
738 """
739 Represent the scalebar for a map
740
741 The following settings are used:
742 label, color, imagecolor, style, intervals, units,
743 status, position, height, width
744
745 The following settings are (not) used:
746 backgroundcolor,outlinecolor, postlabelcache
747 """
748 def __init__(self, mf_scalebar):
749 self._scalebar = mf_scalebar
750 self._color = MF_Color(self._scalebar.color)
751 self._imagecolor = MF_Color(self._scalebar.imagecolor)
752 self._label = MF_Label(self._scalebar.label)
753
754 def get_label(self):
755 return self._label
756
757 def get_color(self):
758 return self._color
759
760 def get_imagecolor(self):
761 return self._imagecolor
762
763 def get_style(self):
764 return self._scalebar.style
765
766 def set_style(self, new_style):
767 self._scalebar.style = new_style
768
769 def get_size(self):
770 #returns the size
771 return (self._scalebar.width, self._scalebar.height)
772
773 def set_size(self, new_width, new_height):
774 self._scalebar.width = new_width
775 self._scalebar.height = new_height
776
777 def get_intervals(self):
778 return self._scalebar.intervals
779
780 def set_intervals(self, new_intervals):
781 self._scalebar.intervals = new_intervals
782
783 def get_units(self):
784 #returns the unittype
785 return unit_type[self._scalebar.units]
786
787 def set_units(self, units):
788 if unit_type.has_key(units):
789 self._scalebar.units = units
790 else:
791 for unit_paar_nr in unit_type:
792 if unit_type[unit_paar_nr] == units:
793 self._scalebar.units = unit_paar_nr
794
795 def get_status(self, mode="integer"):
796 if mode == "string":
797 return scalebar_status_type[self._scalebar.status]
798 else:
799 return self._scalebar.status
800
801 def set_status(self, new_status):
802 if scalebar_status_type.has_key(new_status):
803 self._scalebar.status = new_status
804 else:
805 for scalebar_status_type_nr in scalebar_status_type:
806 if scalebar_status_type[scalebar_status_type_nr] == new_status:
807 self._scalebar.status = scalebar_status_type_nr
808
809 def get_position(self, mode="integer"):
810 if mode == "string":
811 return scalebar_position_type[self._scalebar.position]
812 else:
813 return self._scalebar.position
814
815 def set_position(self, new_position):
816 if scalebar_position_type.has_key(new_position):
817 self._scalebar.position = new_position
818 else:
819 for scalebar_position_type_nr in legend_position_type:
820 if scalebar_position_type[scalebar_position_type_nr] \
821 == new_position:
822 self._scalebar.position = scalebar_position_type_nr
823
824
825 class MF_Map:
826 """
827 The following parameters and functions, which the mapscript style obj
828 contains, are used:
829
830 name, numlayers, extent, shapepath, imagecolor, imagetype, units, getLayer,
831 status, getProjection, getMetaData, getFirstMetaDataKey, getNextMetaDataKey,
832 save(), setExtent(), height, width, setProjection(), setImageType(),
833
834 The following parameters and functions are not used:
835 maxsize, layers, symbolset, fontset, labelcache,
836 transparent, interlace, imagequality, cellsize, debug, datapattern,
837 templatepattern, configoptions
838 zoomPoint(), zoomRectangle(), zoomScale(), getLayerOrder(), setLayerOrder(),
839 clone(), removeLayer(), getLayerByName(), getSymbolByName(),
840 prepareQuery(), prepareImage(), setOutputFormat(), draw(),
841 drawQuery(), drawLegend(), drawScalebar(), embedLegend(), drawLabelCache(),
842 nextLabel(), queryByPoint(), queryByRecht(), queryByFeatures(),
843 queryByShape(), setWKTProjection(), saveQuery(), saveQueryASGML(),
844 setMetaData(), removeMetaData(), setSymbolSet(), getNumSymbols(),
845 setFontSet(), saveMapContext(), loadMapContext(), moveLayerUp(),
846 moveLayerDown(), getLayersDrawingOrder(), setLayersDrawingOrder(),
847 setConfigOption(), getConfigOption(), applyConfigOptions(), applySLD(),
848 applySLDURL(), gernerateSLD(), procecssTemplate(), processLegemdTemplate(), processQueryTemplate(),
849 getOutputFormatByName(), appendOutputFormat(), removeOutputFormat(),
850 """
851 def __init__(self, mf_map):
852 """
853 Create the map object from the mapfile mapobject which is given.
854
855 All layers in the mapfile will be written to an array.
856 """
857 self._mf_map = mf_map
858 self._extent = MF_Rectangle(self._mf_map.extent)
859 self._imagecolor = MF_Color(self._mf_map.imagecolor)
860 self._web = MF_Web(self._mf_map.web)
861 self._legend = MF_Legend(self._mf_map.legend)
862 self._scalebar = MF_Scalebar(self._mf_map.scalebar)
863
864 # TODO: generate the list dynamical by alle supported formats.
865 # At the moment outputformat only get by name, but in a next
866 # version there may be a function to get the outputformat by id
867 # then there is no need to define the formattypes here
868 image_types = ['gif', 'png', 'png24', 'jpeg', 'wbmp', \
869 'swf', 'pdf', 'imagemap']
870 self._alloutputformats = []
871 self._imagetype = self._mf_map.imagetype
872 # create a temp imagtype, because the function getOutputFormatByName()
873 # set the imagetype to the received OutputFormat
874 for fmtname in image_types:
875 theformat = self._mf_map.getOutputFormatByName(fmtname)
876 if theformat:
877 self._alloutputformats.append(MF_Outputformat(theformat))
878 self._mf_map.setImageType(self._imagetype)
879
880 self._outputformat = MF_Outputformat(self._mf_map.outputformat)
881
882 # symbols
883 self._symbolset = MF_SymbolSet(self._mf_map.symbolset)
884
885 # if the map name is not set it will return a MS string.
886 if self._mf_map.name != "MS":
887 self._name = self._mf_map.name
888 else:
889 self._name = None
890
891 self._projection = MF_Projection(self._mf_map.getProjection())
892
893 # Initial Layer List
894 self._layers = []
895 self._i = 0
896 while self._i < self._mf_map.numlayers:
897 self._layers.append(MF_Layer(self._mf_map.getLayer(self._i)))
898 self._i += 1
899
900 # Shapepath if not set, shapepath will be empty
901 if self._mf_map.shapepath:
902 self._shapepath = self._mf_map.shapepath
903 else:
904 self._shapepath = ""
905
906 # Create Metadata
907 self._metadata = MF_Metadata(self._mf_map)
908
909 def create_new_layer(self):
910 """
911 the new layer must create inside the mapobj, because mapscript
912 need the mapscript object as parameter for layerObj
913 """
914 new_layer = MF_Layer(layerObj(self._mf_map))
915 self._layers.append(new_layer)
916 # the new created layer must remove from the mapobject
917 # because all layer will create new in export.
918 #self._mf_map.removeLayer(self._mf_map.numlayers-1)
919 return new_layer
920
921 def get_mappath(self):
922 return self._mf_map.mappath
923
924 def set_mappath(self, new_mappath):
925 self._mf_map.mappath = new_mappath
926
927 def get_outputformat(self):
928 return self._outputformat
929
930 def get_alloutputformats(self):
931 return self._alloutputformats
932
933 def get_imagetype(self):
934 return self._mf_map.imagetype
935
936 def set_imagetype(self, new_imagetype):
937 self._mf_map.setImageType(new_imagetype)
938
939 def get_symbolset(self):
940 return self._symbolset
941
942 def get_status(self):
943 if self._mf_map.status == 1:
944 return True
945 else:
946 return False
947
948 def set_status(self, new_status):
949 if new_status:
950 self._mf_map.status = 1
951 else:
952 self._mf_map.status = 0
953
954 def get_scalebar(self):
955 return self._scalebar
956
957 def get_web(self):
958 return self._web
959
960 def get_legend(self):
961 return self._legend
962
963 def get_extent(self):
964 return self._extent
965
966 def get_layers(self):
967 return self._layers
968
969 def get_numlayers(self):
970 return self._mf_map.numlayers
971
972 def get_projection(self):
973 return self._projection
974
975 def get_name(self):
976 return self._name
977
978 def get_shapepath(self):
979 # where are the shape files located.
980 return self._shapepath
981
982 def set_shapepath(self, new_shapepath):
983 # where are the shape files located..
984 self._shapepath = new_shapepath
985
986 def get_imagetype(self):
987 return self._mf_map.imagetype
988
989 def get_layerorder(self):
990 # shows the order of layer as list
991 return self._mf_map.getLayerOrder()
992
993 def set_layerorder(self, new_order):
994 self._mf_map.setLayerOrder(new_order)
995
996 def get_size(self):
997 #returns the size
998 return (self._mf_map.width, self._mf_map.height)
999
1000 def get_units(self):
1001 #returns the unittype
1002 return unit_type[self._mf_map.units]
1003
1004 def get_imagecolor(self):
1005 return self._imagecolor
1006
1007 def set_name(self, newname):
1008 # whitespace musst be replaced, either no
1009 # mapfile will be shown in the mapserver
1010 if newname:
1011 newname = newname.replace(" ","_")
1012 self._name = newname
1013 self._mf_map.name = newname
1014
1015 def set_extent(self, newextent):
1016 """ Set the map's extent. The map's size should already have been
1017 set when you call this function, so this function will fail
1018 if not. Setting the size after the extent produces undesired
1019 results anyway. """
1020 width, height = self.get_size()
1021 if width <= 0 or height <= 0:
1022 raise mapscript.MapServerError, \
1023 "No size set before calling set_extent"
1024 if newextent:
1025 self._newrect = MF_Rectangle(rectObj(*newextent))
1026 self._mf_map.setExtent(*newextent)
1027
1028 def set_size(self, newwidth, newheight):
1029 self._mf_map.width = newwidth
1030 self._mf_map.height = newheight
1031
1032 def set_projection(self, projection):
1033 self._mfnewprojstring = ""
1034 self._newparams = projection.GetAllParameters()
1035 for field in self._newparams:
1036 self._mfnewprojstring = self._mfnewprojstring+ "," + field
1037 self._mf_map.setProjection(self._mfnewprojstring[1:])
1038 self._projection.set_projection(projection)
1039
1040 def set_units(self, units):
1041 if unit_type.has_key(units):
1042 self._mf_map.units = units
1043 else:
1044 for unit_paar_nr in unit_type:
1045 if unit_type[unit_paar_nr] == units:
1046 self._mf_map.units = unit_paar_nr
1047
1048 def get_metadata(self):
1049 return self._metadata
1050
1051 def add_thubanlayer(self, tb_layer):
1052 """
1053 Add a thuban layer
1054 """
1055 # this import statement placed here, because if it is placed at the
1056 # beginning of this file, it produced the following error:
1057 # NameError: global name 'AnnotationLayer' is not defined
1058 # don't know why this error is produced and why it works
1059 # if it is placed here instead of the beginning.
1060 from Extensions.umn_mapserver.mf_import import AnnotationLayer
1061 from Thuban.Model.postgisdb import PostGISShapeStore
1062 if hasattr(tb_layer,"extension_umn_layerobj"):
1063 #print tb_layer.extension_umn_layerobj
1064 #new_layer = MF_Layer(layerObj(self._mf_map))
1065 new_layer = tb_layer.extension_umn_layerobj
1066 else:
1067 new_layer = MF_Layer(layerObj(self._mf_map))
1068 self._layers.append(new_layer)
1069 tb_layer.extension_umn_layerobj = new_layer
1070 new_layer.remove_allclasses()
1071 # init a list to set the layerorder
1072 new_layer.get_index()
1073 new_layer.set_name(tb_layer.Title())
1074 # TODO: implement relative pathnames
1075 # yet only absolute pathnames in the LayerObj are set
1076 if isinstance(tb_layer, RasterLayer ):
1077 new_layer.set_data(tb_layer.GetImageFilename(), type="raster")
1078 new_layer.set_type("raster")
1079 new_layer.set_status(tb_layer.Visible())
1080 elif isinstance(tb_layer, AnnotationLayer):
1081 new_layer.set_type("annotation")
1082 new_layer.set_status(tb_layer.Visible())
1083 new_layer.set_data(tb_layer.ShapeStore().FileName())
1084 else:
1085 if isinstance (tb_layer.ShapeStore(), PostGISShapeStore):
1086 data = "%s from %s" % (tb_layer.ShapeStore().geometry_column,
1087 tb_layer.ShapeStore().tablename)
1088 new_layer.set_data (data, type="postgis")
1089 params = []
1090 for name in ("host", "port", "dbname", "user", "password"):
1091 val = getattr(tb_layer.ShapeStore().db, name)
1092 if val:
1093 params.append("%s=%s" % (name, val))
1094 new_layer.set_connection (" ".join(params))
1095 new_layer.set_connectiontype (mapscript.MS_POSTGIS)
1096 else:
1097 new_layer.set_data(tb_layer.ShapeStore().FileName())
1098 new_layer.set_status(tb_layer.Visible())
1099 new_layer.set_type(tb_layer.ShapeType())
1100 if tb_layer.GetClassificationColumn():
1101 new_layer.set_classitem(tb_layer.GetClassificationColumn())
1102 if tb_layer.GetProjection():
1103 new_layer.set_projection(tb_layer.GetProjection())
1104 if tb_layer.GetClassification().GetNumGroups() > 0:
1105 singletonexists = False
1106 for group in range(0, \
1107 tb_layer.GetClassification().GetNumGroups(), 1):
1108 if isinstance(tb_layer.GetClassification().GetGroup(group), \
1109 ClassGroupSingleton):
1110 singletonexists = True
1111 new_layer.add_thubanclass( \
1112 tb_layer.GetClassification().GetGroup(group))
1113 new_layer.add_thubanclass( \
1114 tb_layer.GetClassification().GetDefaultGroup())
1115 # remove the classitem if one singleton exists
1116 if singletonexists == False:
1117 new_layer.set_classitem(None)
1118 else:
1119 new_layer.add_thubanclass( \
1120 tb_layer.GetClassification().GetDefaultGroup(), \
1121 type="default")
1122 # set the projection to the layer.
1123 # if the layer has its own definition use it,
1124 # else use the main projection
1125 if tb_layer.GetProjection():
1126 new_layer.set_projection(tb_layer.GetProjection())
1127 else:
1128 new_layer.set_projection(self._projection.get_projection())
1129
1130 def remove_layer(self, delnr):
1131 if delnr < len(self._layers):
1132 # if a layer is removed, the links for the mapscript layer and
1133 # the metadata must set new
1134 # TODO: All other object in a layer obj must set a new, e.g proj.
1135 for ll in range(len(self._layers)-1, delnr, -1):
1136 self._layers[ll]._mf_layer = self._layers[ll-1]._mf_layer
1137 self._layers[ll].set_metadata(self._layers[ll-1].get_metadata())
1138
1139 self._mf_map.removeLayer(delnr)
1140 self._layers.pop(delnr)
1141
1142 def save_map(self, filepath):
1143 # save the Map
1144 # maybe an own saver can implement here
1145 self._mf_map.save(filepath)
1146
1147
1148 class MF_Web:
1149 """
1150 Save the Web settings
1151
1152 The following parametes are used:
1153 imagepath, imageurl, queryformat,
1154
1155 The following parameters are not used:
1156 log, map, template, header, footer, empty, error, extent,
1157 minscale, maxscale, mintemplate, maxtemplate
1158 """
1159 def __init__(self, mf_web):
1160 self._mf_web = mf_web
1161
1162 def get_imagepath(self):
1163 return self._mf_web.imagepath
1164
1165 def set_imagepath(self, new_imagepath):
1166 self._mf_web.imagepath = new_imagepath
1167
1168 def get_imageurl(self):
1169 return self._mf_web.imageurl
1170
1171 def get_template(self):
1172 return self._mf_web.template
1173
1174 def set_template(self, new_template):
1175 self._mf_web.template = new_template
1176
1177 def set_imageurl(self, new_imageurl):
1178 self._mf_web.imageurl = new_imageurl
1179
1180 def get_queryformat(self):
1181 return self._mf_web.queryformat
1182
1183 def set_queryformat(self, new_queryformat):
1184 self._mf_web.imagepath = new_queryformat
1185
1186
1187 class MF_Label:
1188 """
1189 The following parameters from mapscript are used:
1190 type, color, size, offsetx, offsety, partials, force, buffer,
1191 minfeaturesize, mindistance,
1192
1193 The following parameters are not used:
1194 font, outlinecolor, shadowcolor, shadowsizex, shadowsizey,
1195 backgroundcolor, backgroundshadowcolor, backgroundshadowsizex,
1196 backgroundshadowsizey, sizescaled, minsize, maxsize, position, angle,
1197 autoangle, antialias, wrap, autominfeaturesize,
1198 """
1199 def __init__(self, mf_label):
1200 """
1201 Create a legend obj from the existing mapfile
1202 """
1203 self._label = mf_label
1204 self._color = MF_Color(self._label.color)
1205
1206 def get_size(self):
1207 return self._label.size
1208
1209 def set_size(self, new_size):
1210 if label_size_type.has_key(new_size):
1211 self._label.size = new_size
1212 for label_size_type_nr in label_size_type:
1213 if label_size_type[label_size_type_nr] == new_size:
1214 self._label.size = label_size_type_nr
1215 else:
1216 self._label.size = new_size
1217
1218 def get_color(self):
1219 return self._color
1220
1221 def get_partials(self):
1222 if self._label.partials == 1:
1223 return True
1224 else:
1225 return False
1226
1227 def set_partials(self, new_partials):
1228 # if partials = True
1229 if new_partials:
1230 self._label.partials = 1
1231 elif new_partials == False:
1232 self._label.partials = 0
1233 else:
1234 print "must be boolean"
1235
1236 def get_buffer(self):
1237 return self._label.buffer
1238
1239 def set_buffer(self, new_buffer):
1240 self._label.buffer = new_buffer
1241
1242 def get_mindistance(self):
1243 return self._label.mindistance
1244
1245 def set_mindistance(self, new_mindistance):
1246 self._label.mindistance = new_mindistance
1247
1248 def get_minfeaturesize(self):
1249 return self._label.minfeaturesize
1250
1251 def set_minfeaturesize(self, new_minfeaturesize):
1252 self._label.minfeaturesize = new_minfeaturesize
1253
1254 def get_position(self, mode="integer"):
1255 if mode == "string":
1256 return label_position_type[self._label.position]
1257 else:
1258 return self._label.position
1259
1260 def set_position(self, new_position):
1261 if label_position_type.has_key(new_position):
1262 self._label.position = new_position
1263 else:
1264 for label_position_type_nr in label_position_type:
1265 if label_position_type[label_position_type_nr] == new_position:
1266 self._label.position = label_position_type_nr
1267
1268 def get_force(self):
1269 if self._label.force == 1:
1270 return True
1271 else:
1272 return False
1273
1274 def set_force(self, new_force):
1275 if new_force:
1276 self._label.force = 1
1277 else:
1278 self._label.force = 0
1279
1280 def get_type(self):
1281 return label_font_type[self._label.type]
1282
1283 def set_type(self, new_type):
1284 if label_font_type.has_key(new_type):
1285 self._label.type = new_type
1286 else:
1287 for label_font_type_nr in label_font_type:
1288 if label_font_type[label_font_type_nr] == new_type:
1289 self._label.type = label_font_type_nr
1290
1291 def get_offset(self):
1292 return (self._label.offsetx, self._label.offsety)
1293
1294 def set_offset(self, new_offsetx, new_offsety):
1295 self._label.offsetx = new_offsetx
1296 self._label.offsety = new_offsety
1297
1298
1299 class MF_Legend:
1300 """
1301 The following parameters are (not) used:
1302 imagecolor, label, keysizex, keysizey, status, position,
1303
1304 The following parameters are not used:
1305 keyspacingx, keyspacingy,
1306 outlinecolor, height, width, postlabelcache, template, map
1307 """
1308 def __init__(self, mf_legend):
1309 """
1310 Create a legend obj from the existing mapfile
1311 """
1312 self._mf_legend = mf_legend
1313 self._imagecolor = MF_Color(self._mf_legend.imagecolor)
1314 self._label = MF_Label(self._mf_legend.label)
1315
1316 def get_imagecolor(self):
1317 return self._imagecolor
1318
1319 def get_label(self):
1320 return self._label
1321
1322 def get_keysize(self):
1323 return (self._mf_legend.keysizex, self._mf_legend.keysizey)
1324
1325 def set_keysize(self, new_keysizex, new_keysizey):
1326 self._mf_legend.keysizex = new_keysizex
1327 self._mf_legend.keysizey = new_keysizey
1328
1329 def get_keyspacing(self):
1330 return (self._mf_legend.keyspacingx, self._mf_legend.keyspacingy)
1331
1332 def set_keyspacing(self, new_keyspacingx, new_keyspacingy):
1333 self._mf_legend.keyspacingx = new_keyspacingx
1334 self._mf_legend.keyspacingy = new_keyspacingy
1335
1336 def get_status(self, mode="integer"):
1337 if mode == "string":
1338 return legend_status_type[self._mf_legend.status]
1339 else:
1340 return self._mf_legend.status
1341
1342 def set_status(self, new_status):
1343 if legend_status_type.has_key(new_status):
1344 self._mf_legend.status = new_status
1345 else:
1346 for legend_status_type_nr in legend_status_type:
1347 if legend_status_type[legend_status_type_nr] == new_status:
1348 self._mf_legend.status = legend_status_type_nr
1349
1350 def get_position(self, mode="integer"):
1351 if mode == "string":
1352 return legend_position_type[self._mf_legend.position]
1353 else:
1354 return self._mf_legend.position
1355
1356 def set_position(self, new_position):
1357 if legend_position_type.has_key(new_position):
1358 self._mf_legend.position = new_position
1359 else:
1360 for legend_position_type_nr in legend_position_type:
1361 if legend_position_type[legend_position_type_nr]== new_position:
1362 self._mf_legend.position = legend_position_type_nr
1363
1364 class MF_Projection:
1365 """
1366 The following parameter, which the mapscript style obj contains is used:
1367
1368 numargs
1369 """
1370
1371 def __init__(self, mf_projection):
1372 """
1373 Create a projection object from the given mapscript projection
1374 object. If it is a epsg code the extracted from the string
1375 (e.g."init=epsg:xxxx"), else the projection parameters will
1376 be splitted and an array with the parameters will be creaded.
1377 """
1378 self._mfprojstring = mf_projection
1379 self._projstring = self._mfprojstring
1380 self._epsgcode = None
1381 self._params = None
1382 if self._mfprojstring:
1383 if self._mfprojstring.find("init=epsg:") != -1:
1384 self._initcode, self._epsgcode = self._mfprojstring.split(':')
1385 else:
1386 self._params = []
1387 self._params = [p.strip() for p in self._mfprojstring.split("+")]
1388 if self._params[0] == "":
1389 self._params.remove("")
1390
1391 def epsg_code_to_projection(self, epsg):
1392 """
1393 Find the projection for the given epsg code.
1394
1395 Copied from Extension/wms/layer.py
1396
1397 epsg -- EPSG code as string
1398 """
1399 #Needed only for this function
1400 from Thuban.Model.resource import get_system_proj_file, EPSG_PROJ_FILE,\
1401 EPSG_DEPRECATED_PROJ_FILE
1402
1403 proj_file, warnings = get_system_proj_file(EPSG_PROJ_FILE)
1404
1405 for proj in proj_file.GetProjections():
1406 if proj.EPSGCode() == epsg:
1407 return proj
1408
1409 proj_file, warnings = get_system_proj_file(EPSG_DEPRECATED_PROJ_FILE)
1410 for proj in proj_file.GetProjections():
1411 if proj.EPSGCode() == epsg:
1412 return proj
1413 return None
1414
1415 def get_params(self):
1416 #Parameter from the mf_projectionstring as Array
1417 return self._params
1418
1419 def get_epsgcode(self):
1420 # returnes the epsg number
1421 return self._epsgcode
1422
1423 def get_epsgproj(self):
1424 # get an epsg projectionobject
1425 return self.epsg_code_to_projection(self._epsgcode)
1426
1427 def get_projection(self):
1428 return self._projstring
1429
1430 def set_projection(self, newprojection):
1431 self._projstring = newprojection
1432 self._params = newprojection.GetAllParameters()
1433 self._mfnewprojstring = ""
1434 for field in self._params:
1435 self._mfnewprojstring = self._mfnewprojstring+ "+" + field
1436 self._mfprojstring = self._mfnewprojstring
1437
1438
1439 class MF_Style:
1440 """
1441 The following parameters, which the mapscript style obj
1442 contains, are used:
1443 color, backgroundcolor, outlinecolor, size, symbolname
1444
1445 The following are not used:
1446 symbol, sizescaled, minsize, maxsize, offsetx, offsety,
1447 antialias
1448 """
1449
1450 def __init__(self, mf_style):
1451 """
1452 Create a style object from the given mapscript style object.
1453 The color Object from the color and the outlinecolor parameter
1454 will be created. if the color (red, green or blue) is -1 there
1455 is no definition in the mapfile and so there is no color object,
1456 it will set to 'None'.
1457 """
1458 self._style = mf_style
1459 if self._style.color.red == -1:
1460 self._color = None
1461 else:
1462 self._color = MF_Color(self._style.color)
1463 if self._style.outlinecolor.red == -1:
1464 self._outlinecolor = None
1465 else:
1466 self._outlinecolor = MF_Color(self._style.outlinecolor)
1467
1468 def get_color(self):
1469 return self._color
1470
1471 def get_outlinecolor(self):
1472 return self._outlinecolor
1473
1474 def get_size(self):
1475 return self._style.size
1476
1477 def set_linecolor(self, tb_color):
1478 self._color = tb_color
1479 new_linecolor = MF_Color(colorObj())
1480 new_linecolor.set_thubancolor(tb_color)
1481 self._outlinecolor = new_linecolor
1482 self._style.outlinecolor = new_linecolor.get_mfcolor()
1483
1484 def set_color(self, tb_color):
1485 self._color = tb_color
1486 new_color = MF_Color(colorObj())
1487 new_color.set_thubancolor(tb_color)
1488 self._color = new_color
1489 self._style.color = new_color.get_mfcolor()
1490
1491 def set_size(self, newsize):
1492 self._style.size = newsize
1493
1494 def set_symbolname(self, newsymbol):
1495 # its possible to use stringnames instead of numbers
1496 self._style.symbolname = newsymbol
1497

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26