C# Class csShared.Utils.CoordinateUtils

显示文件 Open project: TNOCS/csTouch Class Usage Examples

Public Properties

Property Type Description
MConvertLatLongStringToDouble System.Text.RegularExpressions.Regex

Public Methods

Method Description
Area ( List Points ) : double
AreaLatLon ( List Points ) : double
Bearing ( double pLat1, double pLon1, double pLat2, double pLon2 ) : double

Calculates the bearing in degrees for the line from point 1 (lat1, lon1) to point 2 (lat2, lon2).

CalculatePointSphere2D ( double pLatitudeDeg, double pLongitudeDeg, double pDistance, double pAngleDeg, double &pNewLatitudeDegrees, double &pNewLongitudeDegrees ) : void

Translates a position, spherical implementation The position in translated in the azimuth direction of the angle x, y and by a distance of sqrt(x^2, Y^2).

CheckCoordinate ( CoordinateType pCoordinateType, CoordinateDirection pCoordinateDirection, string pValue ) : string

Checks the range of the coordinate and returns the error message if not OK.

ConvertCoordinateFromXY ( BoundingBox box, CoordinateType coordinateType ) : BoundingBox

Converts the coordinate from raw (map) format to the selected coordinate unit.

ConvertCoordinateFromXY ( SharpMap point, CoordinateType coordinateType ) : SharpMap.Geometries.System.Windows.Point

Converts the coordinate from raw (map) format to the selected coordinate unit.

ConvertCoordinateToXY ( BoundingBox box, CoordinateType coordinateType ) : BoundingBox

Converts the coordinate from the selected coordinate unit to raw (map) format.

ConvertCoordinateToXY ( SharpMap point, CoordinateType coordinateType ) : SharpMap.Geometries.System.Windows.Point

Converts the coordinate from the selected coordinate unit to raw (map) format.

ConvertRDToLonLat ( double x, double y, double &longitude, double &latitude ) : void

Convert RD (rijksdriehoek) to WGS84.

CoordinateToString ( CoordinateType pCoordinateType, double pLatitude, double pLongitude, string &pWestEastValue, string &pNorthSouthValue ) : void

Formats the coordinate according to current setting.

DecimalDegreestoDegreeMinuteSecond ( double pCoordinate, CoordinateDirection pCoordinateDirection ) : string

Convert decimal degrees (DD) to degree, minute, second (DMS) notation.

Deg2Rad ( double pDegrees ) : double
Distance ( System.Windows.Point pPoint1, System.Windows.Point pPoint2 ) : double

Calculates the distance between the specified point1 and point2.

Distance ( double pLat1, double pLon1, double pLat2, double pLon2, char pUnit = 'K' ) : double

Calculates the distance between the specified point1 (lat1, lon1) and point2 (lat2, lon2).

FormattedCoordinateToDouble ( CoordinateType pCoordinateType, string pWestEastValue, string pNorthSouthValue, double &pLatitude, double &pLongitude ) : void

Retrieves latitude and longitude in degrees from the string values presented in the given coordinate type.

LatLon2Rd ( System.Windows.Point pLatLon ) : System.Windows.Point

Convert a lat/lon point to a RD point.

LatLonDeg2Rd ( System.Windows.Point pLatLon ) : System.Windows.Point

Convert a lat/lon point to a RD point.

LatLonDegreesToXYPoint ( double pLatitude, double pLongitude ) : System.Windows.Point

Converts the latitude longitude in degrees to XY point.

LatLonRadToXYPoint ( double pLatitude, double pLongitude ) : System.Windows.Point

Converts the latitude and longitude in radians to XYPoint.

LatitudeLongitudeDegreesFromLatitudeLongitudeString ( string pLatitude, string pLongitude ) : System.Windows.Point

Gets the latitude and the longitude in degrees from a latitude longitude string.

LonLat2Rd ( double pLongitude, double pLatitude, double &pRdX, double &pRdY ) : void

Convert longitude/latitude to 'Rijksdriehoek' coordinates.

RD2lat ( double b, double c ) : double
RD2lng ( double b, double c ) : double
Rad2Deg ( double pRadians ) : double
Rd2LonLat ( double pRdX, double pRdY ) : Position

Convert 'Rijksdriehoek' coordinates to longitude/latitude in degrees.

Rd2LonLat ( double pRdX, double pRdY, double &pLongitude, double &pLatitude ) : void

Convert 'Rijksdriehoek' coordinates to longitude/latitude in degrees.

Rd2LonLat2 ( double pRdX, double pRdY, double &pLongitude, double &pLatitude ) : void
Rd2LonLatAsPoint ( double pRdX, double pRdY ) : System.Windows.Point

Convert 'Rijksdriehoek' coordinates to longitude/latitude in degrees.

TransformCoordinates ( List points, int sourceProjection, int destProjection ) : List
TransformCoordinates ( List points, string sourceProjection, string destProjection ) : List
XYPointToLatLonDegrees ( double pX, double pY, double &pLatitude, double &pLongitude ) : void

Converts the XYPoint to latitude longitude in degrees.

XYPointToLatLonRad ( double pX, double pY, double &pLatitude, double &pLongitude ) : void

Converts the XYPoint to latitude longitude in radians.

Private Methods

Method Description
GetCoordinateDegreesFromDegreeMinuteSecond ( string pValue ) : double

Gets the coordinate degrees from degree minute second.

pj_free ( IntPtr pointer ) : void
pj_init_plus ( string init ) : IntPtr
pj_is_latlong ( IntPtr coordPointer ) : int
pj_transform ( IntPtr srcPrj, IntPtr destPrj, int nPoints, int offset, double &x, double &y, double &z ) : int

Method Details

Area() public static method

public static Area ( List Points ) : double
Points List
return double

AreaLatLon() public static method

public static AreaLatLon ( List Points ) : double
Points List
return double

Bearing() public static method

Calculates the bearing in degrees for the line from point 1 (lat1, lon1) to point 2 (lat2, lon2).
public static Bearing ( double pLat1, double pLon1, double pLat2, double pLon2 ) : double
pLat1 double
pLon1 double
pLat2 double
pLon2 double
return double

CalculatePointSphere2D() public static method

Translates a position, spherical implementation The position in translated in the azimuth direction of the angle x, y and by a distance of sqrt(x^2, Y^2).
public static CalculatePointSphere2D ( double pLatitudeDeg, double pLongitudeDeg, double pDistance, double pAngleDeg, double &pNewLatitudeDegrees, double &pNewLongitudeDegrees ) : void
pLatitudeDeg double Latitude of start coordinate in degrees.
pLongitudeDeg double Longitude of start coordinate in degrees.
pDistance double The distance to move in meters.
pAngleDeg double The angle to move under in degrees.
pNewLatitudeDegrees double The p new latitude degrees.
pNewLongitudeDegrees double The p new longitude degrees.
return void

CheckCoordinate() public static method

Checks the range of the coordinate and returns the error message if not OK.
public static CheckCoordinate ( CoordinateType pCoordinateType, CoordinateDirection pCoordinateDirection, string pValue ) : string
pCoordinateType CoordinateType Type of the coordinate.
pCoordinateDirection CoordinateDirection The coordinate direction.
pValue string The value.
return string

ConvertCoordinateFromXY() public static method

Converts the coordinate from raw (map) format to the selected coordinate unit.
public static ConvertCoordinateFromXY ( BoundingBox box, CoordinateType coordinateType ) : BoundingBox
box BoundingBox The box.
coordinateType CoordinateType Type of the coordinate.
return BoundingBox

ConvertCoordinateFromXY() public static method

Converts the coordinate from raw (map) format to the selected coordinate unit.
public static ConvertCoordinateFromXY ( SharpMap point, CoordinateType coordinateType ) : SharpMap.Geometries.System.Windows.Point
point SharpMap The point.
coordinateType CoordinateType Type of the coordinate.
return SharpMap.Geometries.System.Windows.Point

ConvertCoordinateToXY() public static method

Converts the coordinate from the selected coordinate unit to raw (map) format.
public static ConvertCoordinateToXY ( BoundingBox box, CoordinateType coordinateType ) : BoundingBox
box BoundingBox The box.
coordinateType CoordinateType Type of the coordinate.
return BoundingBox

ConvertCoordinateToXY() public static method

Converts the coordinate from the selected coordinate unit to raw (map) format.
public static ConvertCoordinateToXY ( SharpMap point, CoordinateType coordinateType ) : SharpMap.Geometries.System.Windows.Point
point SharpMap The point.
coordinateType CoordinateType Type of the coordinate.
return SharpMap.Geometries.System.Windows.Point

ConvertRDToLonLat() public static method

Convert RD (rijksdriehoek) to WGS84.
public static ConvertRDToLonLat ( double x, double y, double &longitude, double &latitude ) : void
x double X in RD
y double Y in RD
longitude double Longitude in WGS84
latitude double Latitude in WGS84
return void

CoordinateToString() public static method

Formats the coordinate according to current setting.
public static CoordinateToString ( CoordinateType pCoordinateType, double pLatitude, double pLongitude, string &pWestEastValue, string &pNorthSouthValue ) : void
pCoordinateType CoordinateType Type of the coordinate.
pLatitude double The latitude in degrees.
pLongitude double The longitude in degrees.
pWestEastValue string The west east value in the specified format.
pNorthSouthValue string The north south value in the specified format.
return void

DecimalDegreestoDegreeMinuteSecond() public static method

Convert decimal degrees (DD) to degree, minute, second (DMS) notation.
public static DecimalDegreestoDegreeMinuteSecond ( double pCoordinate, CoordinateDirection pCoordinateDirection ) : string
pCoordinate double The Coordinate.
pCoordinateDirection CoordinateDirection The direction.
return string

Deg2Rad() public static method

public static Deg2Rad ( double pDegrees ) : double
pDegrees double
return double

Distance() public static method

Calculates the distance between the specified point1 and point2.
public static Distance ( System.Windows.Point pPoint1, System.Windows.Point pPoint2 ) : double
pPoint1 System.Windows.Point The point1.
pPoint2 System.Windows.Point The point2.
return double

Distance() public static method

Calculates the distance between the specified point1 (lat1, lon1) and point2 (lat2, lon2).
public static Distance ( double pLat1, double pLon1, double pLat2, double pLon2, char pUnit = 'K' ) : double
pLat1 double The lat1.
pLon1 double The lon1.
pLat2 double The lat2.
pLon2 double The lon2.
pUnit char The unit (K for kilometers (default), N for nautical miles, or M for miles (default)).
return double

FormattedCoordinateToDouble() public static method

Retrieves latitude and longitude in degrees from the string values presented in the given coordinate type.
public static FormattedCoordinateToDouble ( CoordinateType pCoordinateType, string pWestEastValue, string pNorthSouthValue, double &pLatitude, double &pLongitude ) : void
pCoordinateType CoordinateType Type of the coordinate.
pWestEastValue string The west east value.
pNorthSouthValue string The north south value.
pLatitude double The latitude in degrees.
pLongitude double The longitude in degrees.
return void

LatLon2Rd() public static method

Convert a lat/lon point to a RD point.
public static LatLon2Rd ( System.Windows.Point pLatLon ) : System.Windows.Point
pLatLon System.Windows.Point The lat lon point. (x=latitude, y=longitude and in radian)
return System.Windows.Point

LatLonDeg2Rd() public static method

Convert a lat/lon point to a RD point.
public static LatLonDeg2Rd ( System.Windows.Point pLatLon ) : System.Windows.Point
pLatLon System.Windows.Point The lat lon point. (x=latitude, y=longitude and in degrees)
return System.Windows.Point

LatLonDegreesToXYPoint() public static method

Converts the latitude longitude in degrees to XY point.
public static LatLonDegreesToXYPoint ( double pLatitude, double pLongitude ) : System.Windows.Point
pLatitude double The p lat.
pLongitude double The p lon.
return System.Windows.Point

LatLonRadToXYPoint() public static method

Converts the latitude and longitude in radians to XYPoint.
public static LatLonRadToXYPoint ( double pLatitude, double pLongitude ) : System.Windows.Point
pLatitude double The lat.
pLongitude double The lon.
return System.Windows.Point

LatitudeLongitudeDegreesFromLatitudeLongitudeString() public static method

Gets the latitude and the longitude in degrees from a latitude longitude string.
public static LatitudeLongitudeDegreesFromLatitudeLongitudeString ( string pLatitude, string pLongitude ) : System.Windows.Point
pLatitude string The latitude string.
pLongitude string The longitude string.
return System.Windows.Point

LonLat2Rd() public static method

Convert longitude/latitude to 'Rijksdriehoek' coordinates.
public static LonLat2Rd ( double pLongitude, double pLatitude, double &pRdX, double &pRdY ) : void
pLongitude double The longitude in degrees.
pLatitude double The latitude in degrees.
pRdX double The resulting 'Rijksdriehoek' X.
pRdY double The resulting 'Rijksdriehoek' Y.
return void

RD2lat() public static method

public static RD2lat ( double b, double c ) : double
b double
c double
return double

RD2lng() public static method

public static RD2lng ( double b, double c ) : double
b double
c double
return double

Rad2Deg() public static method

public static Rad2Deg ( double pRadians ) : double
pRadians double
return double

Rd2LonLat() public static method

Convert 'Rijksdriehoek' coordinates to longitude/latitude in degrees.
public static Rd2LonLat ( double pRdX, double pRdY ) : Position
pRdX double The 'Rijksdriehoek' X.
pRdY double The 'Rijksdriehoek' Y.
return DataServer.Position

Rd2LonLat() public static method

Convert 'Rijksdriehoek' coordinates to longitude/latitude in degrees.
public static Rd2LonLat ( double pRdX, double pRdY, double &pLongitude, double &pLatitude ) : void
pRdX double The 'Rijksdriehoek' X.
pRdY double The 'Rijksdriehoek' Y.
pLongitude double The resulting longitude in degrees.
pLatitude double The resulting latitude in degrees.
return void

Rd2LonLat2() public static method

public static Rd2LonLat2 ( double pRdX, double pRdY, double &pLongitude, double &pLatitude ) : void
pRdX double
pRdY double
pLongitude double
pLatitude double
return void

Rd2LonLatAsPoint() public static method

Convert 'Rijksdriehoek' coordinates to longitude/latitude in degrees.
public static Rd2LonLatAsPoint ( double pRdX, double pRdY ) : System.Windows.Point
pRdX double The 'Rijksdriehoek' X.
pRdY double The 'Rijksdriehoek' Y.
return System.Windows.Point

TransformCoordinates() public static method

public static TransformCoordinates ( List points, int sourceProjection, int destProjection ) : List
points List
sourceProjection int
destProjection int
return List

TransformCoordinates() public static method

public static TransformCoordinates ( List points, string sourceProjection, string destProjection ) : List
points List
sourceProjection string
destProjection string
return List

XYPointToLatLonDegrees() public static method

Converts the XYPoint to latitude longitude in degrees.
public static XYPointToLatLonDegrees ( double pX, double pY, double &pLatitude, double &pLongitude ) : void
pX double The X.
pY double The Y.
pLatitude double The resulting latitude in degrees.
pLongitude double The resulting longitude in degrees.
return void

XYPointToLatLonRad() public static method

Converts the XYPoint to latitude longitude in radians.
public static XYPointToLatLonRad ( double pX, double pY, double &pLatitude, double &pLongitude ) : void
pX double The X.
pY double The Y.
pLatitude double The resulting latitude.
pLongitude double The resulting longitude.
return void

Property Details

MConvertLatLongStringToDouble public_oe static_oe property

Convert a string such as 039°32'09,90 to a double A description of the regular expression: 0, zero or one repetitions [Degrees]: A named capture group. [\d{1,3}] Any digit, between 1 and 3 repetitions °0? °0, zero or one repetitions [Minutes]: A named capture group. [\d{1,2}] Any digit, between 1 and 2 repetitions '0? '0, zero or one repetitions [Seconds]: A named capture group. [\d{1,2}[.,]?\d*] \d{1,2}[.,]?\d* Any digit, between 1 and 2 repetitions Any character in this class: [.,], zero or one repetitions Any digit, any number of repetitions
public static Regex,System.Text.RegularExpressions MConvertLatLongStringToDouble
return System.Text.RegularExpressions.Regex