Class LinearPluginMapCoordinateConverter
- Namespace
- AcDream.Plugin.Abstractions
- Assembly
- AcDream.Plugin.Abstractions.dll
A linear converter for a map image whose bounds are known in world units.
public sealed class LinearPluginMapCoordinateConverter : IPluginMapCoordinateConverter
- Inheritance
-
LinearPluginMapCoordinateConverter
- Implements
- Inherited Members
Remarks
North is up: the image's top edge is the northern edge of the bounds, its left edge the western one.
Constructors
LinearPluginMapCoordinateConverter(PluginMapViewport)
Makes a converter for an image that covers the given part of the world.
public LinearPluginMapCoordinateConverter(PluginMapViewport worldBounds)
Parameters
worldBoundsPluginMapViewportThe part of the world the whole image covers.
Properties
WorldBounds
The part of the world the whole image covers.
public PluginMapViewport WorldBounds { get; }
Property Value
Methods
PixelToWorld(PluginMapPixel, double, double)
Which world point a pixel of an image of the given size shows.
public PluginMapPoint PixelToWorld(PluginMapPixel pixel, double imageWidth, double imageHeight)
Parameters
pixelPluginMapPixelThe pixel position.
imageWidthdoubleThe image's width in pixels.
imageHeightdoubleThe image's height in pixels.
Returns
- PluginMapPoint
The world point. It carries no elevation.
Exceptions
- ArgumentOutOfRangeException
The image width or height is zero or negative.
WorldToPixel(PluginMapPoint, double, double)
Where a world point falls on an image of the given size.
public PluginMapPixel WorldToPixel(PluginMapPoint world, double imageWidth, double imageHeight)
Parameters
worldPluginMapPointThe world point.
imageWidthdoubleThe image's width in pixels.
imageHeightdoubleThe image's height in pixels.
Returns
- PluginMapPixel
The pixel position; outside the image when the point is outside WorldBounds.
Exceptions
- ArgumentOutOfRangeException
The image width or height is zero or negative.