C# Class csShared.Utils.CoordinateUtils

Afficher le fichier Open project: TNOCS/csTouch Class Usage Examples

Méthodes publiques

Свойство Type Description
MConvertLatLongStringToDouble System.Text.RegularExpressions.Regex

Méthodes publiques

Méthode 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

Méthode 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 méthode

public static Area ( List Points ) : double
Points List
Résultat double

AreaLatLon() public static méthode

public static AreaLatLon ( List Points ) : double
Points List
Résultat double

Bearing() public static méthode

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
Résultat double

CalculatePointSphere2D() public static méthode

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.
Résultat void

CheckCoordinate() public static méthode

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.
Résultat string

ConvertCoordinateFromXY() public static méthode

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.
Résultat BoundingBox

ConvertCoordinateFromXY() public static méthode

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.
Résultat SharpMap.Geometries.System.Windows.Point

ConvertCoordinateToXY() public static méthode

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.
Résultat BoundingBox

ConvertCoordinateToXY() public static méthode

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.
Résultat SharpMap.Geometries.System.Windows.Point

ConvertRDToLonLat() public static méthode

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
Résultat void

CoordinateToString() public static méthode

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.
Résultat void

DecimalDegreestoDegreeMinuteSecond() public static méthode

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.
Résultat string

Deg2Rad() public static méthode

public static Deg2Rad ( double pDegrees ) : double
pDegrees double
Résultat double

Distance() public static méthode

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.
Résultat double

Distance() public static méthode

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)).
Résultat double

FormattedCoordinateToDouble() public static méthode

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.
Résultat void

LatLon2Rd() public static méthode

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)
Résultat System.Windows.Point

LatLonDeg2Rd() public static méthode

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)
Résultat System.Windows.Point

LatLonDegreesToXYPoint() public static méthode

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.
Résultat System.Windows.Point

LatLonRadToXYPoint() public static méthode

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.
Résultat System.Windows.Point

LatitudeLongitudeDegreesFromLatitudeLongitudeString() public static méthode

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.
Résultat System.Windows.Point

LonLat2Rd() public static méthode

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.
Résultat void

RD2lat() public static méthode

public static RD2lat ( double b, double c ) : double
b double
c double
Résultat double

RD2lng() public static méthode

public static RD2lng ( double b, double c ) : double
b double
c double
Résultat double

Rad2Deg() public static méthode

public static Rad2Deg ( double pRadians ) : double
pRadians double
Résultat double

Rd2LonLat() public static méthode

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.
Résultat DataServer.Position

Rd2LonLat() public static méthode

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.
Résultat void

Rd2LonLat2() public static méthode

public static Rd2LonLat2 ( double pRdX, double pRdY, double &pLongitude, double &pLatitude ) : void
pRdX double
pRdY double
pLongitude double
pLatitude double
Résultat void

Rd2LonLatAsPoint() public static méthode

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.
Résultat System.Windows.Point

TransformCoordinates() public static méthode

public static TransformCoordinates ( List points, int sourceProjection, int destProjection ) : List
points List
sourceProjection int
destProjection int
Résultat List

TransformCoordinates() public static méthode

public static TransformCoordinates ( List points, string sourceProjection, string destProjection ) : List
points List
sourceProjection string
destProjection string
Résultat List

XYPointToLatLonDegrees() public static méthode

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.
Résultat void

XYPointToLatLonRad() public static méthode

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.
Résultat 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
Résultat System.Text.RegularExpressions.Regex