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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2272 by jschuengel, Wed Jul 7 12:51:42 2004 UTC revision 2273 by jschuengel, Thu Jul 8 14:26:56 2004 UTC
# Line 13  The following Classes, which are impleme Line 13  The following Classes, which are impleme
13  mapscript are not implemented yet in this extension:  mapscript are not implemented yet in this extension:
14    
15   DBFInfo, errorObj, fontSetObj, graticuleObj, imageObj, itemObj,   DBFInfo, errorObj, fontSetObj, graticuleObj, imageObj, itemObj,
16   labelCacheMemberObj, labelCacheObj, lineObj,   labelCacheMemberObj, labelCacheObj,
17   markerCacheMembet, msTiledSHPLayerInfo, OutputFormat, pointObj, queryMapObj,   markerCacheMembet, msTiledSHPLayerInfo, queryMapObj,
18   referenzMapObj, resultCacheMemberObj, resultCacheObj, scalebarObj,   referenzMapObj, resultCacheMemberObj, resultCacheObj,
19   shapefileObj, shapeObj, VectorObj, WebObj   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$"  __version__ = "$Revision$"
# Line 36  from Thuban.Model.color import Color, Tr Line 41  from Thuban.Model.color import Color, Tr
41    
42  from mapscript import layerObj, classObj, colorObj, styleObj, rectObj, symbolObj, \  from mapscript import layerObj, classObj, colorObj, styleObj, rectObj, symbolObj, \
43                        pointObj, lineObj                        pointObj, lineObj
                         
44    
45  # ###################################  # ###################################
46  #  #
47  # Definition of dictionaries  # Definition of dictionaries
48  #  #
49    # the dictonaries are like in mapscript and are used to make it
50    # easear to unterstand the key from mapscript for the settings
51    #
52  # ###################################  # ###################################
53    
54  shp_type = { 0:'point',  shp_type = { 0:'point',
# Line 53  shp_type = { 0:'point', Line 60  shp_type = { 0:'point',
60               6:'query'}               6:'query'}
61    
62  unit_type = { 0:"inches",  unit_type = { 0:"inches",
63               1:"feet",                1:"feet",
64               2:"miles",                2:"miles",
65               3:"meters",                3:"meters",
66               4:"kilometers",                4:"kilometers",
67               5:"dd"}                5:"dd"}
   
 # TODO: generate the list dynamical by alle supported formats.  
 #       At the moment outputformat only get by name.  
 image_type = ["png","jpeg","wbmp","GTiff"]  
68    
69  legend_status_type = { 0:"OFF",  legend_status_type = { 0:"OFF",
70                          1:"ON",                         1:"ON",
71                          3:"embed" }                         3:"embed" }
72                          # 2 = Default but will not be imported because                         # 2 = Default but is not allowed here
73                          # mapscript dont support it and its not allowed                        
   
74  scalebar_status_type = { 0:"OFF",  scalebar_status_type = { 0:"OFF",
75                          1:"ON",                           1:"ON",
76                          3:"embed" }                           3:"embed" }
77                          # 2 = Default but will not be imported because                           # 2 = Default but is not allowed here
78                          # mapscript dont support it and its not allowed                          
   
79  scalebar_style_type = { 0:"0",  scalebar_style_type = { 0:"0",
80                          1:"1" }                          1:"1" }
81    
82  scalebar_position_type = { 0:"ul",  scalebar_position_type = { 0:"ul",
83                           1:"lr",                             1:"lr",
84                           2:"ur",                             2:"ur",
85                           3:"ll",                             3:"ll",
86                           6:"uc",                             6:"uc",
87                           7:"lc"}                             7:"lc"}
88    
89  layer_status_type = { 0:"OFF",  layer_status_type = { 0:"OFF",
90                          1:"ON",                        1:"ON",
91                          2:"default"}                        2:"default"}
92    
93  legend_position_type = { 0:"ul",  legend_position_type = { 0:"ul",
94                           1:"lr",                           1:"lr",
# Line 106  label_size_type = { 0:"tiny", Line 107  label_size_type = { 0:"tiny",
107  label_font_type = { 1:"bitmap" }  label_font_type = { 1:"bitmap" }
108    
109  label_position_type = { 0:"ul",  label_position_type = { 0:"ul",
110                           1:"lr",                          1:"lr",
111                           2:"ur",                          2:"ur",
112                           3:"ll",                          3:"ll",
113                           4:"cr",                          4:"cr",
114                           5:"cl",                          5:"cl",
115                           6:"uc",                          6:"uc",
116                           7:"lc",                          7:"lc",
117                           8:"cc",                          8:"cc",
118                           10:"auto"}                         10:"auto"}
119    
120    
121  # ##################################################  # ##################################################
# Line 174  class MF_Color: Line 175  class MF_Color:
175      """          """    
176      def __init__(self, mf_color):      def __init__(self, mf_color):
177          self._color = mf_color          self._color = mf_color
   
178          self._tbc_red = (float(self.get_red())/255)          self._tbc_red = (float(self.get_red())/255)
179          self._tbc_green = (float(self.get_green())/255)          self._tbc_green = (float(self.get_green())/255)
180          self._tbc_blue = (float(self.get_blue())/255)          self._tbc_blue = (float(self.get_blue())/255)
181          self._thubancolor = Color(self._tbc_red, self._tbc_green, self._tbc_blue)          self._thubancolor = Color(self._tbc_red,
182                                      self._tbc_green,
183                                      self._tbc_blue)
184    
185      # TODO : Check if it is necessary to use rgb colors alone      # TODO : Check if it is necessary to use rgb colors alone
186      # or whether it is sufficient to only use the Thuban Color.      # or whether it is sufficient to only use the Thuban Color.
# Line 201  class MF_Color: Line 203  class MF_Color:
203          self._tbc_red = (float(self.get_red())/255)          self._tbc_red = (float(self.get_red())/255)
204          self._tbc_green = (float(self.get_green())/255)          self._tbc_green = (float(self.get_green())/255)
205          self._tbc_blue = (float(self.get_blue())/255)          self._tbc_blue = (float(self.get_blue())/255)
206          self._thubancolor = Color(self._tbc_red, self._tbc_green, self._tbc_blue)          self._thubancolor = Color(self._tbc_red,
207                                      self._tbc_green,
208                                      self._tbc_blue)
209                    
210      def get_mfcolor(self):      def get_mfcolor(self):
211          return self._color          return self._color
# Line 241  class MF_Metadata: Line 245  class MF_Metadata:
245                                    
246      Metadata are not really needed at the moment.      Metadata are not really needed at the moment.
247      """      """
   
248      def __init__(self):      def __init__(self):
249          self.data = {}          self.data = {}
250                
# Line 254  class MF_Metadata: Line 257  class MF_Metadata:
257      def add_metadata(self, key, data):      def add_metadata(self, key, data):
258          self.data[key] = data          self.data[key] = data
259    
260  # ##################################################  # ################################################
261  # Classes for MapServer Objects as they are  # Classes for MapServer Objects as they are
262  # explicitly defined in a mapfile  # explicitly defined in a mapfile
 class MF_Outputformat:  
263    
264    class MF_Outputformat:
265        """
266        The Outputformat defines which and how the image is
267        created by the mapserver.
268        
269        The following settings are used:
270        name
271        
272        The following settings are not used:
273        mimetye, driver, extension, renderer, imagemode, transparent,
274        bands, numfrotmatoptions, formatoptions, refcount, inmapfile
275        setExtension(), setMimetype(), setOption(), getOption()
276        """
277      def __init__(self, mf_outputformat):      def __init__(self, mf_outputformat):
278          self._outputformat = mf_outputformat          self._outputformat = mf_outputformat
279            
# Line 266  class MF_Outputformat: Line 281  class MF_Outputformat:
281          return self._outputformat.name          return self._outputformat.name
282            
283    
   
284  class MF_Symbol:  class MF_Symbol:
285      """      """
286      defines a single symbol which is used in the Symbolset      defines a single symbol which is used in the Symbolset
287            
288      name, type, sizex, sizey, points, numpoints, filled, stylelength,      the following settings are used:
289        name, type,
290        
291        the following settings are not used:
292        sizex, sizey, points, numpoints, filled, stylelength,
293      style, imagepath, transparent, transparentcolor, character, antialias,      style, imagepath, transparent, transparentcolor, character, antialias,
294      font, gap, position, linecap, linejoin, linejoinmaxsize, setPoints(),      font, gap, position, linecap, linejoin, linejoinmaxsize, setPoints(),
295      getPoints(), setStyle()      getPoints(), setStyle()
296      """      """    
       
297      def __init__(self, mf_symbol = "newone"):      def __init__(self, mf_symbol = "newone"):
298          # create a circle Object like shown in Thuban          # create a circle Object like shown in Thuban
299          # because Thuban don't support other symbols          # because Thuban don't support other symbols
300            
301            # TODO: include the options to create a symbol, but
302            #      first implement a methode to edit Symbols in Thuban
303          if mf_symbol == "newone":          if mf_symbol == "newone":
304              mf_symbol = symbolObj("")                          mf_symbol = symbolObj("")            
305              newpoint = pointObj()              newpoint = pointObj()
# Line 300  class MF_Symbol: Line 320  class MF_Symbol:
320      def set_name(self, new_name):      def set_name(self, new_name):
321          self._symbol.name = new_name          self._symbol.name = new_name
322            
323        def get_type(self):
324            return self._symbol.type
325        
326      def set_type(self, new_type):      def set_type(self, new_type):
327          # TODO include a function to set the type by a string          # TODO include a function to set the type by a string
328          self._symbol.type = new_type          self._symbol.type = new_type
329            
330        def get_filled(self):
331            return self._symbol.filled
332        
333      def set_filled(self, new_filled):      def set_filled(self, new_filled):
334          if new_filled:          if new_filled:
335              self._symbol.filled = 1              self._symbol.filled = 1
336          else:          else:
337              self._symbol.filled = 0              self._symbol.filled = 0
338        
       
339    
340  class MF_SymbolSet:  class MF_SymbolSet:
341      """      """
342      defines a set of symbols, may be there can only be one      defines a set of symbols, may be there can only be one
343            
344      filename, imagecachesize, numsymbols, symbol, getSymbol(),      the following settings are used:
345      getSymbolByName(), index(), appendSymbol(), removeSymbol(),      numsymbols,
346        appendSymbol()
347        
348        filename, imagecachesize, symbol, getSymbol(),
349        getSymbolByName(), index(), removeSymbol(),
350      save()          save()    
351      """      """
       
     # TODO: include the symbolset, but found only the possibility to  
     # create an extra symbol file and not to include it direct to the  
     # mapfile itself  
352      def __init__(self, mf_symbolset):      def __init__(self, mf_symbolset):
353          self._symbolset = mf_symbolset          self._symbolset = mf_symbolset
354                    
# Line 335  class MF_SymbolSet: Line 360  class MF_SymbolSet:
360              self._symbols.append(MF_Symbol(self._symbolset.getSymbol(self._i)))              self._symbols.append(MF_Symbol(self._symbolset.getSymbol(self._i)))
361              self._i += 1              self._i += 1
362    
 #    POINT  
 #   1 1  
 #   END  
   
363      def add_symbol(self, new_symbol):      def add_symbol(self, new_symbol):
364          self._symbolset.appendSymbol(new_symbol.get_symbolObj())          self._symbolset.appendSymbol(new_symbol.get_symbolObj())
365          self._symbols.append(new_symbol)          self._symbols.append(new_symbol)
366          # the save function must be run to set the symbols to the          # the save function must be run to set the symbols to the
367          # mapfile. I don't know why this ist so but it must be.          # mapfile. I don't know why this ist so but it must be.
368            # the file is empty then an we can delete it
369          self._symbolset.save("tempsymbol")          self._symbolset.save("tempsymbol")
370          os.remove("tempsymbol")          os.remove("tempsymbol")
371    
# Line 353  class MF_SymbolSet: Line 375  class MF_SymbolSet:
375          else:          else:
376              return None              return None
377    
378    
379  class MF_Class:  class MF_Class:
380      """      """
381      The following parameters and functions, which the mapscript style obj      The following parameters and functions, which the mapscript style obj
382      contains, are used:      contains, are used:
383      styles, numstyles, name,      styles, numstyles, name, status, keyimage, layer,
384      getExpressionString(), setExpression(), getMetaData(), getFirstMetaDataKey(),      getExpressionString(), setExpression(), getMetaData(), getFirstMetaDataKey(),
385      getNextMetaDataKey(), getStyle()      getNextMetaDataKey(), getStyle()
386    
387      The following parameters and functions are not used:      The following parameters and functions are not used:
388      status, label, title, template, type, minscale, maxscale, layer,      label, title, template, type, minscale, maxscale, debug,
     debig, keyimage,  
389      setExpression(), setText(), setMetaData(), drawLegendIcon(),      setExpression(), setText(), setMetaData(), drawLegendIcon(),
390      createLegendIcon(), insertStyle(), removeStyle(), moveStyleUp(),      createLegendIcon(), insertStyle(), removeStyle(), moveStyleUp(),
391      moveStyleDown()      moveStyleDown()
# Line 609  class MF_Layer: Line 631  class MF_Layer:
631          new_class.set_status(tb_class.IsVisible())          new_class.set_status(tb_class.IsVisible())
632          self._classes.append(new_class)          self._classes.append(new_class)
633    
634    
635  class MF_Scalebar:  class MF_Scalebar:
636      """      """
637        Represent the scalebar for a map
638    
639        The following settings are used:
640        label, color, imagecolor, style, intervals, units,
641        status, position, height, width
642        
643      The following settings are (not) used:      The following settings are (not) used:
644      imagecolor, height, width, style, intervals, label, color, backgroundcolor,      backgroundcolor,outlinecolor, postlabelcache
     outlinecolor, units, status, position, postlabelcache  
645      """      """
646      def __init__(self, mf_scalebar):      def __init__(self, mf_scalebar):
647          self._scalebar = mf_scalebar          self._scalebar = mf_scalebar
# Line 662  class MF_Scalebar: Line 690  class MF_Scalebar:
690                 if unit_type[unit_paar_nr] == units:                 if unit_type[unit_paar_nr] == units:
691                     self._scalebar.units = unit_paar_nr                     self._scalebar.units = unit_paar_nr
692                    
693      def get_status(self, art="integer"):      def get_status(self, mode="integer"):
694          if art == "string":          if mode == "string":
695              return scalebar_status_type[self._scalebar.status]              return scalebar_status_type[self._scalebar.status]
696          else:          else:
697              return self._scalebar.status              return self._scalebar.status
# Line 676  class MF_Scalebar: Line 704  class MF_Scalebar:
704                  if scalebar_status_type[scalebar_status_type_nr] == new_status:                  if scalebar_status_type[scalebar_status_type_nr] == new_status:
705                      self._scalebar.status = scalebar_status_type_nr                      self._scalebar.status = scalebar_status_type_nr
706            
707      def get_position(self, art="integer"):      def get_position(self, mode="integer"):
708          if art == "string":          if mode == "string":
709              return scalebar_position_type[self._scalebar.position]              return scalebar_position_type[self._scalebar.position]
710          else:          else:
711              return self._scalebar.position              return self._scalebar.position
# Line 687  class MF_Scalebar: Line 715  class MF_Scalebar:
715              self._scalebar.position = new_position              self._scalebar.position = new_position
716          else:          else:
717              for scalebar_position_type_nr in legend_position_type:              for scalebar_position_type_nr in legend_position_type:
718                  if scalebar_position_type[scalebar_position_type_nr] == new_position:                  if scalebar_position_type[scalebar_position_type_nr] \
719                    == new_position:
720                      self._scalebar.position = scalebar_position_type_nr                      self._scalebar.position = scalebar_position_type_nr
721    
722    
723  class MF_Map:  class MF_Map:
724      """      """
725      The following parameters and functions, which the mapscript style obj      The following parameters and functions, which the mapscript style obj
# Line 697  class MF_Map: Line 727  class MF_Map:
727    
728      name, numlayers, extent, shapepath, imagecolor, imagetype, units, getLayer,      name, numlayers, extent, shapepath, imagecolor, imagetype, units, getLayer,
729      status, getProjection, getMetaData, getFirstMetaDataKey, getNextMetaDataKey,      status, getProjection, getMetaData, getFirstMetaDataKey, getNextMetaDataKey,
730      save(), setExtent(), height, width, setProjection()      save(), setExtent(), height, width, setProjection(), setImageType(),
731    
       
732      The following parameters and functions are not used:      The following parameters and functions are not used:
733      maxsize, layers, symbolset, fontset, labelcache,      maxsize, layers, symbolset, fontset, labelcache,
734      transparent, interlace, imagequality, cellsize, debug, datapattern,      transparent, interlace, imagequality, cellsize, debug, datapattern,
735      templatepattern, configoptions      templatepattern, configoptions
736      zoomPoint(), zoomRectangle(), zoomScale(), getLayerOrder(), setLayerOrder(),      zoomPoint(), zoomRectangle(), zoomScale(), getLayerOrder(), setLayerOrder(),
737      clone(), removeLayer(), getLayerByName(), getSymbolByName(),      clone(), removeLayer(), getLayerByName(), getSymbolByName(),
738      prepareQuery(), prepareImage(), setImageType(), setOutputFormat(), draw(),      prepareQuery(), prepareImage(), setOutputFormat(), draw(),
739      drawQuery(), drawLegend(), drawScalebar(), embedLegend(), drawLabelCache(),      drawQuery(), drawLegend(), drawScalebar(), embedLegend(), drawLabelCache(),
740      nextLabel(), queryByPoint(), queryByRecht(), queryByFeatures(), queryByShape(),      nextLabel(), queryByPoint(), queryByRecht(), queryByFeatures(),
741      setWKTProjection(), saveQuery(), saveQueryASGML(),      queryByShape(), setWKTProjection(), saveQuery(), saveQueryASGML(),
742      setMetaData(), removeMetaData(), setSymbolSet(), getNumSymbols(), setFontSet(),      setMetaData(), removeMetaData(), setSymbolSet(), getNumSymbols(),
743      saveMapContext(), loadMapContext(), moveLayerUp(), moveLayerDown(),      setFontSet(), saveMapContext(), loadMapContext(), moveLayerUp(),
744      getLayersDrawingOrder(), setLayersDrawingOrder(), setConfigOption(),      moveLayerDown(), getLayersDrawingOrder(), setLayersDrawingOrder(),
745      getConfigOption(), applyConfigOptions(), applySLD(), applySLDURL(), gernerateSLD(),      setConfigOption(), getConfigOption(), applyConfigOptions(), applySLD(),
746      procecssTemplate(), processLegemdTemplate(), processQueryTemplate(),      applySLDURL(), gernerateSLD(), procecssTemplate(), processLegemdTemplate(), processQueryTemplate(),
747      getOutputFormatByName(), appendOutputFormat(), removeOutputFormat(),      getOutputFormatByName(), appendOutputFormat(), removeOutputFormat(),
748      """      """
       
749      def __init__(self, mf_map):      def __init__(self, mf_map):
750          """          """
751          Create the map object from the mapfile mapobject which is given.          Create the map object from the mapfile mapobject which is given.
752    
753          All layers in the mapfile will be written to an array.          All layers in the mapfile will be written to an array.
754          """          """
   
755          self._mf_map = mf_map          self._mf_map = mf_map
756          self._extent = MF_Rectangle(self._mf_map.extent)          self._extent = MF_Rectangle(self._mf_map.extent)
757          self._imagecolor = MF_Color(self._mf_map.imagecolor)          self._imagecolor = MF_Color(self._mf_map.imagecolor)
758          self._web = MF_Web(self._mf_map.web)          self._web = MF_Web(self._mf_map.web)
759          self._legend = MF_Legend(self._mf_map.legend)          self._legend = MF_Legend(self._mf_map.legend)
760          self._scalebar = MF_Scalebar(self._mf_map.scalebar)          self._scalebar = MF_Scalebar(self._mf_map.scalebar)
         self._outputformat = MF_Outputformat(self._mf_map.outputformat)  
761                    
762            # TODO: generate the list dynamical by alle supported formats.
763            # At the moment outputformat only get by name, but in a next
764            # version there may be a function to get the outputformat by id
765            # then there is no need to define the formattypes here
766            image_types = ['gif', 'png', 'png24', 'jpeg', 'wbmp', \
767                           'swf', 'pdf', 'imagemap']
768            self._alloutputformats = []
769            self._imagetype = self._mf_map.imagetype
770            # create a temp imagtype, because the function getOutputFormatByName()
771            # set the imagetype to the received OutputFormat        
772            for fmtname in image_types:
773                theformat = self._mf_map.getOutputFormatByName(fmtname)
774                if theformat:
775                    self._alloutputformats.append(MF_Outputformat(theformat))
776            self._mf_map.setImageType(self._imagetype)
777    
778            self._outputformat = MF_Outputformat(self._mf_map.outputformat)
779    
780          # symbols          # symbols
781          self._symbolset = MF_SymbolSet(self._mf_map.symbolset)          self._symbolset = MF_SymbolSet(self._mf_map.symbolset)
782    
# Line 773  class MF_Map: Line 817  class MF_Map:
817      def get_outputformat(self):      def get_outputformat(self):
818          return self._outputformat          return self._outputformat
819            
820        def get_alloutputformats(self):
821            return self._alloutputformats
822    
823      def get_imagetype(self):      def get_imagetype(self):
824          return self._mf_map.imagetype          return self._mf_map.imagetype
825            
# Line 816  class MF_Map: Line 863  class MF_Map:
863          return self._name          return self._name
864            
865      def get_shapepath(self):      def get_shapepath(self):
866          return self._shapepath # where are the shape files located..          # where are the shape files located..
867            return self._shapepath
868            
869      def get_imagetype(self):      def get_imagetype(self):
870          return self._mf_map.imagetype          return self._mf_map.imagetype
# Line 839  class MF_Map: Line 887  class MF_Map:
887      def set_name(self, newname):      def set_name(self, newname):
888          # whitespace musst be replaced, either no          # whitespace musst be replaced, either no
889          # mapfile will be shown in the mapserver          # mapfile will be shown in the mapserver
890          newname = newname.replace(" ","_")          if newname:
891                newname = newname.replace(" ","_")
892          self._name = newname          self._name = newname
893          self._mf_map.name = newname          self._mf_map.name = newname
894            
# Line 847  class MF_Map: Line 896  class MF_Map:
896          # TODO: add the shown extend here instead of the total          # TODO: add the shown extend here instead of the total
897          self._newrect = MF_Rectangle(rectObj())          self._newrect = MF_Rectangle(rectObj())
898          try:          try:
899              self._newrect.set_rect(newextent[0],newextent[1],newextent[2],newextent[3])              self._newrect.set_rect(newextent[0],newextent[1], \
900              self._mf_map.setExtent(newextent[0],newextent[1],newextent[2],newextent[3])                                     newextent[2],newextent[3])
901                self._mf_map.setExtent(newextent[0],newextent[1], \
902                                       newextent[2],newextent[3])
903          except:          except:
904              return              return
905            
# Line 871  class MF_Map: Line 922  class MF_Map:
922              for unit_paar_nr in unit_type:              for unit_paar_nr in unit_type:
923                 if unit_type[unit_paar_nr] == units:                 if unit_type[unit_paar_nr] == units:
924                     self._mf_map.units = unit_paar_nr                     self._mf_map.units = unit_paar_nr
925              
926        def get_metadata(self):
927            return self._metadata
928        
929      def add_thubanlayer(self, tb_layer):      def add_thubanlayer(self, tb_layer):
930          """          """
931          Add a thuban layer          Add a thuban layer
# Line 896  class MF_Map: Line 950  class MF_Map:
950              if tb_layer.GetProjection():              if tb_layer.GetProjection():
951                  new_layer.set_projection(tb_layer.GetProjection())                  new_layer.set_projection(tb_layer.GetProjection())
952              if tb_layer.GetClassification().GetNumGroups() > 0:              if tb_layer.GetClassification().GetNumGroups() > 0:
953                  for group in range(0, tb_layer.GetClassification().GetNumGroups(), 1):                  for group in range(0, \
954                      new_layer.add_thubanclass(tb_layer.GetClassification().GetGroup(group))                                  tb_layer.GetClassification().GetNumGroups(), 1):
955                  new_layer.add_thubanclass(tb_layer.GetClassification().GetDefaultGroup())                      new_layer.add_thubanclass( \
956                                       tb_layer.GetClassification().GetGroup(group))
957                    new_layer.add_thubanclass( \
958                                     tb_layer.GetClassification().GetDefaultGroup())
959              else:              else:
960                  new_layer.add_thubanclass(tb_layer.GetClassification().GetDefaultGroup(), type="default")                  new_layer.add_thubanclass( \
961                                   tb_layer.GetClassification().GetDefaultGroup(), \
962                                   type="default")
963                
964          # set the projection to the layer.          # set the projection to the layer.
965          # if the layer has its own definition use is, else use the main projection          # if the layer has its own definition use is,
966            # else use the main projection
967          if tb_layer.GetProjection():          if tb_layer.GetProjection():
968              new_layer.set_projection(tb_layer.GetProjection())              new_layer.set_projection(tb_layer.GetProjection())
969          else:          else:
# Line 926  class MF_Web: Line 986  class MF_Web:
986      Save the Web settings      Save the Web settings
987            
988      The following parametes are used:      The following parametes are used:
989      imagepath, imageurl      imagepath, imageurl, queryformat,
990            
991      The following parameters are not used:      The following parameters are not used:
992      log, map, template, queryformat, header, footer, empty, error, extent,      log, map, template, header, footer, empty, error, extent,
993      minscale, maxscale, mintemplate, maxtemplate      minscale, maxscale, mintemplate, maxtemplate
994      """      """
995      def __init__(self, mf_web):      def __init__(self, mf_web):
# Line 945  class MF_Web: Line 1005  class MF_Web:
1005          return self._mf_web.imageurl          return self._mf_web.imageurl
1006    
1007      def set_imageurl(self, new_imageurl):      def set_imageurl(self, new_imageurl):
1008          self._mf_web.imagepath = new_imageurl          self._mf_web.imageurl = new_imageurl
1009            
1010      def get_queryformat(self):      def get_queryformat(self):
1011          return self._mf_web.queryformat          return self._mf_web.queryformat
# Line 957  class MF_Web: Line 1017  class MF_Web:
1017  class MF_Label:  class MF_Label:
1018      """      """
1019      The following parameters from mapscript are used:      The following parameters from mapscript are used:
1020      type, color, size, offsetx, offsety,      type, color, size, offsetx, offsety, partials, force, buffer,
1021        minfeaturesize, mindistance,
1022            
1023      The following parameters are not used:          The following parameters are not used:    
1024      font,   outlinecolor, shadowcolor, shadowsizex, shadowsizey,      font, outlinecolor, shadowcolor, shadowsizex, shadowsizey,
1025      backgroundcolor, backgroundshadowcolor, backgroundshadowsizex,      backgroundcolor, backgroundshadowcolor, backgroundshadowsizex,
1026      backgroundshadowsizey, sizescaled, minsize, maxsize, position, angle,      backgroundshadowsizey, sizescaled, minsize, maxsize, position, angle,
1027      autoangle, buffer, antialias, wrap, minfeaturesize,      autoangle, antialias, wrap, autominfeaturesize,
     autominfeaturesize, mindistance, partials, force  
1028      """      """
1029      def __init__(self, mf_label):      def __init__(self, mf_label):
1030          """          """
# Line 1001  class MF_Label: Line 1061  class MF_Label:
1061          elif new_partials == False:          elif new_partials == False:
1062              self._label.partials = 0              self._label.partials = 0
1063          else:          else:
1064              print "Boolean exspected"              print "must be boolean"
1065            
1066      def get_buffer(self):      def get_buffer(self):
1067          return self._label.buffer          return self._label.buffer
# Line 1021  class MF_Label: Line 1081  class MF_Label:
1081      def set_minfeaturesize(self, new_minfeaturesize):      def set_minfeaturesize(self, new_minfeaturesize):
1082          self._label.minfeaturesize = new_minfeaturesize          self._label.minfeaturesize = new_minfeaturesize
1083            
1084      def get_position(self, art="integer"):      def get_position(self, mode="integer"):
1085          if art == "string":          if mode == "string":
1086              return label_position_type[self._label.position]              return label_position_type[self._label.position]
1087          else:          else:
1088              return self._label.position              return self._label.position
# Line 1103  class MF_Legend: Line 1163  class MF_Legend:
1163          self._mf_legend.keyspacingx = new_keyspacingx          self._mf_legend.keyspacingx = new_keyspacingx
1164          self._mf_legend.keyspacingy = new_keyspacingy          self._mf_legend.keyspacingy = new_keyspacingy
1165            
1166      def get_status(self, art="integer"):      def get_status(self, mode="integer"):
1167          if art == "string":          if mode == "string":
1168              return legend_status_type[self._mf_legend.status]              return legend_status_type[self._mf_legend.status]
1169          else:          else:
1170              return self._mf_legend.status              return self._mf_legend.status
# Line 1117  class MF_Legend: Line 1177  class MF_Legend:
1177                  if legend_status_type[legend_status_type_nr] == new_status:                  if legend_status_type[legend_status_type_nr] == new_status:
1178                      self._mf_legend.status = legend_status_type_nr                      self._mf_legend.status = legend_status_type_nr
1179            
1180      def get_position(self, art="integer"):      def get_position(self, mode="integer"):
1181          if art == "string":          if mode == "string":
1182              return legend_position_type[self._mf_legend.position]              return legend_position_type[self._mf_legend.position]
1183          else:          else:
1184              return self._mf_legend.position              return self._mf_legend.position
# Line 1128  class MF_Legend: Line 1188  class MF_Legend:
1188              self._mf_legend.position = new_position              self._mf_legend.position = new_position
1189          else:          else:
1190              for legend_position_type_nr in legend_position_type:              for legend_position_type_nr in legend_position_type:
1191                  if legend_position_type[legend_position_type_nr] == new_position:                  if legend_position_type[legend_position_type_nr]== new_position:
1192                      self._mf_legend.position = legend_position_type_nr                      self._mf_legend.position = legend_position_type_nr
1193    
1194  class MF_Projection:  class MF_Projection:
# Line 1167  class MF_Projection: Line 1227  class MF_Projection:
1227          epsg -- EPSG code as string          epsg -- EPSG code as string
1228          """          """
1229          #Needed only for this function          #Needed only for this function
1230          from Thuban.Model.resource import get_system_proj_file, EPSG_PROJ_FILE, \          from Thuban.Model.resource import get_system_proj_file, EPSG_PROJ_FILE,\
1231                                            EPSG_DEPRECATED_PROJ_FILE                                            EPSG_DEPRECATED_PROJ_FILE
1232    
1233          proj_file, warnings = get_system_proj_file(EPSG_PROJ_FILE)          proj_file, warnings = get_system_proj_file(EPSG_PROJ_FILE)

Legend:
Removed from v.2272  
changed lines
  Added in v.2273

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26