Skip to content

Commit

Permalink
Merge pull request #240 from raphaelquast/refactor
Browse files Browse the repository at this point in the history
Refactoring of Maps class
  • Loading branch information
raphaelquast authored Apr 29, 2024
2 parents dc522d3 + 30b9318 commit 9f2c60f
Show file tree
Hide file tree
Showing 4 changed files with 2,653 additions and 2,586 deletions.
16 changes: 11 additions & 5 deletions eomaps/_blit_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ def _get_renderer(self):

def _get_all_map_axes(self):
maxes = {
m.ax for m in (self._m.parent, *self._m.parent._children) if m._new_axis_map
m.ax
for m in (self._m.parent, *self._m.parent._children)
if getattr(m, "_new_axis_map", False)
}
return maxes

Expand Down Expand Up @@ -430,7 +432,7 @@ def bg_layer(self, val):
for m in [self._m.parent, *self._m.parent._children]:
layer_visible = self._layer_is_subset(val, m.layer)

for cb in m._colorbars:
for cb in getattr(m, "_colorbars", []):
cb._hide_singular_axes()

if layer_visible:
Expand Down Expand Up @@ -727,8 +729,9 @@ def _do_fetch_bg(self, layer, bbox=None):

# update axes spines and patches since they are used to clip artists!
for ax in self._get_all_map_axes():
ax.spines["geo"]._adjust_location()
ax.patch._adjust_location()
if "geo" in ax.spines:
ax.spines["geo"]._adjust_location()
ax.patch._adjust_location()

# use contextmanagers to make sure the background patches are not stored
# in the buffer regions!
Expand Down Expand Up @@ -978,8 +981,11 @@ def add_bg_artist(self, art, layer=None, draw=True):
and not layer.startswith("__inset_")
):
layer = "__inset_" + str(layer)

if layer in self._bg_artists and art in self._bg_artists[layer]:
_log.info(f"EOmaps: Background-artist '{art}' already added")
_log.info(

Check warning on line 986 in eomaps/_blit_manager.py

View check run for this annotation

Codecov / codecov/patch

eomaps/_blit_manager.py#L986

Added line #L986 was not covered by tests
f"EOmaps: Background-artist '{art}' already added on layer '{layer}'"
)
return

art.set_animated(True)
Expand Down
Loading

0 comments on commit 9f2c60f

Please sign in to comment.