MapUtil¶
Namespace: ThinkGeo.Core
public static class MapUtil
Inheritance Object → MapUtil
Fields¶
StandardDpi¶
public static float StandardDpi;
WmtsStandardDpi¶
public static double WmtsStandardDpi;
WmtsStandardPixelSizeInMillimeters¶
public static double WmtsStandardPixelSizeInMillimeters;
InchesPerFeet¶
public static double InchesPerFeet;
InchesPerMeter¶
public static double InchesPerMeter;
InchesPerMile¶
public static double InchesPerMile;
InchesPerYard¶
public static double InchesPerYard;
InchesPerNauticalMile¶
public static double InchesPerNauticalMile;
InchesPerDecimalDegree¶
public static double InchesPerDecimalDegree;
PointsPerInch¶
public static float PointsPerInch;
Methods¶
IsSamePoint(Vertex, PointShape, Double)¶
public static bool IsSamePoint(Vertex a, PointShape b, double epsilon)
Parameters¶
a Vertex
epsilon Double
Returns¶
GetInchesPerDistanceUnit(DistanceUnit)¶
public static double GetInchesPerDistanceUnit(DistanceUnit targetUnit)
Parameters¶
targetUnit DistanceUnit
Returns¶
GetInchesPerGeographyUnit(GeographyUnit)¶
public static double GetInchesPerGeographyUnit(GeographyUnit targetUnit)
Parameters¶
targetUnit GeographyUnit
Returns¶
GetAreaUnitFromDistanceUnit(DistanceUnit)¶
public static AreaUnit GetAreaUnitFromDistanceUnit(DistanceUnit distanceUnit)
Parameters¶
distanceUnit DistanceUnit
Returns¶
GetShortUnitString(DistanceUnit, Dictionary<String, String>)¶
public static string GetShortUnitString(DistanceUnit targetUnit, Dictionary<string, string> preferredDisplayUnitString)
Parameters¶
targetUnit DistanceUnit
preferredDisplayUnitString Dictionary<String, String>
Returns¶
GetScaleFromResolution(Double, GeographyUnit, Single)¶
public static double GetScaleFromResolution(double resolution, GeographyUnit unit, float dpi)
Parameters¶
resolution Double
unit GeographyUnit
dpi Single
Returns¶
ConvertPointToPixel(Single)¶
internal static float ConvertPointToPixel(float point)
Parameters¶
point Single
Returns¶
Rotate(Double, Double, Double, Double, Double)¶
this method rotates the vector source->target, and return the rotated vector based on source
public static ValueTuple<double, double> Rotate(double sourceX, double sourceY, double destinationX, double destinationY, double rotationAngle)
Parameters¶
sourceX Double
the source x
sourceY Double
the source y
destinationX Double
the destination x before rotation
destinationY Double
the destination y before rotation
rotationAngle Double
the angle to rotate. positive means counter-clockwise
Returns¶
ValueTuple<Double, Double>
The rotated target based on source
RotatePoint(Double, Double, Double, Double, Double)¶
public static ValueTuple<double, double> RotatePoint(double x, double y, double rotationAngle, double pivotX, double pivotY)
Parameters¶
x Double
y Double
rotationAngle Double
pivotX Double
pivotY Double
Returns¶
RotateRingShape(RingShape, Double, Double, Double)¶
public static RingShape RotateRingShape(RingShape ringShape, double rotationAngle, double pivotX, double pivotY)
Parameters¶
ringShape RingShape
rotationAngle Double
pivotX Double
pivotY Double
Returns¶
RotatePolygonShape(PolygonShape, Double, Double, Double)¶
public static PolygonShape RotatePolygonShape(PolygonShape polygonShape, double rotationAngle, double pivotX, double pivotY)
Parameters¶
polygonShape PolygonShape
rotationAngle Double
pivotX Double
pivotY Double
Returns¶
ScaleExtent(Double, Double, Double, Double, Double, Double, Double)¶
Scale the current extent base on the given center point
public static RectangleShape ScaleExtent(double mapWidth, double mapHeight, double resolution, double centerScreenX, double centerScreenY, double centerWorldX, double centerWorldY)
Parameters¶
mapWidth Double
The width of the map canvas
mapHeight Double
The height of the map canvas
resolution Double
The current resolution, in WorldUnit/Pixel
centerScreenX Double
The X of the new center screen point
centerScreenY Double
The Y of the new center screen point
centerWorldX Double
The X of the new center world point
centerWorldY Double
The Y of the new center world point
Returns¶
RectangleShape
The scaled extent
GetRotatedCanvasRadius(Double, Double, Double, Double)¶
public static double GetRotatedCanvasRadius(double pivotX, double pivotY, double canvasWidth, double canvasHeight)
Parameters¶
pivotX Double
pivotY Double
canvasWidth Double
canvasHeight Double
Returns¶
OffsetPointWithScreenOffset(PointShape, Double, Double, Double, Double, GeographyUnit)¶
Offsets a world coordinate point by a specified screen offset and returns the new world coordinate.
public static PointShape OffsetPointWithScreenOffset(PointShape pointShape, double xScreenOffset, double yScreenOffset, double mapRotation, double mapScale, GeographyUnit mapUnit)
Parameters¶
pointShape PointShape
The original world coordinate point.
xScreenOffset Double
The horizontal offset in screen pixels.
yScreenOffset Double
The vertical offset in screen pixels (remember, Y is inverted).
mapRotation Double
The map's rotation angle in degrees.
mapScale Double
The scale of the map.
mapUnit GeographyUnit
The geographic unit of the map (e.g., meters, degrees, etc.).
Returns¶
PointShape
The world coordinate of the point after applying the screen offset.
Remarks:
The offset is provided in screen pixels. Note that the Y-axis in screen coordinates is inverted (the top of the screen has the highest Y value). The method applies the map's rotation and scale to the screen offset before converting it to the corresponding world coordinate.
GetWorldExtent(GeographyUnit)¶
public static RectangleShape GetWorldExtent(GeographyUnit unit)
Parameters¶
unit GeographyUnit
Returns¶
ToWorldCoordinate(Double, Double, PointShape, Double, Double, Double, GeographyUnit, Double)¶
public static PointShape ToWorldCoordinate(double screenX, double screenY, PointShape centerPoint, double centerScreenX, double centerScreenY, double scale, GeographyUnit mapUnit, double mapRotation)
Parameters¶
screenX Double
screenY Double
centerPoint PointShape
centerScreenX Double
centerScreenY Double
scale Double
mapUnit GeographyUnit
mapRotation Double
Returns¶
GetExtentFromCenterPoint(PointShape, Double, Double, Double, GeographyUnit)¶
public static RectangleShape GetExtentFromCenterPoint(PointShape centerPoint, double canvasWidth, double canvasHeight, double scale, GeographyUnit mapUnit)
Parameters¶
centerPoint PointShape
canvasWidth Double
canvasHeight Double
scale Double
mapUnit GeographyUnit
Returns¶
GetFloorCeilingScales(Double, ZoomLevelSet)¶
public static ValueTuple<double, double> GetFloorCeilingScales(double scale, ZoomLevelSet zoomLevelSet)
Parameters¶
scale Double
zoomLevelSet ZoomLevelSet
Returns¶
GetDegreeFromPanDirection(PanDirection)¶
public static double GetDegreeFromPanDirection(PanDirection panDirection)
Parameters¶
panDirection PanDirection
Returns¶
GetResolutionOfRotatedExtent(RectangleShape, Double, Double, Double)¶
Get the resolution if displaying a rotated extent within a canvas
public static double GetResolutionOfRotatedExtent(RectangleShape extent, double rotationAngle, double canvasWidth, double canvasHeight)
Parameters¶
extent RectangleShape
the extent to display on the canvas
rotationAngle Double
the rotation angle of the extent
canvasWidth Double
canvas width in pixel
canvasHeight Double
canvas height in pixel
Returns¶
RoundToInt32(Double)¶
Round the input double to integer.
public static int RoundToInt32(double value)
Parameters¶
value Double
the double to convert to integer
Returns¶
Int32
return (int)Math.Round(value)
GetResolutionFromScale(Double, GeographyUnit, Single)¶
public static double GetResolutionFromScale(double scale, GeographyUnit unit, float dpi)
Parameters¶
scale Double
unit GeographyUnit
dpi Single
Returns¶
GetResolution(RectangleShape, Double, Double)¶
public static double GetResolution(RectangleShape boundingBox, double widthInPixel, double heightInPixel)
Parameters¶
boundingBox RectangleShape
widthInPixel Double
heightInPixel Double
Returns¶
GetScale(RectangleShape, Double, GeographyUnit, Single)¶
Calculate the scale based on the screenWidth and worldExtent.Width
public static double GetScale(RectangleShape worldExtent, double screenWidth, GeographyUnit worldExtentUnit, float dpi)
Parameters¶
worldExtent RectangleShape
screenWidth Double
worldExtentUnit GeographyUnit
dpi Single
Returns¶
GetScale(GeographyUnit, RectangleShape, Double, Double, Single)¶
Calculate the scale based on the screenWidth and worldExtent.Width, the screenHeight and worldExtent.Height independently, and return the greater one.
public static double GetScale(GeographyUnit mapUnit, RectangleShape boundingBox, double widthInPixel, double heightInPixel, float dpi)
Parameters¶
mapUnit GeographyUnit
boundingBox RectangleShape
widthInPixel Double
heightInPixel Double
dpi Single
Returns¶
GetSnappedScale(RectangleShape, Single, GeographyUnit, ZoomLevelSet)¶
public static double GetSnappedScale(RectangleShape worldExtent, float screenWidth, GeographyUnit worldExtentUnit, ZoomLevelSet zoomLevelSet)
Parameters¶
worldExtent RectangleShape
screenWidth Single
worldExtentUnit GeographyUnit
zoomLevelSet ZoomLevelSet
Returns¶
GetSnappedScale(RectangleShape, Single, GeographyUnit, Collection<Double>)¶
public static double GetSnappedScale(RectangleShape worldExtent, float screenWidth, GeographyUnit worldExtentUnit, Collection<double> zoomScales)
Parameters¶
worldExtent RectangleShape
screenWidth Single
worldExtentUnit GeographyUnit
zoomScales Collection<Double>
Returns¶
GetSnappedScale(Double, ZoomLevelSet)¶
public static double GetSnappedScale(double scale, ZoomLevelSet zoomLevelSet)
Parameters¶
scale Double
zoomLevelSet ZoomLevelSet
Returns¶
GetSnappedScale(Double, Collection<Double>)¶
public static double GetSnappedScale(double scale, Collection<double> zoomScales)
Parameters¶
scale Double
zoomScales Collection<Double>
Returns¶
CalculateExtent(PointShape, Double, GeographyUnit, Double, Double)¶
public static RectangleShape CalculateExtent(PointShape worldCenter, double scale, GeographyUnit mapUnit, double mapWidth, double mapHeight)
Parameters¶
worldCenter PointShape
scale Double
mapUnit GeographyUnit
mapWidth Double
mapHeight Double
Returns¶
AdjustExtentByRestrictions(RectangleShape, Double, Double, RectangleShape, Double, Double, GeographyUnit)¶
public static RectangleShape AdjustExtentByRestrictions(RectangleShape targetExtent, double width, double height, RectangleShape restrictExtent, double maximumScale, double minimumScale, GeographyUnit mapUnit)
Parameters¶
targetExtent RectangleShape
width Double
height Double
restrictExtent RectangleShape
maximumScale Double
minimumScale Double
mapUnit GeographyUnit
Returns¶
ToWorldCoordinate(RectangleShape, Double, Double, Double, Double)¶
Convert a screen point to the World coordinate.If the map is rotated, please use another overload: public static PointShape ToWorldCoordinate(double screenX, double screenY, PointShape centerPoint,double centerScreenX, double centerScreenY, double scale, GeographyUnit mapUnit, double mapRotation = 0)
public static PointShape ToWorldCoordinate(RectangleShape currentExtent, double screenX, double screenY, double screenWidth, double screenHeight)
Parameters¶
currentExtent RectangleShape
The current Extent of the current map
screenX Double
the x of the input screen point
screenY Double
the y of the input screen point
screenWidth Double
screen with in pixel
screenHeight Double
screen height in pixel
Returns¶
PointShape
the world coordinate of the input screen point
GetDistance(PointShape, PointShape)¶
public static double GetDistance(PointShape fromPoint, PointShape toPoint)
Parameters¶
fromPoint PointShape
toPoint PointShape
Returns¶
RoundUpToNextEven(Double)¶
Rounds a number up to the next even integer to avoid fractional values caused by WPF's rendering system.
public static double RoundUpToNextEven(double value)
Parameters¶
value Double
The number to round up.
Returns¶
The smallest even integer greater than or equal to .
GetFloorZoomLevelIndex(Double, ZoomLevelSet)¶
Get the floor zoomlevel index based on the current scale. For example if the current scale is around zoomlevel 3.9, this method returns 3 instead of 4. We need this feature in some cases for example when we want to get a zoomlevel to totally contains a given extent, we don't want it just snap to the closest one. To get the closest zoomlevelIndex, use GetSnappedZoomLevelIndex.
public static int GetFloorZoomLevelIndex(double scale, ZoomLevelSet zoomLevelSet)
Parameters¶
scale Double
zoomLevelSet ZoomLevelSet
Returns¶
Int32
The floor zoomlevel index
GetFloorCeilingZoomLevelIndex(Double, ZoomLevelSet)¶
Get the index of FloorZoomLevel and CeilingZoomLevel
public static ValueTuple<int, int> GetFloorCeilingZoomLevelIndex(double scale, ZoomLevelSet zoomLevelSet)
Parameters¶
scale Double
the scale to calculate the floor/ceiling zoomlevel
zoomLevelSet ZoomLevelSet
the returned value are the indexes of GetZoomLevels() of the given zoomLevelSet.
Returns¶
ValueTuple<Int32, Int32>
2 integers: the floor zoomlevel index, and the ceiling zoomlevel index
GetClosestZoomLevelIndex(Double, ZoomLevelSet)¶
public static int GetClosestZoomLevelIndex(double scale, ZoomLevelSet zoomLevelSet)
Parameters¶
scale Double
zoomLevelSet ZoomLevelSet
Returns¶
GetFloorZoomLevelIndex(Double, Collection<Double>)¶
Get the floor zoomlevel index based on the current scale. For example if the current scale is around zoomlevel 3.9, this method returns 3 instead of 4. We need this feature in some cases for example when we want to get a zoomlevel to totally contains a given extent, we don't want it just snap to the closest one. To get the closest zoomlevelIndex, use GetSnappedZoomLevelIndex.
public static int GetFloorZoomLevelIndex(double scale, Collection<double> zoomLevelScales)
Parameters¶
scale Double
zoomLevelScales Collection<Double>
Returns¶
Int32
The floor zoomlevel index
GetFloorCeilingZoomLevelIndex(Double, Collection<Double>)¶
Get the index of FloorZoomLevel and CeilingZoomLevel
public static ValueTuple<int, int> GetFloorCeilingZoomLevelIndex(double scale, Collection<double> zoomLevelScales)
Parameters¶
scale Double
the scale to calculate the floor/ceiling zoomlevel
zoomLevelScales Collection<Double>
a collections of zoomlevel scales, the return indexes are the index of this collection
Returns¶
ValueTuple<Int32, Int32>
2 integers: the floor zoomlevel index, and the ceiling zoomlevel index
GetClosestZoomLevelIndex(Double, Collection<Double>)¶
public static int GetClosestZoomLevelIndex(double scale, Collection<double> zoomLevelScales)
Parameters¶
scale Double
zoomLevelScales Collection<Double>
Returns¶
GetSnappedZoomLevelIndex(RectangleShape, GeographyUnit, Collection<Double>, Double, Double)¶
This method returns the closest zoomlevel index. If you want to return the zoomlevel index with a scale contains the given extent, use GetFloorZoomLevelIndex method instead.
public static int GetSnappedZoomLevelIndex(RectangleShape extent, GeographyUnit mapUnit, Collection<double> zoomLevelScales, double actualWidth, double actualHeight)
Parameters¶
extent RectangleShape
mapUnit GeographyUnit
zoomLevelScales Collection<Double>
actualWidth Double
actualHeight Double
Returns¶
Int32
The closest zoomlevel index
GetSnappedZoomLevelIndex(Double, ZoomLevelSet)¶
This method returns the closest zoomlevel index. If you want to return the zoomlevel index with a scale greater than the given one, use GetFloorZoomLevelIndex method instead.
public static int GetSnappedZoomLevelIndex(double scale, ZoomLevelSet zoomLevelSet)
Parameters¶
scale Double
zoomLevelSet ZoomLevelSet
Returns¶
Int32
The closest zoomlevel index
GetSnappedZoomLevelIndex(Double, Collection<Double>)¶
public static int GetSnappedZoomLevelIndex(double scale, Collection<double> zoomScales)
Parameters¶
scale Double
zoomScales Collection<Double>
Returns¶
GetSnappedZoomLevelIndex(Double, IEnumerable<Double>, Double, Double)¶
This method returns the closest zoomlevel index. If you want to return the zoomlevel index with a scale greater than the given one, use GetFloorZoomLevelIndex method instead.
public static int GetSnappedZoomLevelIndex(double scale, IEnumerable<double> zoomLevelScales, double minimumScale, double maximumScale)
Parameters¶
scale Double
zoomLevelScales IEnumerable<Double>
minimumScale Double
maximumScale Double
Returns¶
Int32
The closest zoomlevel index
GetZoom(Double, Collection<Double>)¶
Calculates a fractional zoom index for a given map scale by interpolating between the two nearest scales in a descending list of predefined zoom scales.
public static double GetZoom(double scale, Collection<double> zoomLevelScales)
Parameters¶
scale Double
The target map scale (e.g. meters per pixel).
zoomLevelScales Collection<Double>
A of scales sorted in descending order
(coarsest at index 0, finest at last index).
Returns¶
A zoom index as a , where:
The integer part is the lower zoom level.The fractional part indicates the position toward the next higher zoom level.
Returns double.NaN if is null or empty
or if no bracketing scales are found.
GetScale(Double, Collection<Double>)¶
Calculates a map scale for a given fractional zoom index by interpolating between the two nearest scales in a descending list of predefined zoom scales.
public static double GetScale(double zoom, Collection<double> zoomLevelScales)
Parameters¶
zoom Double
The fractional zoom index (e.g. 2.5 means halfway between zoom levels 2 and 3).
zoomLevelScales Collection<Double>
A of scales sorted in descending order
(coarsest at index 0, finest at last index).
Returns¶
A map scale as a corresponding to the given zoom index.
Returns double.NaN if is null or empty.
GetRotatedScreenPoint(Double, Double, Double, ScreenPointF)¶
public static ScreenPointF GetRotatedScreenPoint(double x, double y, double rotatedAngle, ScreenPointF pivotPoint)
Parameters¶
x Double
y Double
rotatedAngle Double
pivotPoint ScreenPointF
Returns¶
GetRotatedScreenPoint(Double, Double, Double, ScreenPointD)¶
public static ScreenPointF GetRotatedScreenPoint(double x, double y, double rotatedAngle, ScreenPointD pivotPoint)
Parameters¶
x Double
y Double
rotatedAngle Double
pivotPoint ScreenPointD
Returns¶
GetRotatedPoint(Double, Double, Double, PointShape)¶
public static PointShape GetRotatedPoint(double x, double y, double rotatedAngle, PointShape pivotPoint)
Parameters¶
x Double
y Double
rotatedAngle Double
pivotPoint PointShape
Returns¶
GetRotatedExtent(RectangleShape, Double, PointShape)¶
public static RectangleShape GetRotatedExtent(RectangleShape extent, double rotatedAngle, PointShape pivotPoint)
Parameters¶
extent RectangleShape
rotatedAngle Double
pivotPoint PointShape
Returns¶
GetRotatedPolygon(RectangleShape, Double, PointShape)¶
public static AreaBaseShape GetRotatedPolygon(RectangleShape extent, double rotatedAngle, PointShape pivotPoint)
Parameters¶
extent RectangleShape
rotatedAngle Double
pivotPoint PointShape
Returns¶
ApplyDrawingMarginToExtent(RectangleShape, Single, Single, Single)¶
public static RectangleShape ApplyDrawingMarginToExtent(RectangleShape worldExtent, float marginInPixel, float screenWidth, float screenHeight)
Parameters¶
worldExtent RectangleShape
marginInPixel Single
screenWidth Single
screenHeight Single
Returns¶
ApplyDrawingMarginToExtent(RectangleShape, Single, Double)¶
public static RectangleShape ApplyDrawingMarginToExtent(RectangleShape worldExtent, float marginInPixel, double resolution)
Parameters¶
worldExtent RectangleShape
marginInPixel Single
resolution Double
Returns¶
CenterAt(RectangleShape, PointShape, Single, Single)¶
This is a static function that allows you to pass in a world rectangle, a world point to center on, and a height and width in screen units. The function will center the rectangle based on the point, then adjust the rectangle's ratio based on the height and width in screen coordinates.
public static RectangleShape CenterAt(RectangleShape worldExtent, PointShape worldPoint, float screenWidth, float screenHeight)
Parameters¶
worldExtent RectangleShape
This parameter is the current extent you want to center.
worldPoint PointShape
This parameter is the world point you want to center on.
screenWidth Single
This parameter is the width of the screen.
screenHeight Single
This parameter is the height of the screen.
Returns¶
RectangleShape
This method returns an adjusted extent centered on a point.
Remarks:
None
CenterAt(RectangleShape, Feature, Single, Single)¶
This is a static function that allows you to pass in a world rectangle, a world point to center on, and a height and width in screen units. The function will center the rectangle based on the point, then adjust the rectangle's ratio based on the height and width in screen coordinates.
public static RectangleShape CenterAt(RectangleShape worldExtent, Feature centerFeature, float screenWidth, float screenHeight)
Parameters¶
worldExtent RectangleShape
This parameter is the current extent you want to center.
centerFeature Feature
This parameter is the world point you want to center on.
screenWidth Single
This parameter is the width of the screen.
screenHeight Single
This parameter is the height of the screen.
Returns¶
RectangleShape
This method returns an adjusted extent centered on a point.
Remarks:
None
CenterAt(RectangleShape, Single, Single, Single, Single)¶
This method returns an adjusted extent centered on a point.
public static RectangleShape CenterAt(RectangleShape worldExtent, float screenX, float screenY, float screenWidth, float screenHeight)
Parameters¶
worldExtent RectangleShape
This parameter is the current extent you want to center.
screenX Single
This parameter is the X coordinate on the screen to center on.
screenY Single
This parameter is the Y coordinate on the screen to center on.
screenWidth Single
This parameter is the width of the screen.
screenHeight Single
This parameter is the height of the screen.
Returns¶
RectangleShape
This method returns an adjusted extent centered on a point.
Remarks:
None
GetBoundingBoxOfItems(IEnumerable<BaseShape>)¶
This API gets the BoundingBox of a group of BaseShapes.
public static RectangleShape GetBoundingBoxOfItems(IEnumerable<BaseShape> shapes)
Parameters¶
shapes IEnumerable<BaseShape>
The target group of BaseShapes to get the BoundingBox for.
Returns¶
RectangleShape
The BoundingBox that contains all of the shapes you passed in.
GetBoundingBoxOfItems(IEnumerable<Feature>)¶
This API gets the BoundingBox of a group of Features.
public static RectangleShape GetBoundingBoxOfItems(IEnumerable<Feature> features)
Parameters¶
features IEnumerable<Feature>
The target group of Features to get the BoundingBox for.
Returns¶
RectangleShape
The BoundingBox that contains all the features you passed in.
GetDrawingExtent(RectangleShape, Double, Double)¶
This method returns an adjusted extent based on the ratio of the screen width and height.
public static RectangleShape GetDrawingExtent(RectangleShape worldExtent, double screenWidth, double screenHeight)
Parameters¶
worldExtent RectangleShape
This parameter is the world extent you want to adjust for drawing.
screenWidth Double
This parameter is the width of the screen.
screenHeight Double
This parameter is the height of the screen.
Returns¶
This method returns an adjusted extent based on the ratio of the screen width and
height.
Remarks:
This function is used because the extent to draw must be the rame ratio as the screen width and height. If they are not, then the image drawn will be stretched or compressed. We always adjust the extent upwards to ensure that no matter how we adjust it, the original extent will fit within the new extent. This ensures that everything you wanted to see in the first extent is visible and maybe a bit more.
GetScreenDistanceBetweenTwoWorldPoints(RectangleShape, PointShape, PointShape, Single, Single)¶
This method returns the number of pixels between two world points.
public static float GetScreenDistanceBetweenTwoWorldPoints(RectangleShape worldExtent, PointShape worldPoint1, PointShape worldPoint2, float screenWidth, float screenHeight)
Parameters¶
worldExtent RectangleShape
This parameter is the world extent.
worldPoint1 PointShape
This parameter is the first point -- the one you want to measure from.
worldPoint2 PointShape
This parameter is the second point -- the one you want to measure to.
screenWidth Single
This parameter is the width of the screen.
screenHeight Single
This parameter is the height of the screen.
Returns¶
Single
This method returns the number of pixels between two world points.
Remarks:
None
GetScreenDistanceBetweenTwoWorldPoints(RectangleShape, Feature, Feature, Single, Single)¶
This method returns the number of pixels between two features.
public static float GetScreenDistanceBetweenTwoWorldPoints(RectangleShape worldExtent, Feature worldPointFeature1, Feature worldPointFeature2, float screenWidth, float screenHeight)
Parameters¶
worldExtent RectangleShape
This parameter is the world extent.
worldPointFeature1 Feature
This parameter is the first feature -- the one you want to measure from.
worldPointFeature2 Feature
This parameter is the second feature -- the one you want to measure to.
screenWidth Single
This parameter is the width of the screen.
screenHeight Single
This parameter is the height of the screen.
Returns¶
Single
This method returns the number of pixels between two features.
Remarks:
None
GetSnappedExtent(RectangleShape, GeographyUnit, Single, Single, ZoomLevelSet)¶
public static RectangleShape GetSnappedExtent(RectangleShape worldExtent, GeographyUnit worldExtentUnit, float screenWidth, float screenHeight, ZoomLevelSet zoomLevelSet)
Parameters¶
worldExtent RectangleShape
worldExtentUnit GeographyUnit
screenWidth Single
screenHeight Single
zoomLevelSet ZoomLevelSet
Returns¶
GetWorldDistanceBetweenTwoScreenPoints(RectangleShape, ScreenPointF, ScreenPointF, Single, Single, GeographyUnit, DistanceUnit)¶
This method returns the distance in world units between two screen points.
public static double GetWorldDistanceBetweenTwoScreenPoints(RectangleShape worldExtent, ScreenPointF screenPoint1, ScreenPointF screenPoint2, float screenWidth, float screenHeight, GeographyUnit worldExtentUnit, DistanceUnit distanceUnit)
Parameters¶
worldExtent RectangleShape
This parameter is the world extent.
screenPoint1 ScreenPointF
This is the screen point you want to measure from.
screenPoint2 ScreenPointF
This is the screen point you want to measure to.
screenWidth Single
This parameter is the width of the screen.
screenHeight Single
This parameter is the height of the screen.
worldExtentUnit GeographyUnit
This is the geographic unit of the world extent rectangle.
distanceUnit DistanceUnit
This is the geographic unit you want the result to show in.
Returns¶
Double
This method returns the distance in world units between two screen points.
Remarks:
None
GetWorldDistanceBetweenTwoScreenPoints(RectangleShape, Single, Single, Single, Single, Single, Single, GeographyUnit, DistanceUnit)¶
This method returns the distance in world units between two screen points.
public static double GetWorldDistanceBetweenTwoScreenPoints(RectangleShape worldExtent, float screenPoint1X, float screenPoint1Y, float screenPoint2X, float screenPoint2Y, float screenWidth, float screenHeight, GeographyUnit worldExtentUnit, DistanceUnit distanceUnit)
Parameters¶
worldExtent RectangleShape
This parameter is the world extent.
screenPoint1X Single
This parameter is the X of the point you want to measure from.
screenPoint1Y Single
This parameter is the Y of the point you want to measure from.
screenPoint2X Single
This parameter is the X of the point you want to measure to.
screenPoint2Y Single
This parameter is the Y of the point you want to measure to.
screenWidth Single
This parameter is the width of the screen.
screenHeight Single
This parameter is the height of the screen.
worldExtentUnit GeographyUnit
This is the geographic unit of the world extent you passed in.
distanceUnit DistanceUnit
This is the geographic unit you want the result to show in.
Returns¶
Pan(RectangleShape, PanDirection, Int32)¶
This method returns a panned extent.
public static RectangleShape Pan(RectangleShape worldExtent, PanDirection direction, int percentage)
Parameters¶
worldExtent RectangleShape
This parameter is the world extent you want to pan.
direction PanDirection
This parameter is the direction in which you want to pan.
percentage Int32
This parameter is the percentage by which you want to pan.
Returns¶
RectangleShape
This method returns a panned extent.
Remarks:
None
Pan(RectangleShape, Single, Int32)¶
This method returns a panned extent.
public static RectangleShape Pan(RectangleShape worldExtent, float degree, int percentage)
Parameters¶
worldExtent RectangleShape
This parameter is the world extent you want to pan.
degree Single
This parameter is the degree you want to pan.
percentage Int32
This parameter is the percentage by which you want to pan.
Returns¶
RectangleShape
This method returns a panned extent.
Remarks:
None
ToScreenCoordinate(BaseShape, RectangleShape, Single, Single)¶
This method returns BaseShape in screen coordinates from BaseShape in world coordinates.
public static BaseShape ToScreenCoordinate(BaseShape shape, RectangleShape worldExtent, float screenWidth, float screenHeight)
Parameters¶
shape BaseShape
This parameter is the shape in world coordinate you want converted to a shape in screen coordinate.
worldExtent RectangleShape
This parameter is the world extent.
screenWidth Single
This parameter is the width of the screen.
screenHeight Single
This parameter is the height of the screen.
Returns¶
BaseShape
This method returns BaseShape in screen coordinates from BaseShape in world coordinates.
Remarks:
None
ToScreenCoordinate(Feature, RectangleShape, Single, Single)¶
public static BaseShape ToScreenCoordinate(Feature feature, RectangleShape worldExtent, float screenWidth, float screenHeight)
Parameters¶
feature Feature
worldExtent RectangleShape
screenWidth Single
screenHeight Single
Returns¶
ToScreenCoordinate(Byte[], WellKnownType, RectangleShape, Single, Single)¶
public static BaseShape ToScreenCoordinate(Byte[] wellKnownBinary, WellKnownType shapeType, RectangleShape worldExtent, float screenWidth, float screenHeight)
Parameters¶
wellKnownBinary Byte[]
shapeType WellKnownType
worldExtent RectangleShape
screenWidth Single
screenHeight Single
Returns¶
ToScreenCoordinate(RectangleShape, RectangleShape, Single, Single)¶
This method returns Rectangle in screen coordinates from RectangleShape in world coordinates.
public static DrawingRectangle ToScreenCoordinate(RectangleShape worldExtent, RectangleShape targetWorldExtent, float screenWidth, float screenHeight)
Parameters¶
worldExtent RectangleShape
This parameter is the world extent.
targetWorldExtent RectangleShape
This parameter is the rectangle shape in world coordinate you want converted to a rectangle in screen coordinate.
screenWidth Single
This parameter is the width of the screen.
screenHeight Single
This parameter is the height of the screen.
Returns¶
DrawingRectangle
This method returns Rectangle in screen coordinates from RectangleShape in world coordinates.
Remarks:
None
ToScreenCoordinate(RectangleShape, Double, Double, Double, Double)¶
This method returns screen coordinates from world coordinates.
public static ScreenPointF ToScreenCoordinate(RectangleShape worldExtent, double worldX, double worldY, double screenWidth, double screenHeight)
Parameters¶
worldExtent RectangleShape
This parameter is the world extent.
worldX Double
This parameter is the world X you want converted to screen points.
worldY Double
This parameter is the world Y you want converted to screen points.
screenWidth Double
This parameter is the width of the screen.
screenHeight Double
This parameter is the height of the screen.
Returns¶
ScreenPointF
This method returns screen coordinates from world coordinates.
Remarks:
None
ToScreenCoordinate(RectangleShape, PointShape, Single, Single)¶
This method returns screen coordinates from world coordinates.
public static ScreenPointF ToScreenCoordinate(RectangleShape worldExtent, PointShape worldPoint, float screenWidth, float screenHeight)
Parameters¶
worldExtent RectangleShape
This parameter is the world extent.
worldPoint PointShape
This parameter is the world point you want converted to a screen point.
screenWidth Single
This parameter is the width of the screen.
screenHeight Single
This parameter is the height of the screen.
Returns¶
ScreenPointF
This method returns screen coordinates from world coordinates.
Remarks:
None
ToScreenCoordinate(RectangleShape, Feature, Single, Single)¶
This method returns screen coordinates from world coordinates.
public static ScreenPointF ToScreenCoordinate(RectangleShape worldExtent, Feature worldPointFeature, float screenWidth, float screenHeight)
Parameters¶
worldExtent RectangleShape
This parameter is the world extent.
worldPointFeature Feature
This parameter is the feature you want converted to a screen point.
screenWidth Single
This parameter is the width of the screen.
screenHeight Single
This parameter is the height of the screen.
Returns¶
ScreenPointF
This method returns screen coordinates from world coordinates.
Remarks:
None
ToWorldCoordinate(RectangleShape, Single, Single, Single, Single)¶
This method returns world coordinates from screen coordinates.
public static PointShape ToWorldCoordinate(RectangleShape worldExtent, float screenX, float screenY, float screenWidth, float screenHeight)
Parameters¶
worldExtent RectangleShape
This parameter is the world extent.
screenX Single
This parameter is the X of the point you want converted to world
coordinates.
screenY Single
This parameter is the Y of the point you want converted to world
coordinates.
screenWidth Single
This parameter is the width of the screen.
screenHeight Single
This parameter is the height of the screen.
Returns¶
PointShape
This method returns world coordinates from screen coordinates.
Remarks:
None
ToWorldCoordinate(RectangleShape, ScreenPointF, Single, Single)¶
This method returns world coordinates from screen coordinates.
public static PointShape ToWorldCoordinate(RectangleShape worldExtent, ScreenPointF screenPoint, float screenWidth, float screenHeight)
Parameters¶
worldExtent RectangleShape
This parameter is the world extent.
screenPoint ScreenPointF
This parameter is the screen point you want converted to a world point.
screenWidth Single
This parameter is the width of the screen.
screenHeight Single
This parameter is the height of the screen.
Returns¶
PointShape
This method returns world coordinates from screen coordinates.
Remarks:
None
ZoomIn(RectangleShape, Int32)¶
This method returns a new extent that is zoomed in by the percentage provided.
public static RectangleShape ZoomIn(RectangleShape worldExtent, int percentage)
Parameters¶
worldExtent RectangleShape
This parameter is the world extent you want to zoom to.
percentage Int32
This parameter is the percentage by which you want to zoom in.
Returns¶
This method returns a new extent that is zoomed in by the percentage
provided.
Remarks:
None
ZoomIntoCenter(RectangleShape, Int32, PointShape, Single, Single)¶
This method returns an extent that is centered and zoomed in.
public static RectangleShape ZoomIntoCenter(RectangleShape worldExtent, int percentage, PointShape worldPoint, float screenWidth, float screenHeight)
Parameters¶
worldExtent RectangleShape
This parameter is the world extent that you want centered and zoomed to.
percentage Int32
This parameter is the percentage by which you want to zoom in.
worldPoint PointShape
This parameter is the world point you want the extent to be centered on.
screenWidth Single
This parameter is the width in screen coordinates.
screenHeight Single
This parameter is the height in screen coordinates.
Returns¶
RectangleShape
This method returns an extent that is centered and zoomed in.
Remarks:
The resulting rectangle will already be adjusted for the ratio of the screen. You do not need to call GetDrawingExtent afterwards.
ZoomIntoCenter(RectangleShape, Int32, Feature, Single, Single)¶
This method returns an extent that is centered and zoomed.
public static RectangleShape ZoomIntoCenter(RectangleShape worldExtent, int percentage, Feature centerFeature, float screenWidth, float screenHeight)
Parameters¶
worldExtent RectangleShape
This parameter is the world extent that you want centered and zoomed to.
percentage Int32
This parameter is the percentage by which you want to zoom in.
centerFeature Feature
This parameter is the feature you want the extent to be centered on.
screenWidth Single
This parameter is the width in screen coordinates.
screenHeight Single
This parameter is the height in screen coordinates.
Returns¶
RectangleShape
This method returns an extent that is centered and zoomed in.
Remarks:
The resulting rectangle will already be adjusted for the ratio of the screen. You do not need to call GetDrawingExtent afterwards.
ZoomIntoCenter(RectangleShape, Int32, Single, Single, Single, Single)¶
This method returns an extent that is centered and zoomed in.
public static RectangleShape ZoomIntoCenter(RectangleShape worldExtent, int percentage, float screenX, float screenY, float screenWidth, float screenHeight)
Parameters¶
worldExtent RectangleShape
This parameter is the world extent you want to center and zoom to.
percentage Int32
This parameter is the percentage by which you want to zoom in.
screenX Single
This parameter is the screen X you want to center on.
screenY Single
This parameter is the screen Y you want to center on.
screenWidth Single
This parameter is the width of the screen.
screenHeight Single
This parameter is the height of the screen.
Returns¶
RectangleShape
This method returns an extent that is centered and zoomed in.
Remarks:
The resulting rectangle will already be adjusted for the ratio of the screen. You do not need to call GetDrawingExtent afterwards.
ZoomOut(RectangleShape, Int32)¶
This method returns a new extent that is zoomed out by the percentage provided.
public static RectangleShape ZoomOut(RectangleShape worldExtent, int percentage)
Parameters¶
worldExtent RectangleShape
This parameter is the world extent you want to zoom out to.
percentage Int32
This parameter is the percentage by which you want to zoom out.
Returns¶
This method returns a new extent that is zoomed out by the percentage
provided.
Remarks:
None
ZoomOutToCenter(RectangleShape, Int32, PointShape, Single, Single)¶
This method returns an extent that is centered and zoomed out.
public static RectangleShape ZoomOutToCenter(RectangleShape worldExtent, int percentage, PointShape worldPoint, float screenWidth, float screenHeight)
Parameters¶
worldExtent RectangleShape
This parameter is the world extent you want to center and zoom out to.
percentage Int32
This parameter is the percentage by which you want to zoom out.
worldPoint PointShape
This parameter is the world point you want the extent to be centered on.
screenWidth Single
This parameter is the width of the screen.
screenHeight Single
This parameter is the height of the screen.
Returns¶
RectangleShape
This method returns an extent that is centered and zoomed out.
Remarks:
The resulting rectangle will already be adjusted for the ratio of the screen. You do not need to call GetDrawingExtent afterward.
ZoomOutToCenter(RectangleShape, Int32, Feature, Single, Single)¶
This method returns an extent that is centered and zoomed out.
public static RectangleShape ZoomOutToCenter(RectangleShape worldExtent, int percentage, Feature centerFeature, float screenWidth, float screenHeight)
Parameters¶
worldExtent RectangleShape
This parameter is the world extent you want to center and zoom out to.
percentage Int32
This parameter is the percentage by which you want to zoom out.
centerFeature Feature
This parameter is the feature you want the extent to be centered on.
screenWidth Single
This parameter is the width of the screen.
screenHeight Single
This parameter is the height of the screen.
Returns¶
RectangleShape
This method returns an extent that is centered and zoomed out.
Remarks:
The resulting rectangle will already be adjusted for the ratio of the screen. You do not need to call GetDrawingExtent afterwards.
ZoomOutToCenter(RectangleShape, Int32, Single, Single, Single, Single)¶
This method returns an extent that is centered and zoomed out.
public static RectangleShape ZoomOutToCenter(RectangleShape worldExtent, int percentage, float screenX, float screenY, float screenWidth, float screenHeight)
Parameters¶
worldExtent RectangleShape
This parameter is the world extent you want to center and zoom out to.
percentage Int32
This parameter is the percentage by which you want to zoom out.
screenX Single
This parameter is the screen X you want to center on.
screenY Single
This parameter is the screen Y you want to center on.
screenWidth Single
This parameter is the width of the screen.
screenHeight Single
This parameter is the height of the screen.
Returns¶
RectangleShape
This method returns an extent that is centered and zoomed out.
Remarks:
The resulting rectangle will already be adjusted for the ratio of the screen. You do not need to call GetDrawingExtent afterward.
ZoomToScale(Double, RectangleShape, GeographyUnit, Double, Double)¶
This method returns a extent that has been zoomed into a certain scale.
public static RectangleShape ZoomToScale(double targetScale, RectangleShape worldExtent, GeographyUnit worldExtentUnit, double screenWidth, double screenHeight)
Parameters¶
targetScale Double
This parameter is the scale you want to zoom into.
worldExtent RectangleShape
This parameter is the world extent you want zoomed into the scale.
worldExtentUnit GeographyUnit
This parameter is the geographic unit of the world extent parameter.
screenWidth Double
This parameter is the screen width.
screenHeight Double
This parameter is the screen height.
Returns¶
RectangleShape
This method returns a extent that has been zoomed into a certain scale.
Remarks:
None
ZoomToScale(Double, RectangleShape, GeographyUnit, Single, Single, ScreenPointF)¶
This method returns a extent that has been zoomed into a certain scale.
public static RectangleShape ZoomToScale(double targetScale, RectangleShape worldExtent, GeographyUnit worldExtentUnit, float screenWidth, float screenHeight, ScreenPointF offsetScreenPoint)
Parameters¶
targetScale Double
This parameter is the scale you want to zoom into.
worldExtent RectangleShape
This parameter is the world extent you want zoomed into the scale.
worldExtentUnit GeographyUnit
This parameter is the geographic unit of the world extent parameter.
screenWidth Single
This parameter is the screen width.
screenHeight Single
This parameter is the screen height.
offsetScreenPoint ScreenPointF
This parameter is the offsetScreenPoint.
Returns¶
RectangleShape
This method returns a extent that has been zoomed into a certain scale.
Remarks:
None
ToWorldCoordinate(PolygonShape, RectangleShape, Single, Single)¶
public static Feature ToWorldCoordinate(PolygonShape simplyPolygon, RectangleShape currentWorldExtent, float canvasWidth, float canvasHeight)
Parameters¶
simplyPolygon PolygonShape
currentWorldExtent RectangleShape
canvasWidth Single
canvasHeight Single
Returns¶
GetVersion()¶
Get the current ThinkGeo.Core.dll file version.
public static string GetVersion()
Returns¶
String
A string representing the file version of MapSuiteCore.dll.
BuildFourColorColumn(String, Collection<Feature>)¶
This method returns all features in the FeatureSource, the features contain the "Color" column. The column has a range of 1, 2, 3, 4, and each value represents a color.
public static Collection<Feature> BuildFourColorColumn(string columnName, Collection<Feature> features)
Parameters¶
columnName String
features Collection<Feature>
Returns¶
This method returns four color features in the FeatureSource.
isSameScale(Double, Double, Double)¶
public static bool isSameScale(double scale1, double scale2, double epsilon)
Parameters¶
scale1 Double
scale2 Double
epsilon Double
Returns¶
IsSameDouble(Double, Double, Double)¶
public static bool IsSameDouble(double double1, double double2, double epsilon)
Parameters¶
double1 Double
double2 Double
epsilon Double
Returns¶
IsSameExtent(RectangleShape, RectangleShape, Double)¶
public static bool IsSameExtent(RectangleShape extent1, RectangleShape extent2, double epsilon)
Parameters¶
extent1 RectangleShape
extent2 RectangleShape
epsilon Double
Returns¶
IsSamePoint(Vertex, Vertex, Double)¶
public static bool IsSamePoint(Vertex a, Vertex b, double epsilon)
Parameters¶
a Vertex
b Vertex
epsilon Double
Returns¶
IsSamePoint(PointShape, PointShape, Double)¶
public static bool IsSamePoint(PointShape a, PointShape b, double epsilon)
Parameters¶
epsilon Double