Interface IReadOnlyViewport
Namespace: Mapsui
Assembly: Mapsui.dll
Syntax
public interface IReadOnlyViewport
Properties
| Improve this Doc View SourceCenter
Coordinate of center of viewport in map coordinates
Declaration
ReadOnlyPoint Center { get; }
Property Value
Type | Description |
---|---|
ReadOnlyPoint |
Extent
BoundingBox of viewport in map coordinates respection Rotation
Declaration
BoundingBox Extent { get; }
Property Value
Type | Description |
---|---|
BoundingBox |
Remarks
This BoundingBox is horizontally and vertically aligned, even if the viewport is rotated. So this BoundingBox perhaps contain parts, that are not visible.
HasSize
Declaration
bool HasSize { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Height
Height of viewport in screen pixels
Declaration
double Height { get; }
Property Value
Type | Description |
---|---|
System.Double |
IsRotated
IsRotated is true, when viewport displays map rotated
Declaration
bool IsRotated { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Resolution
Resolution of the viewport in units per pixel
Declaration
double Resolution { get; }
Property Value
Type | Description |
---|---|
System.Double |
Remarks
Resolution is Mapsuis form of zoom level. Because Mapsui is projection independent, there aren't any zoom levels as other map libraries have. If your map has EPSG:3857 as projection and you want to calculate the zoom, you should use the following equation
var zoom = (float)Math.Log(78271.51696401953125 / resolution, 2);
Rotation
Viewport rotation from True North (clockwise degrees)
Declaration
double Rotation { get; }
Property Value
Type | Description |
---|---|
System.Double |
Width
Width of viewport in screen pixels
Declaration
double Width { get; }
Property Value
Type | Description |
---|---|
System.Double |
WindowExtent
WindowExtend gives the four corner points of viewport in map coordinates
Declaration
Quad WindowExtent { get; }
Property Value
Type | Description |
---|---|
Quad |
Remarks
If viewport is rotated, this corner points are not horizontally or vertically aligned.
Methods
| Improve this Doc View SourceScreenToWorld(Point)
Converts a point in screen pixels to one in map units, respecting rotation
Declaration
Point ScreenToWorld(Point position)
Parameters
Type | Name | Description |
---|---|---|
Point | position | Coordinate in map units |
Returns
Type | Description |
---|---|
Point | Point in map units |
ScreenToWorld(Double, Double)
Converts X/Y in screen pixels to a point in map units, respecting rotation
Declaration
Point ScreenToWorld(double x, double y)
Parameters
Type | Name | Description |
---|---|---|
System.Double | x | Screen position x coordinate |
System.Double | y | Screen position y coordinate |
Returns
Type | Description |
---|---|
Point | Point in map units |
WorldToScreen(Point)
Converts X/Y in map units to a point in device independent unit (or DIP or DP), respecting rotation
Declaration
Point WorldToScreen(Point worldPosition)
Parameters
Type | Name | Description |
---|---|---|
Point | worldPosition | Coordinate in map units |
Returns
Type | Description |
---|---|
Point | Point in screen pixels |
WorldToScreen(Double, Double)
Converts X/Y in map units to a point in device independent units (or DIP or DP), respecting rotation
Declaration
Point WorldToScreen(double worldX, double worldY)
Parameters
Type | Name | Description |
---|---|---|
System.Double | worldX | X coordinate in map units |
System.Double | worldY | Y coordinate in map units |
Returns
Type | Description |
---|---|
Point | Point in screen pixels |
WorldToScreenUnrotated(Point)
Converts X/Y in map units to a point in device independent units (or DIP or DP), respecting rotation
Declaration
Point WorldToScreenUnrotated(Point worldPosition)
Parameters
Type | Name | Description |
---|---|---|
Point | worldPosition | Coordinate in map units |
Returns
Type | Description |
---|---|
Point | Point in screen pixels |
WorldToScreenUnrotated(Double, Double)
Converts X/Y in map units to a point in device independent units (or DIP or DP), respecting rotation
Declaration
Point WorldToScreenUnrotated(double worldX, double worldY)
Parameters
Type | Name | Description |
---|---|---|
System.Double | worldX | X coordinate in map units |
System.Double | worldY | Y coordinate in map units |
Returns
Type | Description |
---|---|
Point | Point in screen pixels |
Events
| Improve this Doc View SourceViewportChanged
Declaration
event PropertyChangedEventHandler ViewportChanged
Event Type
Type | Description |
---|---|
System.ComponentModel.PropertyChangedEventHandler |