MapView
Namespace: Wisej.Web
Assembly: Wisej.Framework (4.2.0.0)
Displays raster map tiles, observable markers, clusters, and value-shaded GeoJSON regions.
- C#
- VB.NET
public class MapView : Control
Public Class MapView
Inherits Control
Coordinates use latitude/longitude degrees; GeoJSON uses longitude/latitude order. Tile requests run in the browser. AzureMapsKey is therefore visible to the browser; use an application tile proxy through CustomTiles when credentials must remain on the server. Markers belong to one collection. Region properties named "name" supply literal tooltips.
Example:
var map = new MapView { Dock = DockStyle.Fill, Center = new GeoPoint(51, 10), Zoom = 5 };
map.Markers.Add(new MapMarker { Location = new GeoPoint(53.55, 9.99), Text = "Hamburg", Badge = "12", Tone = ChipTone.Success });
map.MarkerClick += (s, e) => Console.WriteLine(e.Marker.Tag);
Controls.Add(map);
map.FitBounds();
Constructors
MapView()
Creates a map centered at zero degrees at zoom level 3.
Properties
Attribution
String: Gets or sets: Additional literal tile provider attribution, displayed with the built-in provider credit. (Default: "")
AzureMapsKey
String: Gets or sets: Azure Maps subscription key sent to the browser. Required by the Azure provider. (Default: "")
Center
GeoPoint: Gets or sets the viewport center in degrees. The default is (0, 0). (Default: 0, 0)
Cluster
Boolean: Gets or sets: Whether nearby markers combine into count buttons until zoom level 19. (Default: True)
ClusterText
String: Gets or sets: Cluster accessible label; {0} is the marker count. (Default: null)
Null resolves the current UI culture's translation. An explicit empty string is preserved.
DefaultSize
Size: Gets the default size, 480 by 280 pixels.
KeyboardHelpText
String: Gets or sets: Keyboard help for panning and zooming. (Default: null)
Null resolves the current UI culture's translation. An explicit empty string is preserved.
LegendText
String: Gets or sets: Region value legend title. (Default: null)
Null resolves the current UI culture's translation. An explicit empty string is preserved.
MapAccessibleText
String: Gets or sets: Default accessible map name when AccessibleName is empty. (Default: null)
Null resolves the current UI culture's translation. An explicit empty string is preserved.
MapStyle
MapStyle: Gets or sets the tile color treatment. The default is Light. (Default: Light)
Light preserves the provider's original tile colors. Dark applies a themeable CSS filter to tile images without changing markers, regions, or attribution. Changing this property preserves the viewport. Use Light with a provider that already supplies dark tiles.
Example:
map.MapStyle = MapStyle.Dark;
Markers
MapMarkerCollection: Gets the owned marker collection. Item and collection edits automatically refresh the map.
Provider
MapProvider: Gets or sets: The raster tile provider. (Default: OSM)
Regions
String: Gets or sets GeoJSON Feature or FeatureCollection text containing Polygon or MultiPolygon regions. (Default: "")
The default is empty. Null becomes empty. Invalid geometry throws without replacing current regions. Rings must be closed; polygon holes are supported. Null geometry is ignored. Feature ids are returned by RegionClick; an absent id uses the zero-based feature index.
ShowLegend
Boolean: Gets or sets: Whether the region value legend is visible when numeric values exist. (Default: True)
TileUrlTemplate
String: Gets or sets: Custom XYZ tile URL with {z}, {x}, and {y} placeholders. Empty disables tiles. HTTPS, HTTP and application-relative paths are accepted. (Default: "")
ValueMember
String: Gets or sets the direct GeoJSON properties member used for numeric shading. The default is "value". (Default: "value")
Missing, null, and nonnumeric values receive a neutral fill. Finite numbers use five equal intervals between the minimum and maximum values. A constant range uses the middle shade.
Zoom
Int32: Gets or sets the integer zoom level from 0 through 19. The default is 3. (Default: 3)
ZoomInText
String: Gets or sets: Zoom in button tooltip and accessible name. (Default: null)
Null resolves the current UI culture's translation. An explicit empty string is preserved.
ZoomOutText
String: Gets or sets: Zoom out button tooltip and accessible name. (Default: null)
Null resolves the current UI culture's translation. An explicit empty string is preserved.
Methods
Dispose(disposing)
Releases owned item subscriptions and marker ownership.
| Parameter | Type | Description |
|---|---|---|
| disposing | Boolean | Whether managed resources are being released. |
FitBounds()
Fits all owned markers using 64 pixels of edge padding.
Empty collections leave the view unchanged. A single location uses zoom 15. The shortest longitude interval is used when markers cross the antimeridian. Call after sizing the control to calculate the desired viewport.
FitBounds(markers, padding)
Fits a sequence of marker locations in the current control size.
| Parameter | Type | Description |
|---|---|---|
| markers | IEnumerable<MapMarker> | Markers to include; they need not belong to this map. |
| padding | Int32 | Nonnegative edge padding in pixels. The default is 64. |
OnCenterChanged(e)
Raises CenterChanged independently of subscribed delegates.
| Parameter | Type | Description |
|---|---|---|
| e | EventArgs | Event data. |
OnMapClick(e)
Raises MapClick independently of subscribed delegates.
| Parameter | Type | Description |
|---|---|---|
| e | MapClickEventArgs | Event data. |
OnMarkerClick(e)
Raises MarkerClick independently of subscribed delegates.
| Parameter | Type | Description |
|---|---|---|
| e | MapMarkerEventArgs | Event data. |
OnRegionClick(e)
Raises RegionClick independently of subscribed delegates.
| Parameter | Type | Description |
|---|---|---|
| e | MapRegionEventArgs | Event data. |
OnViewChanged(e)
Raises ViewChanged independently of subscribed delegates.
| Parameter | Type | Description |
|---|---|---|
| e | MapViewEventArgs | Event data. |
OnWebEvent(e)
Dispatches client events to private validation methods.
| Parameter | Type | Description |
|---|---|---|
| e | WisejEventArgs | Client event data. |
OnWebRender(config)
Renders versioned records, first-level settings, and ordinary events.
| Parameter | Type | Description |
|---|---|---|
| config | Object | Client configuration. |
OnZoomChanged(e)
Raises ZoomChanged independently of subscribed delegates.
| Parameter | Type | Description |
|---|---|---|
| e | EventArgs | Event data. |
PanTo(point)
Centers the map on a coordinate while preserving Zoom.
| Parameter | Type | Description |
|---|---|---|
| point | GeoPoint | The new center in degrees. |
Events
CenterChanged
EventHandler Center changed.
MapClick
EventHandler<MapClickEventArgs> The map background was activated without panning.
MarkerClick
EventHandler<MapMarkerEventArgs> An individual marker was activated.
RegionClick
EventHandler<MapRegionEventArgs> A polygon region was activated.
ViewChanged
EventHandler<MapViewEventArgs> Center or Zoom changed through code or a completed user navigation.
ZoomChanged
EventHandler Zoom changed.
Implements
| Name | Description |
|---|---|
| IUserData | Provides access to the UserData and Tag properties associated to the component implementing this interface. |
| IBindableComponent | Bindable components implement this interface. |
| IDropTarget | Controls that support drag & drop operations implement this interface. |
| IWisejComponent | All wisej components implement this interface. |
| IWisejControl | All wisej controls derived from the Control class must implement this interface. |
| IWisejSerializable | Allows an object to serialize itself. |