Skip to content

Commit

Permalink
wxGUI/lmgr: fix saving web service layer as raster map (#3101)
Browse files Browse the repository at this point in the history
Co-authored-by: Anna Petrasova <[email protected]>
  • Loading branch information
tmszi and petrasovaa committed Aug 1, 2023
1 parent ecb6fc2 commit 52574bf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
15 changes: 4 additions & 11 deletions gui/wxpython/lmgr/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@
from lmgr.statusbar import SbMain
from lmgr.workspace import WorkspaceManager
from lmgr.pyshell import PyShellWindow
from lmgr.giface import (
LayerManagerGrassInterface,
LayerManagerGrassInterfaceForMapDisplay,
)
from lmgr.giface import LayerManagerGrassInterface
from mapdisp.frame import MapDisplay
from datacatalog.catalog import DataCatalog
from gui_core.forms import GUI
Expand Down Expand Up @@ -466,10 +463,10 @@ def NewDisplay(self, name=None, show=True):
self.notebookLayers.AddPage(page=self.pg_panel, text=name, select=True)
self.currentPage = self.notebookLayers.GetCurrentPage()

def CreateNewMapDisplay(layertree):
def CreateNewMapDisplay(giface, layertree):
"""Callback function which creates a new Map Display window
:param giface: giface for map display
:param layertree: layer tree object
:param name: name of new map display window
:return: reference to mapdisplay instance
"""
# count map display frame position
Expand All @@ -485,14 +482,10 @@ def CreateNewMapDisplay(layertree):
title=name,
)

# create instance of Map Display interface
self._gifaceForDisplay = LayerManagerGrassInterfaceForMapDisplay(
self._giface, layertree
)
# create Map Display
mapdisplay = MapDisplay(
parent=mapframe,
giface=self._gifaceForDisplay,
giface=giface,
id=wx.ID_ANY,
size=globalvar.MAP_WINDOW_SIZE,
tree=layertree,
Expand Down
5 changes: 4 additions & 1 deletion gui/wxpython/lmgr/layertree.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
from icons.icon import MetaIcon
from gui_core.widgets import MapValidator
from gui_core.wrap import Menu, GenBitmapButton, TextCtrl, NewId
from lmgr.giface import LayerManagerGrassInterfaceForMapDisplay


TREE_ITEM_HEIGHT = 25
Expand Down Expand Up @@ -152,7 +153,9 @@ def __init__(
self._setGradient()

# init associated map display
self.mapdisplay = createNewMapDisplay(layertree=self)
# create instance of Map Display interface
self._gifaceForDisplay = LayerManagerGrassInterfaceForMapDisplay(giface, self)
self.mapdisplay = createNewMapDisplay(self._gifaceForDisplay, layertree=self)

self.root = self.AddRoot(_("Map Layers"))
self.SetPyData(self.root, (None, None))
Expand Down
14 changes: 4 additions & 10 deletions gui/wxpython/main_window/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,7 @@
from lmgr.statusbar import SbMain
from lmgr.workspace import WorkspaceManager
from lmgr.pyshell import PyShellWindow
from lmgr.giface import (
LayerManagerGrassInterface,
LayerManagerGrassInterfaceForMapDisplay,
)
from lmgr.giface import LayerManagerGrassInterface
from mapdisp.frame import MapPanel
from datacatalog.catalog import DataCatalog
from gui_core.forms import GUI
Expand Down Expand Up @@ -417,20 +414,17 @@ def NewDisplay(self, name=None, show=True):
self.currentPageNum = self.notebookLayers.GetSelection()
self.notebookLayers.EnsureVisible(self.currentPageNum)

def CreateNewMapDisplay(layertree):
def CreateNewMapDisplay(giface, layertree):
"""Callback function which creates a new Map Display window
:param giface: giface for map display
:param layertree: layer tree object
:return: reference to mapdisplay instance
"""
# create instance of Map Display interface
self._gifaceForDisplay = LayerManagerGrassInterfaceForMapDisplay(
self._giface, layertree
)

# create Map Display
mapdisplay = MapPanel(
parent=self.mapnotebook,
giface=self._gifaceForDisplay,
giface=giface,
id=wx.ID_ANY,
tree=layertree,
lmgr=self,
Expand Down

0 comments on commit 52574bf

Please sign in to comment.