Prechádzať zdrojové kódy

oprava načítání WMS - pořadí, názvy, groupy

Honza 5 rokov pred
rodič
commit
6542e9b99d
2 zmenil súbory, kde vykonal 18 pridanie a 6 odobranie
  1. 18 6
      Atlas.py
  2. BIN
      __pycache__/Atlas.cpython-37.pyc

+ 18 - 6
Atlas.py

@@ -712,7 +712,7 @@ class Atlas:
 
         
     def checkLoadedMap(self, name):
-        print(self.compositeList)
+       ## print(self.compositeList)
         loaded = False
         for i in range (0, len(self.compositeList)):
             if self.compositeList[i]['name'] == name:
@@ -1013,6 +1013,10 @@ class Atlas:
         print(name)
         print("readMapJson " + name)
         if not self.checkLoadedMap(name): ## je nactena mapa?
+      #  if True:
+            print("debug in readMapJson - true")
+            print(name)
+            print(self.checkLoadedMap(name))
             url = self.URI+'/rest/'+self.laymanUsername+'/maps/'+name   +'/file'     
             r = requests.get(url = url)
             data = r.json()   
@@ -1024,6 +1028,7 @@ class Atlas:
             except:
                 pass
         else:
+            print("debug in readMapJson - false")
             url = self.URI+'/rest/'+self.laymanUsername+'/maps/'+name   +'/file'     
             r = requests.get(url = url)
             data = r.json()
@@ -2012,7 +2017,8 @@ class Atlas:
     def addComposite(self, data, service, groupName = ''):      
         #self.compositeList.append (data)
         print(len(data['layers']))
-        for x in range(0, len(data['layers'])):        
+        ##for x in range(0, len(data['layers'])): 
+        for x in range(len(data['layers'])- 1, -1, -1):          
           #  repairUrl = self.convertUrlFromHex(data['layers'][x]['url'])  
             repairUrl = self.URI+"/geoserver/"+self.laymanUsername+"/ows"
             layerName = data['layers'][x]['params']['LAYERS']
@@ -2048,13 +2054,14 @@ class Atlas:
             epsg = 'EPSG:4326' 
             #abstract = data['data']['layers'][x]['params']['ABSTRACT']
             wmsName = data['layers'][x]['params']['LAYERS']  
+            layerNameTitle = data['layers'][x]['title']
             if self.checkLayerOnLayman(layerName):
                 if service == 'WMS':         
                     print("zzzzzzz" +layerName)
-                    self.loadWms(repairUrl, layerName, format,epsg, groupName)
+                    self.loadWms(repairUrl, layerName,layerNameTitle, format,epsg, groupName)
 
                 if service == 'WFS':          
-                    self.loadWfs(repairUrl, layerName, groupName)
+                    self.loadWfs(repairUrl, layerName,layerNameTitle, groupName)
             else:
                 QMessageBox.information(None, "Layman", "Layer: "+layerName + " is corrupted and will not be loaded.")
     def getLayerTitle(self, layerName):
@@ -2066,9 +2073,14 @@ class Atlas:
         title = data['title']
         return title
         
-    def loadWms(self, url, layerName,layerNameTitle, format, epsg, groupName = ''):          
-        print(url)
+    def loadWms(self, url, layerName,layerNameTitle, format, epsg, groupName = ''):      
+        print("debug")
+        print(groupName)
+        print(layerNameTitle)
+        print(layerName)
+        
         layerName = self.removeUnacceptableChars(layerName)
+        print(layerName)
         epsg = "EPSG:4326"
         urlWithParams = 'contextualWMSLegend=0&crs='+epsg+'&IgnoreReportedLayerExtents=1&dpiMode=7&featureCount=10&format=image/png&layers='+layerName+'&styles=&url=' + url
         print(urlWithParams)

BIN
__pycache__/Atlas.cpython-37.pyc