Add project files.
This commit is contained in:
parent
18b81590d3
commit
045f3a8439
15 changed files with 1303019 additions and 0 deletions
34
lib/osmparser/include/osmnode.hpp
Normal file
34
lib/osmparser/include/osmnode.hpp
Normal file
|
@ -0,0 +1,34 @@
|
|||
#pragma once
|
||||
#include <vector>
|
||||
|
||||
#include "util.hpp"
|
||||
|
||||
namespace osmp
|
||||
{
|
||||
class Object;
|
||||
|
||||
class Node
|
||||
{
|
||||
public:
|
||||
Node(const tinyxml2::XMLElement* xml, Object* parent);
|
||||
|
||||
const std::vector<Tag>& GetTags() const;
|
||||
size_t GetTagsSize() const;
|
||||
const Tag& GetTag(size_t index) const;
|
||||
|
||||
private:
|
||||
Object* parent;
|
||||
|
||||
std::vector<Tag> tags;
|
||||
|
||||
public:
|
||||
unsigned int id;
|
||||
float lat, lon;
|
||||
std::string user;
|
||||
unsigned int uid;
|
||||
bool visible;
|
||||
std::string version;
|
||||
unsigned int changeset;
|
||||
std::string timestamp;
|
||||
};
|
||||
}
|
37
lib/osmparser/include/osmobject.hpp
Normal file
37
lib/osmparser/include/osmobject.hpp
Normal file
|
@ -0,0 +1,37 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include <util.hpp>
|
||||
|
||||
namespace osmp
|
||||
{
|
||||
class Node;
|
||||
class Way;
|
||||
|
||||
class Object
|
||||
{
|
||||
public:
|
||||
Object(const std::string& file);
|
||||
~Object();
|
||||
|
||||
std::vector<Node*> GetNodes() const;
|
||||
size_t GetNodesSize() const;
|
||||
const Node* GetNode(unsigned int id) const;
|
||||
|
||||
std::vector<Way*> GetWays() const;
|
||||
size_t GetWaysSize() const;
|
||||
const Way* GetWay(unsigned int id) const;
|
||||
|
||||
public:
|
||||
const std::string version;
|
||||
const std::string generator;
|
||||
|
||||
Bounds bounds;
|
||||
|
||||
private:
|
||||
std::map<unsigned int, Node*> nodes;
|
||||
std::map<unsigned int, Way*> ways;
|
||||
};
|
||||
}
|
5
lib/osmparser/include/osmp.hpp
Normal file
5
lib/osmparser/include/osmp.hpp
Normal file
|
@ -0,0 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include <osmobject.hpp>
|
||||
#include <osmnode.hpp>
|
||||
#include <osmway.hpp>
|
39
lib/osmparser/include/osmway.hpp
Normal file
39
lib/osmparser/include/osmway.hpp
Normal file
|
@ -0,0 +1,39 @@
|
|||
#pragma once
|
||||
#include <vector>
|
||||
|
||||
#include <util.hpp>
|
||||
|
||||
namespace osmp
|
||||
{
|
||||
class Object;
|
||||
class Node;
|
||||
|
||||
class Way
|
||||
{
|
||||
public:
|
||||
Way(const tinyxml2::XMLElement* way_elem, Object* parent);
|
||||
|
||||
const std::vector<Tag>& GetTags() const;
|
||||
size_t GetTagsSize() const;
|
||||
const Tag& GetTag(size_t index) const;
|
||||
|
||||
const std::vector<const Node*>& GetNodes() const;
|
||||
size_t GetNodesSize() const;
|
||||
const Node& GetNode(size_t index) const;
|
||||
|
||||
public:
|
||||
unsigned int id;
|
||||
std::string user;
|
||||
unsigned int uid;
|
||||
bool visible;
|
||||
std::string version;
|
||||
unsigned int changeset;
|
||||
std::string timestamp;
|
||||
|
||||
private:
|
||||
Object* parent;
|
||||
|
||||
std::vector<const Node*> nodes;
|
||||
std::vector<Tag> tags;
|
||||
};
|
||||
}
|
27
lib/osmparser/include/util.hpp
Normal file
27
lib/osmparser/include/util.hpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace tinyxml2
|
||||
{
|
||||
class XMLElement;
|
||||
}
|
||||
|
||||
namespace osmp
|
||||
{
|
||||
typedef struct sBounds
|
||||
{
|
||||
float minlat, minlon, maxlat, maxlon;
|
||||
} Bounds;
|
||||
|
||||
typedef struct sTag
|
||||
{
|
||||
std::string k; // TODO: Should/could be an enum
|
||||
std::string v;
|
||||
} Tag;
|
||||
|
||||
std::string GetSafeAttributeString(const tinyxml2::XMLElement* elem, const std::string& name);
|
||||
float GetSafeAttributeFloat(const tinyxml2::XMLElement* elem, const std::string& name);
|
||||
unsigned int GetSafeAttributeUint(const tinyxml2::XMLElement* elem, const std::string& name);
|
||||
bool GetSafeAttributeBool(const tinyxml2::XMLElement* elem, const std::string& name);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue