FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix - Dynamic Visibility settings don't work for the layers in a MapGroup by WaterDesk · Pull Request #1530 · DotSpatial/DotSpatial · GitHub

fix - Dynamic Visibility settings don't work for the layers in a MapGroup - #1530

Open
WaterDesk wants to merge 7 commits into
DotSpatial:masterfrom
WaterDesk:xuxi/MapGroup-DynamicVisibility
Open

WaterDesk wants to merge 7 commits into
DotSpatial:masterfrom
WaterDesk:xuxi/MapGroup-DynamicVisibility

Conversation

WaterDesk commented Oct 2, 2023 •
edited
Loading

Copy link
Copy Markdown
Contributor

The commit is to fix a problem that dynamic visibility settings don't work for layers in a MapGroup, also there has been an issue logged long time ago. Fixes #1289

Reproducible steps:

  1. in DemoMap.exe
  2. Create a Group
  3. add a layer with line shape, named as "layerInAGroup", move the layer into created Group
  4. set Dynamic Visibility Scale for the "layerInAGroup"
  5. zoom in or zoom out the map, the "layerInAGroup" never show up

The root of this issue is that there is some logic error to determine the layer in a MapGroup is visible by testing the "IsVisible", "UseDynamicVisibility", "DynamicVisibilityMode" and "DynamicVisibilityWidth"

public void DrawRegions(MapArgs args, List<Extent> regions, bool selected)
{
    if (Layers == null) return;
    foreach (IMapLayer layer in Layers)
    {
        if (!layer.IsVisible) continue;
        if (layer.UseDynamicVisibility && ((layer.DynamicVisibilityMode == DynamicVisibilityMode.ZoomedIn && MapFrame.ViewExtents.Width > layer.DynamicVisibilityWidth) || MapFrame.ViewExtents.Width < layer.DynamicVisibilityWidth))
        {
             continue; // skip the layer if we are zoomed in or out too far.
        }
        layer.DrawRegions(args, regions, selected);
    }
}

The fix is simple, there is already a method Layer::VisibleAtExtent wrappered the above logic and it is correct. Use the method directly in the MapGroup::DrawRegions method.

Checklist

  • I have included examples or tests
  • I have updated the change log
  • I am listed in the CONTRIBUTORS file
  • I have cleaned up the commit history (use rebase and squash)

Changes proposed in this pull request:

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DynamicVisibilityMode Seems to work with Labels but not Symbology

2 participants


Back | FazBrowse Home | New Git URL