v2.0 upgrade guide
This is the incomplete upgrade guide from v1.4 to v2.0. The most apparent changes will be mentioned here. If you notice important things missing then please post an issue.
Moved from PCL to .NET Standard 2.0
Look up compatible frameworks in this table.
Viewport moved from Map to MapControl and is readonly
Use MapControl.Navigator instead.
Moved MapControl.NavigateTo methods to MapControl.Navigator
All user map manipulation should go the the Navigator.
Introduced Map.Home to initialze the map viewport
There is now a Home delegate on the Map object that should be used to set the initial state of the map.
MapControl.Map.Home = n => n.NavigateTo(myCenter, myResolution);
Reason: This is because in some cases the Navigate methods depend on the envelope and resolutions of the layers and in some cases it takes time for these layers to load their data.
Added Map.PanLock, Map.ZoomLock and Map.RotationLock
The lock fields can be used on all platforms to lock the user from a certain kind of map manipulation.
Added Map.Limiter to limit the extent to which the user can navigate
The Limter is an implementation of IViewportLimiter. There are currently three limiters part of Mapsui:
- ViewportLimiter (default)
- ViewportLimiterKeepWithin
- ViewportLimiterWithoutLimits It is also possible to implement your own IViewportLimiter.
Added RefreshGraphics, RefreshData and Refresh
- Use RefreshGraphics if you know the data in the layer has changed and the graphics needs refreshing.
- Use RefreshData if you know there is new data available in the source.
- Use Refresh if you need to do both. These methods should only be needed if you manipulate data somehow in your own code.
Renamed BoundingBox GetCentroid to Centroid and GetBoundingBox to BoundingBox
Turned these methods into proper properties making user code a bit more compact.
The Info event was moved from Map to MapControl
The MapControl contains most other events as well
Removed the InfoLayer list and add an InfoLayer boolean on ILayer
To indicate that a layer is a info layer you now need to set it's InfoLayer property. In v1.4 it had to be added to the list of InfoLayers.
Removed the HoverLayer method.
This is because hover could not be implemented crossplatform and could harm performance. It it is still possible to implement hover yourself using a direct call to MapControl.GetMapInfo.
Invert label alignment bottom/top.
This was incorrect in v1.4. This will not cause a compile error so don't forget to do a search-replace to fix it.
Removed ZoomIn/ZoomOut from WPF MapControl
Use the ZoomIn/ZoomOut methode on the navigator.
Some other changes
- Move Info event from Map to MapControl
- Do not derive ILayer from IAsyncDataFetcher.
- Remove WPFs MapControl.ErrorMessage
- Rename PanMode.None and ZoomMode.None.
- Remove the InfoLayer list and add an InfoLayer boolean on ILayer
- Remove the HoverLayer method. It is not crossplatform and can affect performance.
- Wrap Viewport in LimitingViewport which limits it to user settings, or access through Navigator.
- PanLock and ZoomLock working on all platforms.
- Rework ViewportLimiter