Added triangulation routine
This commit is contained in:
parent
045f3a8439
commit
6ea55594ab
25 changed files with 891530 additions and 171 deletions
51
lib/osmparser/include/osmimember.hpp
Normal file
51
lib/osmparser/include/osmimember.hpp
Normal file
|
@ -0,0 +1,51 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include <util.hpp>
|
||||
#include <osmtag.hpp>
|
||||
|
||||
namespace osmp
|
||||
{
|
||||
class Object;
|
||||
|
||||
class IMember
|
||||
{
|
||||
public:
|
||||
enum class Type {
|
||||
NODE, WAY, RELATION
|
||||
};
|
||||
|
||||
public:
|
||||
IMember(const IMember& other) = delete;
|
||||
virtual ~IMember() {}
|
||||
|
||||
IMember::Type GetType() const;
|
||||
|
||||
const std::vector<Tag>& GetTags() const;
|
||||
size_t GetTagsSize() const;
|
||||
const Tag& GetTag(size_t index) const;
|
||||
std::string GetTag(const std::string& key) const;
|
||||
|
||||
protected:
|
||||
IMember(const tinyxml2::XMLElement* element, Object* parent, IMember::Type type);
|
||||
|
||||
protected:
|
||||
IMember::Type type;
|
||||
Object* parent;
|
||||
|
||||
std::vector<Tag> tags;
|
||||
// std::map<std::string, std::string> tags;
|
||||
|
||||
public:
|
||||
unsigned int id;
|
||||
std::string user;
|
||||
unsigned int uid;
|
||||
bool visible;
|
||||
std::string version;
|
||||
unsigned int changeset;
|
||||
std::string timestamp;
|
||||
};
|
||||
}
|
|
@ -2,33 +2,19 @@
|
|||
#include <vector>
|
||||
|
||||
#include "util.hpp"
|
||||
#include <osmimember.hpp>
|
||||
#include <osmtag.hpp>
|
||||
|
||||
namespace osmp
|
||||
{
|
||||
class Object;
|
||||
|
||||
class Node
|
||||
class Node : public IMember
|
||||
{
|
||||
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;
|
||||
};
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
|
@ -9,6 +10,7 @@ namespace osmp
|
|||
{
|
||||
class Node;
|
||||
class Way;
|
||||
class Relation;
|
||||
|
||||
class Object
|
||||
{
|
||||
|
@ -16,13 +18,17 @@ namespace osmp
|
|||
Object(const std::string& file);
|
||||
~Object();
|
||||
|
||||
std::vector<Node*> GetNodes() const;
|
||||
std::vector<std::shared_ptr<Node>> GetNodes() const;
|
||||
size_t GetNodesSize() const;
|
||||
const Node* GetNode(unsigned int id) const;
|
||||
std::shared_ptr<Node> GetNode(unsigned int id) const;
|
||||
|
||||
std::vector<Way*> GetWays() const;
|
||||
std::vector<std::shared_ptr<Way>> GetWays() const;
|
||||
size_t GetWaysSize() const;
|
||||
const Way* GetWay(unsigned int id) const;
|
||||
std::shared_ptr<Way> GetWay(unsigned int id) const;
|
||||
|
||||
std::vector<std::shared_ptr<Relation>> GetRelations() const;
|
||||
size_t GetRelationsSize() const;
|
||||
std::shared_ptr<Relation> GetRelation(unsigned int id) const;
|
||||
|
||||
public:
|
||||
const std::string version;
|
||||
|
@ -31,7 +37,8 @@ namespace osmp
|
|||
Bounds bounds;
|
||||
|
||||
private:
|
||||
std::map<unsigned int, Node*> nodes;
|
||||
std::map<unsigned int, Way*> ways;
|
||||
std::map<unsigned int, std::shared_ptr<Node>> nodes;
|
||||
std::map<unsigned int, std::shared_ptr<Way>> ways;
|
||||
std::map<unsigned int, std::shared_ptr<Relation>> relations;
|
||||
};
|
||||
}
|
|
@ -2,4 +2,7 @@
|
|||
|
||||
#include <osmobject.hpp>
|
||||
#include <osmnode.hpp>
|
||||
#include <osmway.hpp>
|
||||
#include <osmway.hpp>
|
||||
#include <osmtag.hpp>
|
||||
#include <osmrelation.hpp>
|
||||
#include <osmimember.hpp>
|
43
lib/osmparser/include/osmrelation.hpp
Normal file
43
lib/osmparser/include/osmrelation.hpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
#pragma once
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
#include <util.hpp>
|
||||
#include <osmtag.hpp>
|
||||
#include <osmimember.hpp>
|
||||
|
||||
namespace osmp
|
||||
{
|
||||
class Object;
|
||||
|
||||
class Relation : public IMember
|
||||
{
|
||||
public:
|
||||
typedef struct sMember {
|
||||
std::shared_ptr<IMember> member;
|
||||
std::string role;
|
||||
} Member;
|
||||
|
||||
public:
|
||||
Relation(const tinyxml2::XMLElement* xml, Object* parent);
|
||||
|
||||
std::string GetRelationType();
|
||||
|
||||
const std::vector<Member>& GetNodes() const;
|
||||
size_t GetNodesSize() const;
|
||||
const Member& GetNode(size_t index) const;
|
||||
|
||||
const std::vector<Member>& GetWays() const;
|
||||
size_t GetWaysSize() const;
|
||||
const Member& GetWay(size_t index) const;
|
||||
|
||||
bool HasNullMembers() const { return hasNullMembers; }
|
||||
|
||||
private:
|
||||
std::string relationType;
|
||||
bool hasNullMembers;
|
||||
|
||||
std::vector<Member> nodes;
|
||||
std::vector<Member> ways;
|
||||
};
|
||||
}
|
36
lib/osmparser/include/osmtag.hpp
Normal file
36
lib/osmparser/include/osmtag.hpp
Normal file
|
@ -0,0 +1,36 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace osmp
|
||||
{
|
||||
enum class TagKey {
|
||||
NONE,
|
||||
AERIALWAY, AEROWAY, AMENITY, BARRIER, BOUNDARY,
|
||||
BUILDING, CRAFT, EMERGENCY, GEOLOGICAL, HEALTHCARE,
|
||||
HIGHWAY, HISTORIC, LANDUSE, LEISURE, MANMADE, MILITARY,
|
||||
NATURAL, OFFICE, PLACE, POWER, PUBLIC_TRANSPORT,
|
||||
RAILWAY, ROUTE, SHOP, SPORT, TELECOM, TOURISM, WATER, WATERWAY
|
||||
};
|
||||
|
||||
/*
|
||||
enum class TagValue {
|
||||
NONE,
|
||||
|
||||
BUILDING_APARTMENTS, BUILDING_BUNGALOW, BUILDING_CABIN, BUILDING_DETACHED, BUILDING_DORMITORY, BUILDING_FARM, BUILDING_GER,
|
||||
BUILDING_HOTEL, BUILDING_HOUSE, BUILDING_HOUSEBOAT, BUILDING_RESIDENTIAL, BUILDING_SEMIDETACHED_HOUSE, BUILDING_STATIC_CARAVAN,
|
||||
BUILDING_TERRACE, BUILDING_COMMERCIAL, BUILDING_INDUSTRIAL, BUILDING_KIOSK, BUILDING_OFFICE, BUILDING_RETAIL, BUILDING_SUPERMARKET,
|
||||
BUILDING_WAREHOUSE, BUILDING_CATHEDRAL, BUILDING_CHAPEL, BUILDING_CHURCH, BUILDING_MONASTERY, BUILDING_MOSQUE, BUILDING_PRESBYTERY,
|
||||
BUILDING_RELIGIOUS, BUILDING_SHRINE, BUILDING_SYNAGOGUE, BUILDING_TEMPLE, BUILDING_BAKEHOUSE, BUILDING_CIVIC, BUILDING_FIRE_STATION,
|
||||
BUILDING_GOVERNMENT, BUILDING_HOSPITAL, BUILDING_PUBLIC, BUILDING_TOILETS, BUILDING_TRAIN_STATION, BUILDING_TRANSPORTATION,
|
||||
BUILDING_KINDERGARTEN, BUILDING_SCHOOL, BUILDING_UNIVERSITY
|
||||
|
||||
};
|
||||
*/
|
||||
|
||||
typedef struct sTag
|
||||
{
|
||||
std::string k; // TODO: Should/could be an enum
|
||||
std::string v;
|
||||
} Tag;
|
||||
}
|
|
@ -1,39 +1,29 @@
|
|||
#pragma once
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
#include <util.hpp>
|
||||
#include <osmtag.hpp>
|
||||
#include <osmimember.hpp>
|
||||
|
||||
namespace osmp
|
||||
{
|
||||
class Object;
|
||||
class Node;
|
||||
|
||||
class Way
|
||||
class Way : public IMember
|
||||
{
|
||||
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;
|
||||
const std::vector<std::shared_ptr<Node>>& GetNodes() const;
|
||||
size_t GetNodesSize() const;
|
||||
const Node& GetNode(size_t index) const;
|
||||
const std::shared_ptr<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;
|
||||
bool area, closed; // Closed := Startpoint = endpoint, Area := Closed AND certain conditions are not met
|
||||
|
||||
private:
|
||||
Object* parent;
|
||||
|
||||
std::vector<const Node*> nodes;
|
||||
std::vector<Tag> tags;
|
||||
std::vector<std::shared_ptr<Node>> nodes;
|
||||
};
|
||||
}
|
|
@ -14,12 +14,6 @@ namespace osmp
|
|||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue