⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 position.hpp

📁 一个gps小工具包
💻 HPP
📖 第 1 页 / 共 3 页
字号:
         /** Multiply a Position by an integer scalar on the right.          * @param left Position to be multiplied by the scalar          * @param scale the (int) scalar          * @return The new Position.          */      friend Position operator*(const Position& left,                                const int& scale)         {            return operator*(double(scale), left);         }      // ----------- Part  5: member functions: comparisons ---------------------      //         /// Equality operator. Return true if range between this Position and         /// the input Position is less than tolerance. Return false if geoid         /// values differ.         /// @param right Position to be compared to this Position      bool operator==(const Position &right) const         throw();         /// Inequality operator. Return true if range between this Position and         /// the input Position is greater than tolerance. Return true if geoid         /// values differ.         /// @param right Position to be compared to this Position      bool operator!=(const Position &right) const         throw();      // ----------- Part  6: member functions: coordinate transformations ------      //         /**          * Transform coordinate system. Does nothing if sys already matches the          * current value of member CoordinateSystem 'system'.          * @param sys CoordinateSystem into which this Position is transformed.          */      Position transformTo(CoordinateSystem sys)         throw();           /// Convert to geodetic coordinates (does nothing if         /// system == Geodetic already).      Position asGeodetic()         throw()      { transformTo(Geodetic); return *this; }         /// Convert to another geoid, then to geodetic coordinates.         /// @return a reference to this.         /// @throw GeometryException if input is NULL.      Position asGeodetic(GeoidModel *geoid)         throw(GeometryException)      {         try { setGeoidModel(geoid); }         catch(GeometryException& ge) { GPSTK_RETHROW(ge); }         transformTo(Geodetic);         return *this;      }         /// Convert to cartesian coordinates (does nothing if         /// system == Cartesian already).      Position asECEF()         throw()      { transformTo(Cartesian); return *this; }      // ----------- Part  7: member functions: get -----------------------------      //       // These routines retrieve coordinate values in all coordinate systems.      //         /// return X coordinate (meters)      double X() const         throw();         /// return Y coordinate (meters)      double Y() const         throw();         /// return Z coordinate (meters)      double Z() const         throw();         /// return geodetic latitude (degrees North).      double geodeticLatitude() const         throw();         /// return geocentric latitude (degrees North);         /// equal to 90 degress - theta in regular spherical coordinates.      double geocentricLatitude() const         throw();         /// return spherical coordinate theta in degrees      double theta() const         throw();         /// return spherical coordinate phi in degrees      double phi() const         throw();         /// return longitude (degrees East);         /// equal to phi in regular spherical coordinates.      double longitude() const         throw();         /// return distance from the center of Earth (meters),         /// Same as radius in spherical coordinates.      double radius() const         throw();         /// return height above ellipsoid (meters) (Geodetic).      double height() const         throw();         /// return the coordinate system for this Position      CoordinateSystem getCoordinateSystem() const         throw()       { return system; };         /// return geodetic latitude (deg N)      double getGeodeticLatitude() const         throw()      { return geodeticLatitude(); }         /// return geocentric latitude (deg N)      double getGeocentricLatitude() const         throw()      { return geocentricLatitude(); }         /// return longitude (deg E) (either geocentric or geodetic)      double getLongitude() const         throw()      { return longitude(); }         /// return height above ellipsoid (meters)      double getAltitude() const         throw()      { return height(); }         /// return height above ellipsoid (meters)      double getHeight() const         throw()      { return height(); }         /// return ECEF X coordinate (meters)      double getX() const         throw()      { return X(); }         /// return ECEF Y coordinate (meters)      double getY() const         throw()      { return Y(); }         /// return ECEF Z coordinate (meters)      double getZ() const         throw()      { return Z(); }         /// return spherical coordinate angle theta (deg) (90 - geocentric latitude)      double getTheta() const         throw()      { return theta(); }         /// return spherical coordinate angle phi (deg) (same as longitude)      double getPhi() const         throw()      { return phi(); }         /// return radius      double getRadius() const         throw()      { return radius(); }      // ----------- Part  8: member functions: set -----------------------------      //         /**          * Set the geoid values for this Position given a geoid.          * @param geoid Pointer to the GeoidModel.          * @throw GeometryException if input is NULL.          */      void setGeoidModel(const GeoidModel *geoid)         throw(GeometryException);         /**          * Set the Position given geodetic coordinates; system is set to Geodetic.          * @param lat geodetic latitude in degrees North          * @param lon geodetic longitude in degrees East          * @param ht height above the ellipsoid in meters          * @return a reference to this object.          * @throw GeometryException on invalid input          */      Position& setGeodetic(const double lat,                            const double lon,                            const double ht,                            const GeoidModel *geoid = NULL)         throw(GeometryException);         /**          * Set the Position given geocentric coordinates; system is set to Geocentric          * @param lat geocentric latitude in degrees North          * @param lon geocentric longitude in degrees East          * @param rad radius from the Earth's center in meters          * @return a reference to this object.          * @throw GeometryException on invalid input          */      Position& setGeocentric(const double lat,                              const double lon,                              const double rad)         throw(GeometryException);         /**          * Set the Position given spherical coordinates; system is set to Spherical          * @param theta angle from the Z-axis (degrees)          * @param phi angle from the X-axis in the XY plane (degrees)          * @param rad radius from the center in meters          * @return a reference to this object.          * @throw GeometryException on invalid input          */      Position& setSpherical(const double theta,                             const double phi,                             const double rad)         throw(GeometryException);         /**          * Set the Position given ECEF coordinates; system is set to Cartesian.          * @param X ECEF X coordinate in meters.          * @param Y ECEF Y coordinate in meters.          * @param Z ECEF Z coordinate in meters.          * @return a reference to this object.          */      Position& setECEF(const double X,                        const double Y,                        const double Z)         throw();         /**          * Set the Position given an array of ECEF coordinates;          * system is set to Cartesian.          * @param XYZ array[3] ECEF X,Y,Z coordinate in meters.          * @return a reference to this object.          */      Position& setECEF(const double XYZ[3])         throw()      { return setECEF(XYZ[0],XYZ[1],XYZ[2]); }         /**          * Set the Position given ECEF coordinates; system is set to Cartesian.          * @param XYZ ECEF X,Y,Z coordinates in meters.          * @return a reference to this object.          */      Position& setECEF(const Triple& XYZ)         throw()      { return setECEF(XYZ[0],XYZ[1],XYZ[2]); }      // ----------- Part 9: member functions: setToString, printf -------------      //         /**          * setToString, similar to scanf, this function takes a string and a          * format describing string in order to define Position          * values.  The parameters it can take are listed below and          * described above with the printf() function.          *          * The specification must be sufficient to define a Position.          * The following table lists combinations that give valid          * Positions. Anything more or other combinations will give          * unknown (read as: "bad") results so don't try it.  Anything          * less will throw an exception.          *          * @code          *  %X %Y %Z  (cartesian or ECEF in kilometers)          *  %x %y %z  (cartesian or ECEF in meters)          *  %a %l %r  (geocentric lat,lon,radius, longitude E, radius in meters)          *  %A %L %h  (geodetic lat,lon,height, longitude E, height in meters)          *  %a %w %R  (geocentric lat,lon,radius, longitude W, radius in kilometers)          *  %A %W %H  (geodetic lat,lon,height, longitude W, height in kilometers)          *  %t %p %r  (spherical theta, phi, radius, degrees and meters)          *  %T %P %R  (spherical theta, phi, radius, radians and kilometers)          * @endcode          *          * So          * @code          * pos.setToString("123.4342,9328.1982,-128987.399", "%X,%Y,%Z");          * @endcode          *          * works but           *          * @code          * pos.setToString("123.4342,9328.1982", "%X,%Y");          * @endcode          * doesn't work (incomplete specification because it doesn't specify          * a Position).          *          * Whitespace is unimportant here; the function will handle it.          * The caller must ensure that that the extra characters in          * the format string (ie '.' ',') are in the same relative          * location as they are in the actual string; see the example above.          *          * @param str string from which to get the Position coordinates          * @param fmt format to use to parse \c str.          * @throw GeometryException if \c fmt is an incomplete or invalid          *    specification          * @throw FormatException if unable to scan \c str.          * @throw StringException if an error occurs manipulating the          * \c str or \c fmt strings.          * @return a reference to this object.          */      Position& setToString(const std::string& str,                            const std::string& fmt)         throw(GeometryException,               DayTime::FormatException,               StringUtils::StringException);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -