00001 #pragma once 00002 /** 00003 * \file NETGeographicLib/GeodesicLineExact.h 00004 * \brief Header for NETGeographicLib::GeodesicLineExact class 00005 * 00006 * NETGeographicLib is copyright (c) Scott Heiman (2013) 00007 * GeographicLib is Copyright (c) Charles Karney (2010-2012) 00008 * <charles@karney.com> and licensed under the MIT/X11 License. 00009 * For more information, see 00010 * http://geographiclib.sourceforge.net/ 00011 **********************************************************************/ 00012 #include "NETGeographicLib.h" 00013 00014 namespace NETGeographicLib 00015 { 00016 ref class GeodesicExact; 00017 /** 00018 * \brief .NET wrapper for GeographicLib::GeodesicLineExact. 00019 * 00020 * This class allows .NET applications to access GeographicLib::GeodesicLineExact. 00021 * 00022 * GeodesicLineExact facilitates the determination of a series of points on a 00023 * single geodesic. This is a companion to the GeodesicExact class. For 00024 * additional information on this class see the documentation on the 00025 * GeodesicLine class. 00026 * 00027 * C# Example: 00028 * \include example-GeodesicLineExact.cs 00029 * Managed C++ Example: 00030 * \include example-GeodesicLineExact.cpp 00031 * Visual Basic Example: 00032 * \include example-GeodesicLineExact.vb 00033 * 00034 * <B>INTERFACE DIFFERENCES:</B><BR> 00035 * A constructor has been provided that assumes WGS84 parameters. 00036 * 00037 * The following functions are implemented as properties: 00038 * Latitude, Longitude, Azimuth, EquatorialAzimuth, EquatorialArc, 00039 * MajorRadius, and Flattening. 00040 * 00041 * The constructors, GenPosition, and Capabilities functions accept the 00042 * "capabilities mask" as a NETGeographicLib::Mask rather than an 00043 * unsigned. The Capabilities function returns a NETGeographicLib::Mask 00044 * rather than an unsigned. 00045 **********************************************************************/ 00046 public ref class GeodesicLineExact 00047 { 00048 private: 00049 // a pointer to the GeographicLib::GeodesicLineExact. 00050 const GeographicLib::GeodesicLineExact* m_pGeodesicLineExact; 00051 00052 // the finalizer frees the unmanaged memory when the object is destroyed. 00053 !GeodesicLineExact(void); 00054 public: 00055 00056 /** \name Constructors 00057 **********************************************************************/ 00058 ///@{ 00059 00060 /** 00061 * Constructor for a geodesic line staring at latitude \e lat1, longitude 00062 * \e lon1, and azimuth \e azi1 (all in degrees). 00063 * 00064 * @param[in] g A GeodesicExact object used to compute the necessary 00065 * information about the GeodesicLineExact. 00066 * @param[in] lat1 latitude of point 1 (degrees). 00067 * @param[in] lon1 longitude of point 1 (degrees). 00068 * @param[in] azi1 azimuth at point 1 (degrees). 00069 * @param[in] caps bitor'ed combination of NETGeographicLib::Mask values 00070 * specifying the capabilities the GeodesicLineExact object should 00071 * possess, i.e., which quantities can be returned in calls to 00072 * GeodesicLine::Position. 00073 * 00074 * \e lat1 should be in the range [−90°, 90°]; \e lon1 and \e 00075 * azi1 should be in the range [−540°, 540°). 00076 * 00077 * The NETGeographicLib::Mask values are 00078 * - \e caps |= GeodesicLineExact::LATITUDE for the latitude \e lat2; this 00079 * is added automatically; 00080 * - \e caps |= NETGeographicLib::Mask::LONGITUDE for the latitude \e lon2; 00081 * - \e caps |= NETGeographicLib::Mask::AZIMUTH for the latitude \e azi2; this is 00082 * added automatically; 00083 * - \e caps |= NETGeographicLib::Mask::DISTANCE for the distance \e s12; 00084 * - \e caps |= NETGeographicLib::Mask::REDUCEDLENGTH for the reduced length \e 00085 m12; 00086 * - \e caps |= NETGeographicLib::Mask::GEODESICSCALE for the geodesic scales \e 00087 * M12 and \e M21; 00088 * - \e caps |= NETGeographicLib::Mask::AREA for the area \e S12; 00089 * - \e caps |= NETGeographicLib::Mask::DISTANCE_IN permits the length of the 00090 * geodesic to be given in terms of \e s12; without this capability the 00091 * length can only be specified in terms of arc length; 00092 * - \e caps |= NETGeographicLib::Mask::ALL for all of the above. 00093 * . 00094 * 00095 * If the point is at a pole, the azimuth is defined by keeping \e lon1 00096 * fixed, writing \e lat1 = ±(90° − ε), and taking 00097 * the limit ε → 0+. 00098 **********************************************************************/ 00099 GeodesicLineExact(GeodesicExact^ g, double lat1, double lon1, double azi1, 00100 NETGeographicLib::Mask caps ); 00101 00102 /** 00103 * A default constructor which assumes the WGS84 ellipsoid. See 00104 * constructor comments for details. 00105 **********************************************************************/ 00106 GeodesicLineExact(double lat1, double lon1, double azi1, 00107 NETGeographicLib::Mask caps); 00108 ///@} 00109 00110 /** 00111 * The destructor calls the finalizer 00112 **********************************************************************/ 00113 ~GeodesicLineExact() 00114 { this->!GeodesicLineExact(); } 00115 00116 /** \name Position in terms of distance 00117 **********************************************************************/ 00118 ///@{ 00119 00120 /** 00121 * Compute the position of point 2 which is a distance \e s12 (meters) 00122 * from point 1. 00123 * 00124 * @param[in] s12 distance between point 1 and point 2 (meters); it can be 00125 * signed. 00126 * @param[out] lat2 latitude of point 2 (degrees). 00127 * @param[out] lon2 longitude of point 2 (degrees); requires that the 00128 * GeodesicLineExact object was constructed with \e caps |= 00129 * GeodesicLineExact::LONGITUDE. 00130 * @param[out] azi2 (forward) azimuth at point 2 (degrees). 00131 * @param[out] m12 reduced length of geodesic (meters); requires that the 00132 * GeodesicLineExact object was constructed with \e caps |= 00133 * GeodesicLineExact::REDUCEDLENGTH. 00134 * @param[out] M12 geodesic scale of point 2 relative to point 1 00135 * (dimensionless); requires that the GeodesicLineExact object was 00136 * constructed with \e caps |= GeodesicLineExact::GEODESICSCALE. 00137 * @param[out] M21 geodesic scale of point 1 relative to point 2 00138 * (dimensionless); requires that the GeodesicLineExact object was 00139 * constructed with \e caps |= GeodesicLineExact::GEODESICSCALE. 00140 * @param[out] S12 area under the geodesic (meters<sup>2</sup>); requires 00141 * that the GeodesicLineExact object was constructed with \e caps |= 00142 * GeodesicLineExact::AREA. 00143 * @return \e a12 arc length of between point 1 and point 2 (degrees). 00144 * 00145 * The values of \e lon2 and \e azi2 returned are in the range 00146 * [−180°, 180°). 00147 * 00148 * The GeodesicLineExact object \e must have been constructed with \e caps 00149 * |= GeodesicLineExact::DISTANCE_IN; otherwise Math::NaN() is returned and 00150 * no parameters are set. Requesting a value which the GeodesicLineExact 00151 * object is not capable of computing is not an error; the corresponding 00152 * argument will not be altered. 00153 * 00154 * The following functions are overloaded versions of 00155 * GeodesicLineExact::Position which omit some of the output parameters. 00156 * Note, however, that the arc length is always computed and returned as 00157 * the function value. 00158 **********************************************************************/ 00159 double Position(double s12, 00160 [System::Runtime::InteropServices::Out] double% lat2, 00161 [System::Runtime::InteropServices::Out] double% lon2, 00162 [System::Runtime::InteropServices::Out] double% azi2, 00163 [System::Runtime::InteropServices::Out] double% m12, 00164 [System::Runtime::InteropServices::Out] double% M12, 00165 [System::Runtime::InteropServices::Out] double% M21, 00166 [System::Runtime::InteropServices::Out] double% S12); 00167 00168 /** 00169 * See the documentation for GeodesicLineExact::Position. 00170 **********************************************************************/ 00171 double Position(double s12, 00172 [System::Runtime::InteropServices::Out] double% lat2, 00173 [System::Runtime::InteropServices::Out] double% lon2); 00174 00175 /** 00176 * See the documentation for GeodesicLineExact::Position. 00177 **********************************************************************/ 00178 double Position(double s12, 00179 [System::Runtime::InteropServices::Out] double% lat2, 00180 [System::Runtime::InteropServices::Out] double% lon2, 00181 [System::Runtime::InteropServices::Out] double% azi2); 00182 00183 /** 00184 * See the documentation for GeodesicLineExact::Position. 00185 **********************************************************************/ 00186 double Position(double s12, 00187 [System::Runtime::InteropServices::Out] double% lat2, 00188 [System::Runtime::InteropServices::Out] double% lon2, 00189 [System::Runtime::InteropServices::Out] double% azi2, 00190 [System::Runtime::InteropServices::Out] double% m12); 00191 00192 /** 00193 * See the documentation for GeodesicLineExact::Position. 00194 **********************************************************************/ 00195 double Position(double s12, 00196 [System::Runtime::InteropServices::Out] double% lat2, 00197 [System::Runtime::InteropServices::Out] double% lon2, 00198 [System::Runtime::InteropServices::Out] double% azi2, 00199 [System::Runtime::InteropServices::Out] double% M12, 00200 [System::Runtime::InteropServices::Out] double% M21); 00201 00202 /** 00203 * See the documentation for GeodesicLineExact::Position. 00204 **********************************************************************/ 00205 double Position(double s12, 00206 [System::Runtime::InteropServices::Out] double% lat2, 00207 [System::Runtime::InteropServices::Out] double% lon2, 00208 [System::Runtime::InteropServices::Out] double% azi2, 00209 [System::Runtime::InteropServices::Out] double% m12, 00210 [System::Runtime::InteropServices::Out] double% M12, 00211 [System::Runtime::InteropServices::Out] double% M21); 00212 00213 ///@} 00214 00215 /** \name Position in terms of arc length 00216 **********************************************************************/ 00217 ///@{ 00218 00219 /** 00220 * Compute the position of point 2 which is an arc length \e a12 (degrees) 00221 * from point 1. 00222 * 00223 * @param[in] a12 arc length between point 1 and point 2 (degrees); it can 00224 * be signed. 00225 * @param[out] lat2 latitude of point 2 (degrees). 00226 * @param[out] lon2 longitude of point 2 (degrees); requires that the 00227 * GeodesicLineExact object was constructed with \e caps |= 00228 * GeodesicLineExact::LONGITUDE. 00229 * @param[out] azi2 (forward) azimuth at point 2 (degrees). 00230 * @param[out] s12 distance between point 1 and point 2 (meters); requires 00231 * that the GeodesicLineExact object was constructed with \e caps |= 00232 * GeodesicLineExact::DISTANCE. 00233 * @param[out] m12 reduced length of geodesic (meters); requires that the 00234 * GeodesicLineExact object was constructed with \e caps |= 00235 * GeodesicLineExact::REDUCEDLENGTH. 00236 * @param[out] M12 geodesic scale of point 2 relative to point 1 00237 * (dimensionless); requires that the GeodesicLineExact object was 00238 * constructed with \e caps |= GeodesicLineExact::GEODESICSCALE. 00239 * @param[out] M21 geodesic scale of point 1 relative to point 2 00240 * (dimensionless); requires that the GeodesicLineExact object was 00241 * constructed with \e caps |= GeodesicLineExact::GEODESICSCALE. 00242 * @param[out] S12 area under the geodesic (meters<sup>2</sup>); requires 00243 * that the GeodesicLineExact object was constructed with \e caps |= 00244 * GeodesicLineExact::AREA. 00245 * 00246 * The values of \e lon2 and \e azi2 returned are in the range 00247 * [−180°, 180°). 00248 * 00249 * Requesting a value which the GeodesicLineExact object is not capable of 00250 * computing is not an error; the corresponding argument will not be 00251 * altered. 00252 * 00253 * The following functions are overloaded versions of 00254 * GeodesicLineExact::ArcPosition which omit some of the output parameters. 00255 **********************************************************************/ 00256 void ArcPosition(double a12, 00257 [System::Runtime::InteropServices::Out] double% lat2, 00258 [System::Runtime::InteropServices::Out] double% lon2, 00259 [System::Runtime::InteropServices::Out] double% azi2, 00260 [System::Runtime::InteropServices::Out] double% s12, 00261 [System::Runtime::InteropServices::Out] double% m12, 00262 [System::Runtime::InteropServices::Out] double% M12, 00263 [System::Runtime::InteropServices::Out] double% M21, 00264 [System::Runtime::InteropServices::Out] double% S12); 00265 00266 /** 00267 * See the documentation for GeodesicLineExact::ArcPosition. 00268 **********************************************************************/ 00269 void ArcPosition(double a12, 00270 [System::Runtime::InteropServices::Out] double% lat2, 00271 [System::Runtime::InteropServices::Out] double% lon2); 00272 00273 /** 00274 * See the documentation for GeodesicLineExact::ArcPosition. 00275 **********************************************************************/ 00276 void ArcPosition(double a12, 00277 [System::Runtime::InteropServices::Out] double% lat2, 00278 [System::Runtime::InteropServices::Out] double% lon2, 00279 [System::Runtime::InteropServices::Out] double% azi2); 00280 00281 /** 00282 * See the documentation for GeodesicLineExact::ArcPosition. 00283 **********************************************************************/ 00284 void ArcPosition(double a12, 00285 [System::Runtime::InteropServices::Out] double% lat2, 00286 [System::Runtime::InteropServices::Out] double% lon2, 00287 [System::Runtime::InteropServices::Out] double% azi2, 00288 [System::Runtime::InteropServices::Out] double% s12); 00289 00290 /** 00291 * See the documentation for GeodesicLineExact::ArcPosition. 00292 **********************************************************************/ 00293 void ArcPosition(double a12, 00294 [System::Runtime::InteropServices::Out] double% lat2, 00295 [System::Runtime::InteropServices::Out] double% lon2, 00296 [System::Runtime::InteropServices::Out] double% azi2, 00297 [System::Runtime::InteropServices::Out] double% s12, 00298 [System::Runtime::InteropServices::Out] double% m12); 00299 00300 /** 00301 * See the documentation for GeodesicLineExact::ArcPosition. 00302 **********************************************************************/ 00303 void ArcPosition(double a12, 00304 [System::Runtime::InteropServices::Out] double% lat2, 00305 [System::Runtime::InteropServices::Out] double% lon2, 00306 [System::Runtime::InteropServices::Out] double% azi2, 00307 [System::Runtime::InteropServices::Out] double% s12, 00308 [System::Runtime::InteropServices::Out] double% M12, 00309 [System::Runtime::InteropServices::Out] double% M21); 00310 00311 /** 00312 * See the documentation for GeodesicLineExact::ArcPosition. 00313 **********************************************************************/ 00314 void ArcPosition(double a12, 00315 [System::Runtime::InteropServices::Out] double% lat2, 00316 [System::Runtime::InteropServices::Out] double% lon2, 00317 [System::Runtime::InteropServices::Out] double% azi2, 00318 [System::Runtime::InteropServices::Out] double% s12, 00319 [System::Runtime::InteropServices::Out] double% m12, 00320 [System::Runtime::InteropServices::Out] double% M12, 00321 [System::Runtime::InteropServices::Out] double% M21); 00322 ///@} 00323 00324 /** \name The general position function. 00325 **********************************************************************/ 00326 ///@{ 00327 00328 /** 00329 * The general position function. GeodesicLineExact::Position and 00330 * GeodesicLineExact::ArcPosition are defined in terms of this function. 00331 * 00332 * @param[in] arcmode boolean flag determining the meaning of the second 00333 * parameter; if arcmode is false, then the GeodesicLineExact object must 00334 * have been constructed with \e caps |= GeodesicLineExact::DISTANCE_IN. 00335 * @param[in] s12_a12 if \e arcmode is false, this is the distance between 00336 * point 1 and point 2 (meters); otherwise it is the arc length between 00337 * point 1 and point 2 (degrees); it can be signed. 00338 * @param[in] outmask a bitor'ed combination of NETGeographicLib::Mask 00339 * values specifying which of the following parameters should be set. 00340 * @param[out] lat2 latitude of point 2 (degrees). 00341 * @param[out] lon2 longitude of point 2 (degrees); requires that the 00342 * GeodesicLineExact object was constructed with \e caps |= 00343 * GeodesicLineExact::LONGITUDE. 00344 * @param[out] azi2 (forward) azimuth at point 2 (degrees). 00345 * @param[out] s12 distance between point 1 and point 2 (meters); requires 00346 * that the GeodesicLineExact object was constructed with \e caps |= 00347 * GeodesicLineExact::DISTANCE. 00348 * @param[out] m12 reduced length of geodesic (meters); requires that the 00349 * GeodesicLineExact object was constructed with \e caps |= 00350 * GeodesicLineExact::REDUCEDLENGTH. 00351 * @param[out] M12 geodesic scale of point 2 relative to point 1 00352 * (dimensionless); requires that the GeodesicLineExact object was 00353 * constructed with \e caps |= GeodesicLineExact::GEODESICSCALE. 00354 * @param[out] M21 geodesic scale of point 1 relative to point 2 00355 * (dimensionless); requires that the GeodesicLineExact object was 00356 * constructed with \e caps |= GeodesicLineExact::GEODESICSCALE. 00357 * @param[out] S12 area under the geodesic (meters<sup>2</sup>); requires 00358 * that the GeodesicLineExact object was constructed with \e caps |= 00359 * GeodesicLineExact::AREA. 00360 * @return \e a12 arc length of between point 1 and point 2 (degrees). 00361 * 00362 * The NETGeographicLib::Mask values possible for \e outmask are 00363 * - \e outmask |= NETGeographicLib::Mask::LATITUDE for the latitude \e lat2; 00364 * - \e outmask |= NETGeographicLib::Mask::LONGITUDE for the latitude \e lon2; 00365 * - \e outmask |= NETGeographicLib::Mask::AZIMUTH for the latitude \e azi2; 00366 * - \e outmask |= NETGeographicLib::Mask::DISTANCE for the distance \e s12; 00367 * - \e outmask |= NETGeographicLib::Mask::REDUCEDLENGTH for the reduced length 00368 * \e m12; 00369 * - \e outmask |= NETGeographicLib::Mask::GEODESICSCALE for the geodesic scales 00370 * \e M12 and \e M21; 00371 * - \e outmask |= NETGeographicLib::Mask::AREA for the area \e S12; 00372 * - \e outmask |= NETGeographicLib::Mask::ALL for all of the above. 00373 * . 00374 * Requesting a value which the GeodesicLineExact object is not capable of 00375 * computing is not an error; the corresponding argument will not be 00376 * altered. Note, however, that the arc length is always computed and 00377 * returned as the function value. 00378 **********************************************************************/ 00379 double GenPosition(bool arcmode, double s12_a12, 00380 NETGeographicLib::Mask outmask, 00381 [System::Runtime::InteropServices::Out] double% lat2, 00382 [System::Runtime::InteropServices::Out] double% lon2, 00383 [System::Runtime::InteropServices::Out] double% azi2, 00384 [System::Runtime::InteropServices::Out] double% s12, 00385 [System::Runtime::InteropServices::Out] double% m12, 00386 [System::Runtime::InteropServices::Out] double% M12, 00387 [System::Runtime::InteropServices::Out] double% M21, 00388 [System::Runtime::InteropServices::Out] double% S12); 00389 00390 ///@} 00391 00392 /** \name Inspector functions 00393 **********************************************************************/ 00394 ///@{ 00395 /** 00396 * @return \e lat1 the latitude of point 1 (degrees). 00397 **********************************************************************/ 00398 property double Latitude { double get(); } 00399 00400 /** 00401 * @return \e lon1 the longitude of point 1 (degrees). 00402 **********************************************************************/ 00403 property double Longitude { double get(); } 00404 00405 /** 00406 * @return \e azi1 the azimuth (degrees) of the geodesic line at point 1. 00407 **********************************************************************/ 00408 property double Azimuth { double get(); } 00409 00410 /** 00411 * @return \e azi0 the azimuth (degrees) of the geodesic line as it crosses 00412 * the equator in a northward direction. 00413 **********************************************************************/ 00414 property double EquatorialAzimuth { double get(); } 00415 00416 /** 00417 * @return \e a1 the arc length (degrees) between the northward equatorial 00418 * crossing and point 1. 00419 **********************************************************************/ 00420 property double EquatorialArc { double get(); } 00421 00422 /** 00423 * @return \e a the equatorial radius of the ellipsoid (meters). This is 00424 * the value inherited from the GeodesicExact object used in the 00425 * constructor. 00426 **********************************************************************/ 00427 property double MajorRadius { double get(); } 00428 00429 /** 00430 * @return \e f the flattening of the ellipsoid. This is the value 00431 * inherited from the GeodesicExact object used in the constructor. 00432 **********************************************************************/ 00433 property double Flattening { double get(); } 00434 00435 /** 00436 * @return \e caps the computational capabilities that this object was 00437 * constructed with. LATITUDE and AZIMUTH are always included. 00438 **********************************************************************/ 00439 NETGeographicLib::Mask Capabilities(); 00440 00441 /** 00442 * @param[in] testcaps a set of bitor'ed GeodesicLineExact::mask values. 00443 * @return true if the GeodesicLineExact object has all these capabilities. 00444 **********************************************************************/ 00445 bool Capabilities(NETGeographicLib::Mask testcaps); 00446 ///@} 00447 }; 00448 } // namespace NETGeographicLib