MapUtil¶
Namespace: ThinkGeo.Core
Represents the MapUtil class.
public static class MapUtil
Inheritance object → MapUtil
Fields¶
StandardDpi¶
Represents the StandardDpi constant.
public static float StandardDpi;
WmtsStandardDpi¶
Represents the WmtsStandardDpi constant.
public static double WmtsStandardDpi;
WmtsStandardPixelSizeInMillimeters¶
Represents the WmtsStandardPixelSizeInMillimeters constant.
public static double WmtsStandardPixelSizeInMillimeters;
InchesPerFeet¶
Represents the InchesPerFeet constant.
public static double InchesPerFeet;
InchesPerMeter¶
Represents the InchesPerMeter constant.
public static double InchesPerMeter;
InchesPerMile¶
Represents the InchesPerMile constant.
public static double InchesPerMile;
InchesPerYard¶
Represents the InchesPerYard constant.
public static double InchesPerYard;
InchesPerNauticalMile¶
Represents the InchesPerNauticalMile constant.
public static double InchesPerNauticalMile;
InchesPerDecimalDegree¶
Represents the InchesPerDecimalDegree constant.
public static double InchesPerDecimalDegree;
PointsPerInch¶
Represents the PointsPerInch constant.
public static float PointsPerInch;
Methods¶
GetResolutionFromScale(double, GeographyUnit, float)¶
Returns resolution from scale for the specified parameters.
public static double GetResolutionFromScale(double scale, GeographyUnit unit, float dpi)
Parameters¶
scale double
The scale factor to apply.
unit GeographyUnit
The unit.
dpi float
The DPI.
Returns¶
double
The result of the operation.
GetResolution(RectangleShape, double, double)¶
Returns resolution for the specified parameters.
public static double GetResolution(RectangleShape boundingBox, double widthInPixel, double heightInPixel)
Parameters¶
boundingBox RectangleShape
The bounding box used to constrain the query.
widthInPixel double
The width in pixel.
heightInPixel double
The height in pixel.
Returns¶
double
The result of the operation.
GetScale(RectangleShape, double, GeographyUnit, float)¶
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 float
Returns¶
GetScale(GeographyUnit, RectangleShape, double, double, float)¶
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 float
Returns¶
GetSnappedScale(RectangleShape, float, GeographyUnit, ZoomLevelSet)¶
Returns snapped scale for the specified parameters.
public static double GetSnappedScale(RectangleShape worldExtent, float screenWidth, GeographyUnit worldExtentUnit, ZoomLevelSet zoomLevelSet)
Parameters¶
worldExtent RectangleShape
The world extent represented by the canvas during the drawing session.
screenWidth float
The screen width.
worldExtentUnit GeographyUnit
The world extent unit.
zoomLevelSet ZoomLevelSet
The zoom level set.
Returns¶
double
The result of the operation.
GetSnappedScale(RectangleShape, float, GeographyUnit, Collection<double>)¶
Returns snapped scale for the specified parameters.
public static double GetSnappedScale(RectangleShape worldExtent, float screenWidth, GeographyUnit worldExtentUnit, Collection<double> zoomScales)
Parameters¶
worldExtent RectangleShape
The world extent represented by the canvas during the drawing session.
screenWidth float
The screen width.
worldExtentUnit GeographyUnit
The world extent unit.
zoomScales Collection<double>
The scale factor to apply.
Returns¶
double
The result of the operation.
GetSnappedScale(double, ZoomLevelSet)¶
Returns snapped scale for the specified parameters.
public static double GetSnappedScale(double scale, ZoomLevelSet zoomLevelSet)
Parameters¶
scale double
The scale factor to apply.
zoomLevelSet ZoomLevelSet
The zoom level set.
Returns¶
double
The result of the operation.
GetSnappedScale(double, Collection<double>)¶
Returns snapped scale for the specified parameters.
public static double GetSnappedScale(double scale, Collection<double> zoomScales)
Parameters¶
scale double
The scale factor to apply.
zoomScales Collection<double>
The scale factor to apply.
Returns¶
double
The result of the operation.
CalculateExtent(PointShape, double, GeographyUnit, double, double)¶
Performs calculate extent.
public static RectangleShape CalculateExtent(PointShape worldCenter, double scale, GeographyUnit mapUnit, double mapWidth, double mapHeight)
Parameters¶
worldCenter PointShape
The world center.
scale double
The scale factor to apply.
mapUnit GeographyUnit
The map unit used for the drawing session.
mapWidth double
The map width.
mapHeight double
The map height.
Returns¶
RectangleShape
The result of the operation.
AdjustExtentByRestrictions(RectangleShape, double, double, RectangleShape, double, double, GeographyUnit)¶
Performs adjust extent by restrictions.
public static RectangleShape AdjustExtentByRestrictions(RectangleShape targetExtent, double width, double height, RectangleShape restrictExtent, double maximumScale, double minimumScale, GeographyUnit mapUnit)
Parameters¶
targetExtent RectangleShape
The target extent.
width double
The width, in pixels.
height double
The height, in pixels.
restrictExtent RectangleShape
The restrict extent.
maximumScale double
The scale factor to apply.
minimumScale double
The scale factor to apply.
mapUnit GeographyUnit
The map unit used for the drawing session.
Returns¶
RectangleShape
The result of the operation.
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)¶
Returns distance for the specified parameters.
public static double GetDistance(PointShape fromPoint, PointShape toPoint)
Parameters¶
fromPoint PointShape
The from point.
toPoint PointShape
The to point.
Returns¶
double
The result of the operation.
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¶
int
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<int, int>
2 integers: the floor zoomlevel index, and the ceiling zoomlevel index
GetClosestZoomLevelIndex(double, ZoomLevelSet)¶
Returns closest zoom level index for the specified parameters.
public static int GetClosestZoomLevelIndex(double scale, ZoomLevelSet zoomLevelSet)
Parameters¶
scale double
The scale factor to apply.
zoomLevelSet ZoomLevelSet
The zoom level set.
Returns¶
int
The result of the operation.
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¶
int
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<int, int>
2 integers: the floor zoomlevel index, and the ceiling zoomlevel index
GetClosestZoomLevelIndex(double, Collection<double>)¶
Returns closest zoom level index for the specified parameters.
public static int GetClosestZoomLevelIndex(double scale, Collection<double> zoomLevelScales)
Parameters¶
scale double
The scale factor to apply.
zoomLevelScales Collection<double>
The scale factor to apply.
Returns¶
int
The result of the operation.
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¶
int
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¶
int
The closest zoomlevel index
GetSnappedZoomLevelIndex(double, Collection<double>)¶
Returns snapped zoom level index for the specified parameters.
public static int GetSnappedZoomLevelIndex(double scale, Collection<double> zoomScales)
Parameters¶
scale double
The scale factor to apply.
zoomScales Collection<double>
The scale factor to apply.
Returns¶
int
The result of the operation.
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¶
int
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). 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. Given a of two entries: Index 0: 2000Index 1: 1000 - If scale is 3000, the method returns 0 (clamped to the coarsest level). - If scale is 300, the method returns 1 (clamped to the finest level). - If scale is 1500, the method returns 0.5 (halfway between levels 0 and 1).
Returns¶
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). A map scale as a corresponding to the given zoom index. Returns double.NaN if is null or empty.
Returns¶
GetRotatedScreenPoint(double, double, double, ScreenPointF)¶
Returns rotated screen point for the specified parameters.
public static ScreenPointF GetRotatedScreenPoint(double x, double y, double rotatedAngle, ScreenPointF pivotPoint)
Parameters¶
x double
The x-coordinate, in pixels.
y double
The y-coordinate, in pixels.
rotatedAngle double
The rotated angle.
pivotPoint ScreenPointF
The pivot point.
Returns¶
ScreenPointF
The result of the operation.
GetRotatedScreenPoint(double, double, double, ScreenPointD)¶
Returns rotated screen point for the specified parameters.
public static ScreenPointF GetRotatedScreenPoint(double x, double y, double rotatedAngle, ScreenPointD pivotPoint)
Parameters¶
x double
The x-coordinate, in pixels.
y double
The y-coordinate, in pixels.
rotatedAngle double
The rotated angle.
pivotPoint ScreenPointD
The pivot point.
Returns¶
ScreenPointF
The result of the operation.
GetRotatedPoint(double, double, double, PointShape)¶
Returns rotated point for the specified parameters.
public static PointShape GetRotatedPoint(double x, double y, double rotatedAngle, PointShape pivotPoint)
Parameters¶
x double
The x-coordinate, in pixels.
y double
The y-coordinate, in pixels.
rotatedAngle double
The rotated angle.
pivotPoint PointShape
The pivot point.
Returns¶
PointShape
The result of the operation.
GetRotatedExtent(RectangleShape, double, PointShape)¶
Returns rotated extent for the specified parameters.
public static RectangleShape GetRotatedExtent(RectangleShape extent, double rotatedAngle, PointShape pivotPoint)
Parameters¶
extent RectangleShape
The world extent represented by the canvas during the drawing session.
rotatedAngle double
The rotated angle.
pivotPoint PointShape
The pivot point.
Returns¶
RectangleShape
The result of the operation.
GetRotatedPolygon(RectangleShape, double, PointShape)¶
Returns rotated polygon for the specified parameters.
public static AreaBaseShape GetRotatedPolygon(RectangleShape extent, double rotatedAngle, PointShape pivotPoint)
Parameters¶
extent RectangleShape
The world extent represented by the canvas during the drawing session.
rotatedAngle double
The rotated angle.
pivotPoint PointShape
The pivot point.
Returns¶
AreaBaseShape
The result of the operation.
ApplyDrawingMarginToExtent(RectangleShape, float, float, float)¶
Performs apply drawing margin to extent.
public static RectangleShape ApplyDrawingMarginToExtent(RectangleShape worldExtent, float marginInPixel, float screenWidth, float screenHeight)
Parameters¶
worldExtent RectangleShape
The world extent represented by the canvas during the drawing session.
marginInPixel float
The margin in pixel.
screenWidth float
The screen width.
screenHeight float
The screen height.
Returns¶
RectangleShape
The result of the operation.
ApplyDrawingMarginToExtent(RectangleShape, float, double)¶
Performs apply drawing margin to extent.
public static RectangleShape ApplyDrawingMarginToExtent(RectangleShape worldExtent, float marginInPixel, double resolution)
Parameters¶
worldExtent RectangleShape
The world extent represented by the canvas during the drawing session.
marginInPixel float
The margin in pixel.
resolution double
The resolution.
Returns¶
RectangleShape
The result of the operation.
CenterAt(RectangleShape, PointShape, float, float)¶
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 float
This parameter is the width of the screen.
screenHeight float
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, float, float)¶
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 float
This parameter is the width of the screen.
screenHeight float
This parameter is the height of the screen.
Returns¶
RectangleShape
This method returns an adjusted extent centered on a point.
Remarks:
None
CenterAt(RectangleShape, float, float, float, float)¶
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 float
This parameter is the X coordinate on the screen to center on.
screenY float
This parameter is the Y coordinate on the screen to center on.
screenWidth float
This parameter is the width of the screen.
screenHeight float
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¶
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, float, float)¶
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 float
This parameter is the width of the screen.
screenHeight float
This parameter is the height of the screen.
Returns¶
float
This method returns the number of pixels between two world points.
Remarks:
None
GetScreenDistanceBetweenTwoWorldPoints(RectangleShape, Feature, Feature, float, float)¶
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 float
This parameter is the width of the screen.
screenHeight float
This parameter is the height of the screen.
Returns¶
float
This method returns the number of pixels between two features.
Remarks:
None
GetSnappedExtent(RectangleShape, GeographyUnit, float, float, ZoomLevelSet)¶
Returns snapped extent for the specified parameters.
public static RectangleShape GetSnappedExtent(RectangleShape worldExtent, GeographyUnit worldExtentUnit, float screenWidth, float screenHeight, ZoomLevelSet zoomLevelSet)
Parameters¶
worldExtent RectangleShape
The world extent represented by the canvas during the drawing session.
worldExtentUnit GeographyUnit
The world extent unit.
screenWidth float
The screen width.
screenHeight float
The screen height.
zoomLevelSet ZoomLevelSet
The zoom level set.
Returns¶
RectangleShape
The result of the operation.
GetWorldDistanceBetweenTwoScreenPoints(RectangleShape, ScreenPointF, ScreenPointF, float, float, 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 float
This parameter is the width of the screen.
screenHeight float
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, float, float, float, float, float, float, 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 float
This parameter is the X of the point you want to measure from.
screenPoint1Y float
This parameter is the Y of the point you want to measure from.
screenPoint2X float
This parameter is the X of the point you want to measure to.
screenPoint2Y float
This parameter is the Y of the point you want to measure to.
screenWidth float
This parameter is the width of the screen.
screenHeight float
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, int)¶
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 int
This parameter is the percentage by which you want to pan.
Returns¶
RectangleShape
This method returns a panned extent.
Remarks:
None
Pan(RectangleShape, float, int)¶
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 float
This parameter is the degree you want to pan.
percentage int
This parameter is the percentage by which you want to pan.
Returns¶
RectangleShape
This method returns a panned extent.
Remarks:
None
ToScreenCoordinate(BaseShape, RectangleShape, float, float)¶
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 float
This parameter is the width of the screen.
screenHeight float
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, float, float)¶
Converts this instance to a BaseShape.
public static BaseShape ToScreenCoordinate(Feature feature, RectangleShape worldExtent, float screenWidth, float screenHeight)
Parameters¶
feature Feature
The feature.
worldExtent RectangleShape
The world extent represented by the canvas during the drawing session.
screenWidth float
The screen width.
screenHeight float
The screen height.
Returns¶
BaseShape
The result of the operation.
ToScreenCoordinate(Byte[], WellKnownType, RectangleShape, float, float)¶
Converts this instance to a BaseShape.
public static BaseShape ToScreenCoordinate(Byte[] wellKnownBinary, WellKnownType shapeType, RectangleShape worldExtent, float screenWidth, float screenHeight)
Parameters¶
wellKnownBinary Byte[]
The well known binary.
shapeType WellKnownType
The shape type.
worldExtent RectangleShape
The world extent represented by the canvas during the drawing session.
screenWidth float
The screen width.
screenHeight float
The screen height.
Returns¶
BaseShape
The result of the operation.
ToScreenCoordinate(RectangleShape, RectangleShape, float, float)¶
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 float
This parameter is the width of the screen.
screenHeight float
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, float, float)¶
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 float
This parameter is the width of the screen.
screenHeight float
This parameter is the height of the screen.
Returns¶
ScreenPointF
This method returns screen coordinates from world coordinates.
Remarks:
None
ToScreenCoordinate(RectangleShape, Feature, float, float)¶
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 float
This parameter is the width of the screen.
screenHeight float
This parameter is the height of the screen.
Returns¶
ScreenPointF
This method returns screen coordinates from world coordinates.
Remarks:
None
ToWorldCoordinate(RectangleShape, float, float, float, float)¶
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 float
This parameter is the X of the point you want converted to world coordinates.
screenY float
This parameter is the Y of the point you want converted to world
screenWidth float
This parameter is the width of the screen.
screenHeight float
This parameter is the height of the screen.
Returns¶
PointShape
This method returns world coordinates from screen coordinates.
Remarks:
None
ToWorldCoordinate(RectangleShape, ScreenPointF, float, float)¶
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 float
This parameter is the width of the screen.
screenHeight float
This parameter is the height of the screen.
Returns¶
PointShape
This method returns world coordinates from screen coordinates.
Remarks:
None
ZoomIn(RectangleShape, int)¶
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 int
This parameter is the percentage by which you want to zoom in.
Returns¶
Remarks:
None
ZoomIntoCenter(RectangleShape, int, PointShape, float, float)¶
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 int
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 float
This parameter is the width in screen coordinates.
screenHeight float
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, int, Feature, float, float)¶
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 int
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 float
This parameter is the width in screen coordinates.
screenHeight float
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, int, float, float, float, float)¶
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 int
This parameter is the percentage by which you want to zoom in.
screenX float
This parameter is the screen X you want to center on.
screenY float
This parameter is the screen Y you want to center on.
screenWidth float
This parameter is the width of the screen.
screenHeight float
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, int)¶
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 int
This parameter is the percentage by which you want to zoom out.
Returns¶
Remarks:
None
ZoomOutToCenter(RectangleShape, int, PointShape, float, float)¶
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 int
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 float
This parameter is the width of the screen.
screenHeight float
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, int, Feature, float, float)¶
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 int
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 float
This parameter is the width of the screen.
screenHeight float
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, int, float, float, float, float)¶
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 int
This parameter is the percentage by which you want to zoom out.
screenX float
This parameter is the screen X you want to center on.
screenY float
This parameter is the screen Y you want to center on.
screenWidth float
This parameter is the width of the screen.
screenHeight float
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, float, float, 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 float
This parameter is the screen width.
screenHeight float
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, float, float)¶
Converts this instance to a Feature.
public static Feature ToWorldCoordinate(PolygonShape simplyPolygon, RectangleShape currentWorldExtent, float canvasWidth, float canvasHeight)
Parameters¶
simplyPolygon PolygonShape
The simply polygon.
currentWorldExtent RectangleShape
The current world extent.
canvasWidth float
The canvas width.
canvasHeight float
The canvas height.
Returns¶
Feature
The result of the operation.
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)¶
Performs is same scale.
public static bool isSameScale(double scale1, double scale2, double epsilon)
Parameters¶
scale1 double
The scale factor to apply.
scale2 double
The scale factor to apply.
epsilon double
The epsilon.
Returns¶
bool
True if the condition is met; otherwise, false.
IsSameDouble(double, double, double)¶
Performs is same double.
public static bool IsSameDouble(double double1, double double2, double epsilon)
Parameters¶
double1 double
The double 1.
double2 double
The double 2.
epsilon double
The epsilon.
Returns¶
bool
True if the condition is met; otherwise, false.
IsSameExtent(RectangleShape, RectangleShape, double)¶
Performs is same extent.
public static bool IsSameExtent(RectangleShape extent1, RectangleShape extent2, double epsilon)
Parameters¶
extent1 RectangleShape
The extent 1.
extent2 RectangleShape
The extent 2.
epsilon double
The epsilon.
Returns¶
bool
True if the condition is met; otherwise, false.
IsSamePoint(Vertex, Vertex, double)¶
Performs is same point.
public static bool IsSamePoint(Vertex a, Vertex b, double epsilon)
Parameters¶
a Vertex
The a.
b Vertex
The b.
epsilon double
The epsilon.
Returns¶
bool
True if the condition is met; otherwise, false.
IsSamePoint(PointShape, PointShape, double)¶
Performs is same point.
public static bool IsSamePoint(PointShape a, PointShape b, double epsilon)
Parameters¶
a PointShape
The a.
b PointShape
The b.
epsilon double
The epsilon.
Returns¶
bool
True if the condition is met; otherwise, false.
IsSamePoint(Vertex, PointShape, double)¶
Performs is same point.
public static bool IsSamePoint(Vertex a, PointShape b, double epsilon)
Parameters¶
a Vertex
The a.
b PointShape
The b.
epsilon double
The epsilon.
Returns¶
bool
True if the condition is met; otherwise, false.
GetInchesPerDistanceUnit(DistanceUnit)¶
Returns inches per distance unit for .
public static double GetInchesPerDistanceUnit(DistanceUnit targetUnit)
Parameters¶
targetUnit DistanceUnit
The target unit.
Returns¶
double
The result of the operation.
GetInchesPerGeographyUnit(GeographyUnit)¶
Returns inches per geography unit for .
public static double GetInchesPerGeographyUnit(GeographyUnit targetUnit)
Parameters¶
targetUnit GeographyUnit
The target unit.
Returns¶
double
The result of the operation.
GetAreaUnitFromDistanceUnit(DistanceUnit)¶
Returns area unit from distance unit for .
public static AreaUnit GetAreaUnitFromDistanceUnit(DistanceUnit distanceUnit)
Parameters¶
distanceUnit DistanceUnit
The distance unit.
Returns¶
AreaUnit
The result of the operation.
GetShortUnitString(DistanceUnit, Dictionary<string, string>)¶
Returns short unit string for the specified parameters.
public static string GetShortUnitString(DistanceUnit targetUnit, Dictionary<string, string> preferredDisplayUnitString)
Parameters¶
targetUnit DistanceUnit
The target unit.
preferredDisplayUnitString Dictionary<string, string>
The preferred display unit string.
Returns¶
string
A string result.
GetScaleFromResolution(double, GeographyUnit, float)¶
Returns scale from resolution for the specified parameters.
public static double GetScaleFromResolution(double resolution, GeographyUnit unit, float dpi)
Parameters¶
resolution double
The resolution.
unit GeographyUnit
The unit.
dpi float
The DPI.
Returns¶
double
The result of the operation.
6R0=(float)¶
internal static float 6R0=(float point)
Parameters¶
point float
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)¶
Rotates a point around a pivot by the specified angle.
public static ValueTuple<double, double> RotatePoint(double x, double y, double rotationAngle, double pivotX, double pivotY)
Parameters¶
x double
The x-coordinate of the point to rotate.
y double
The y-coordinate of the point to rotate.
rotationAngle double
The rotation angle, in degrees.
pivotX double
The x-coordinate of the pivot point.
pivotY double
The y-coordinate of the pivot point.
Returns¶
RotateRingShape(RingShape, double, double, double)¶
Performs rotate ring shape.
public static RingShape RotateRingShape(RingShape ringShape, double rotationAngle, double pivotX, double pivotY)
Parameters¶
ringShape RingShape
The ring shape.
rotationAngle double
The rotation angle.
pivotX double
The pivot x.
pivotY double
The pivot y.
Returns¶
RingShape
The result of the operation.
RotatePolygonShape(PolygonShape, double, double, double)¶
Performs rotate polygon shape.
public static PolygonShape RotatePolygonShape(PolygonShape polygonShape, double rotationAngle, double pivotX, double pivotY)
Parameters¶
polygonShape PolygonShape
The polygon shape.
rotationAngle double
The rotation angle.
pivotX double
The pivot x.
pivotY double
The pivot y.
Returns¶
PolygonShape
The result of the operation.
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)¶
Returns rotated canvas radius for the specified parameters.
public static double GetRotatedCanvasRadius(double pivotX, double pivotY, double canvasWidth, double canvasHeight)
Parameters¶
pivotX double
The pivot x.
pivotY double
The pivot y.
canvasWidth double
The canvas width.
canvasHeight double
The canvas height.
Returns¶
double
The result of the operation.
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)¶
Returns world extent for .
public static RectangleShape GetWorldExtent(GeographyUnit unit)
Parameters¶
unit GeographyUnit
The unit.
Returns¶
RectangleShape
The result of the operation.
ToWorldCoordinate(double, double, PointShape, double, double, double, GeographyUnit, double)¶
Converts this instance to a PointShape.
public static PointShape ToWorldCoordinate(double screenX, double screenY, PointShape centerPoint, double centerScreenX, double centerScreenY, double scale, GeographyUnit mapUnit, double mapRotation)
Parameters¶
screenX double
The screen x.
screenY double
The screen y.
centerPoint PointShape
The center point.
centerScreenX double
The center screen x.
centerScreenY double
The center screen y.
scale double
The scale factor to apply.
mapUnit GeographyUnit
The map unit used for the drawing session.
mapRotation double
The map rotation.
Returns¶
PointShape
The result of the operation.
GetExtentFromCenterPoint(PointShape, double, double, double, GeographyUnit)¶
Returns extent from center point for the specified parameters.
public static RectangleShape GetExtentFromCenterPoint(PointShape centerPoint, double canvasWidth, double canvasHeight, double scale, GeographyUnit mapUnit)
Parameters¶
centerPoint PointShape
The center point.
canvasWidth double
The canvas width.
canvasHeight double
The canvas height.
scale double
The scale factor to apply.
mapUnit GeographyUnit
The map unit used for the drawing session.
Returns¶
RectangleShape
The result of the operation.
GetFloorCeilingScales(double, ZoomLevelSet)¶
Returns the floor and ceiling scales for the specified zoom level set.
public static ValueTuple<double, double> GetFloorCeilingScales(double scale, ZoomLevelSet zoomLevelSet)
Parameters¶
scale double
The scale to evaluate.
zoomLevelSet ZoomLevelSet
The zoom level set.
Returns¶
GetDegreeFromPanDirection(PanDirection)¶
Returns degree from pan direction for .
public static double GetDegreeFromPanDirection(PanDirection panDirection)
Parameters¶
panDirection PanDirection
The rectangle that defines the area of interest.
Returns¶
double
The result of the operation.
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¶
int
return (int)Math.Round(value)