Skip to content

MapUtil

Namespace: ThinkGeo.Core

public static class MapUtil

Inheritance Object → MapUtil

Fields

StandardDpi

public static float StandardDpi;

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

GetScaleFromResolution(Double, GeographyUnit, Single)

public static double GetScaleFromResolution(double resolution, GeographyUnit unit, float dpi)

Parameters

resolution Double

unit GeographyUnit

dpi Single

Returns

Double

ConvertPointToPixel(Single)

internal static float ConvertPointToPixel(float point)

Parameters

point Single

Returns

Single

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

ValueTuple<Double, Double>

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

RingShape

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

PolygonShape

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

Double

OffsetPointWithScreenOffset(PointShape, Double, Double, Double, Double, GeographyUnit)

public static PointShape OffsetPointWithScreenOffset(PointShape pointShape, double xScreenOffset, double yScreenOffset, double mapRotation, double mapScale, GeographyUnit mapUnit)

Parameters

pointShape PointShape

xScreenOffset Double

yScreenOffset Double

mapRotation Double

mapScale Double

mapUnit GeographyUnit

Returns

PointShape

GetWorldExtent(GeographyUnit)

public static RectangleShape GetWorldExtent(GeographyUnit unit)

Parameters

unit GeographyUnit

Returns

RectangleShape

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

PointShape

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

RectangleShape

GetFloorCeilingScales(Double, ZoomLevelSet)

public static ValueTuple<double, double> GetFloorCeilingScales(double scale, ZoomLevelSet zoomLevelSet)

Parameters

scale Double

zoomLevelSet ZoomLevelSet

Returns

ValueTuple<Double, Double>

GetDegreeFromPanDirection(PanDirection)

public static double GetDegreeFromPanDirection(PanDirection panDirection)

Parameters

panDirection PanDirection

Returns

Double

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

Double

GetResolutionFromScale(Double, GeographyUnit, Single)

public static double GetResolutionFromScale(double scale, GeographyUnit unit, float dpi)

Parameters

scale Double

unit GeographyUnit

dpi Single

Returns

Double

GetResolution(RectangleShape, Double, Double)

public static double GetResolution(RectangleShape boundingBox, double widthInPixel, double heightInPixel)

Parameters

boundingBox RectangleShape

widthInPixel Double

heightInPixel Double

Returns

Double

GetScale(RectangleShape, Double, GeographyUnit, Single)

public static double GetScale(RectangleShape worldExtent, double screenWidth, GeographyUnit worldExtentUnit, float dpi)

Parameters

worldExtent RectangleShape

screenWidth Double

worldExtentUnit GeographyUnit

dpi Single

Returns

Double

GetScale(GeographyUnit, RectangleShape, Double, Double, Single)

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

Double

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

Double

GetSnappedScale(Double, ZoomLevelSet)

public static double GetSnappedScale(double scale, ZoomLevelSet zoomLevelSet)

Parameters

scale Double

zoomLevelSet ZoomLevelSet

Returns

Double

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

RectangleShape

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

RectangleShape

ToWorldCoordinate(RectangleShape, Double, Double, Double, Double)

public static PointShape ToWorldCoordinate(RectangleShape currentExtent, double screenX, double screenY, double screenWidth, double screenHeight)

Parameters

currentExtent RectangleShape

screenX Double

screenY Double

screenWidth Double

screenHeight Double

Returns

PointShape

GetDistance(PointShape, PointShape)

public static double GetDistance(PointShape fromPoint, PointShape toPoint)

Parameters

fromPoint PointShape

toPoint PointShape

Returns

Double

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

Int32

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

Int32

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, 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

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

ScreenPointF

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

ScreenPointF

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

PointShape

GetRotatedExtent(RectangleShape, Double, PointShape)

public static RectangleShape GetRotatedExtent(RectangleShape extent, double rotatedAngle, PointShape pivotPoint)

Parameters

extent RectangleShape

rotatedAngle Double

pivotPoint PointShape

Returns

RectangleShape

GetRotatedPolygon(RectangleShape, Double, PointShape)

public static AreaBaseShape GetRotatedPolygon(RectangleShape extent, double rotatedAngle, PointShape pivotPoint)

Parameters

extent RectangleShape

rotatedAngle Double

pivotPoint PointShape

Returns

AreaBaseShape

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

RectangleShape

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

RectangleShape

        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

RectangleShape

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

Double

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(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

RectangleShape

        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

RectangleShape

        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 afterwards.

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

Feature

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

Collection<Feature>

        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

Boolean

IsSameDouble(Double, Double, Double)

public static bool IsSameDouble(double double1, double double2, double epsilon)

Parameters

double1 Double

double2 Double

epsilon Double

Returns

Boolean

IsSameExtent(RectangleShape, RectangleShape, Double)

public static bool IsSameExtent(RectangleShape extent1, RectangleShape extent2, double epsilon)

Parameters

extent1 RectangleShape

extent2 RectangleShape

epsilon Double

Returns

Boolean

IsSamePoint(Vertex, Vertex, Double)

public static bool IsSamePoint(Vertex a, Vertex b, double epsilon)

Parameters

a Vertex

b Vertex

epsilon Double

Returns

Boolean

IsSamePoint(PointShape, PointShape, Double)

public static bool IsSamePoint(PointShape a, PointShape b, double epsilon)

Parameters

a PointShape

b PointShape

epsilon Double

Returns

Boolean

IsSamePoint(Vertex, PointShape, Double)

public static bool IsSamePoint(Vertex a, PointShape b, double epsilon)

Parameters

a Vertex

b PointShape

epsilon Double

Returns

Boolean

GetInchesPerDistanceUnit(DistanceUnit)

public static double GetInchesPerDistanceUnit(DistanceUnit targetUnit)

Parameters

targetUnit DistanceUnit

Returns

Double

GetInchesPerGeographyUnit(GeographyUnit)

public static double GetInchesPerGeographyUnit(GeographyUnit targetUnit)

Parameters

targetUnit GeographyUnit

Returns

Double

GetAreaUnitFromDistanceUnit(DistanceUnit)

public static AreaUnit GetAreaUnitFromDistanceUnit(DistanceUnit distanceUnit)

Parameters

distanceUnit DistanceUnit

Returns

AreaUnit

GetShortUnitString(DistanceUnit, Dictionary<String, String>)

public static string GetShortUnitString(DistanceUnit targetUnit, Dictionary<string, string> preferredDisplayUnitString)

Parameters

targetUnit DistanceUnit

preferredDisplayUnitString Dictionary<String, String>

Returns

String