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 <kratochanna@gmail.com>
  • Loading branch information
tmszi and petrasovaa committed Aug 1, 2023
1 parent 4f154f9 commit 33b3b1c
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 @@ -463,10 +460,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 @@ -482,14 +479,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 @@ -153,7 +154,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 @@ -412,20 +409,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 33b3b1c

Please sign in to comment.