track.h

来自「GPS Manager is a GUI for downloading, or」· C头文件 代码 · 共 133 行

H
133
字号
/*gpsmgr: A program for managing GPS informationCopyright (C) 2003 Austin BinghamThis program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.You can reach the author at:    abingham@spamcop.net*/#ifndef TRACK_H#define TRACK_H#include "datatypes.h"#include "groupobject.h"#include "latlon.h"#include <string>#include <vector>namespace gpsmgr{    //--------------------------------------------------------------------------    class TrackPoint    {    public:	TrackPoint();	TrackPoint(const LatLon& pos,		   DistFt altitude,		   UnixTime time,		   bool new_segment);	const LatLon& position() const;	void setPosition(const LatLon& pos);	DistFt altitude() const;	void setAltitude(DistFt alt);	UnixTime time() const;	void setTime(UnixTime time);	bool newSegment() const;	void setNewSegment(bool ns);	    private:	LatLon mPosition;	DistFt mAltitude;	UnixTime mTime;	bool mNewSegment;    };    //--------------------------------------------------------------------------    class Track : public GroupObject    {    public:	typedef TrackPoint PointType;	typedef vector<PointType> PointList;		Track();	Track(const string& name,	      const string& comment);		template <class ItrType>	Track(ItrType begin,	      ItrType end,	      const string& name,	      const string& comment);	const PointList& points() const;	PointList& points();	void addPoint(const PointType& pt);	template <class ItrType>	void setPoints(ItrType begin, ItrType end);	const string& name() const;	void setName(const string& name);	const string& comment() const;	void setComment(const string& comment);	    private:	PointList mTrackList;	string mName;	string mComment;    };    bool operator==(const TrackPoint& lhs, const TrackPoint& rhs);    bool operator==(const Track& lhs, const Track& rhs);    bool operator<(const TrackPoint& lhs, const TrackPoint& rhs);    bool operator<(const Track& lhs, const Track& rhs);    ///////////////////////////////    // TEMPLATE IMPLEMENTATAIONS //    ///////////////////////////////    template <class ItrType>    Track::Track(ItrType begin,		 ItrType end,		 const string& name,		 const string& comment) :	mTrackList (begin, end),	mName (name),	mComment (comment)    {}        template <class ItrType>    void Track::setPoints(ItrType begin, ItrType end)    {	mTrackList.assign(begin, end);    }}#endif

⌨️ 快捷键说明

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