プログレス。。。
This commit is contained in:
parent
19a188e059
commit
fe87e22b16
14 changed files with 271 additions and 179 deletions
|
@ -40,7 +40,7 @@ namespace osmp
|
|||
// std::map<std::string, std::string> tags;
|
||||
|
||||
public:
|
||||
unsigned int id;
|
||||
uint64_t id;
|
||||
std::string user;
|
||||
unsigned int uid;
|
||||
bool visible;
|
||||
|
|
|
@ -15,6 +15,6 @@ namespace osmp
|
|||
Node(const tinyxml2::XMLElement* xml, Object* parent);
|
||||
|
||||
public:
|
||||
float lat, lon;
|
||||
double lat, lon;
|
||||
};
|
||||
}
|
|
@ -20,15 +20,15 @@ namespace osmp
|
|||
|
||||
std::vector<std::shared_ptr<Node>> GetNodes() const;
|
||||
size_t GetNodesSize() const;
|
||||
std::shared_ptr<Node> GetNode(unsigned int id) const;
|
||||
std::shared_ptr<Node> GetNode(uint64_t id) const;
|
||||
|
||||
std::vector<std::shared_ptr<Way>> GetWays() const;
|
||||
size_t GetWaysSize() const;
|
||||
std::shared_ptr<Way> GetWay(unsigned int id) const;
|
||||
std::shared_ptr<Way> GetWay(uint64_t id) const;
|
||||
|
||||
std::vector<std::shared_ptr<Relation>> GetRelations() const;
|
||||
size_t GetRelationsSize() const;
|
||||
std::shared_ptr<Relation> GetRelation(unsigned int id) const;
|
||||
std::shared_ptr<Relation> GetRelation(uint64_t id) const;
|
||||
|
||||
public:
|
||||
const std::string version;
|
||||
|
@ -37,8 +37,8 @@ namespace osmp
|
|||
Bounds bounds;
|
||||
|
||||
private:
|
||||
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;
|
||||
std::map<uint64_t, std::shared_ptr<Node>> nodes;
|
||||
std::map<uint64_t, std::shared_ptr<Way>> ways;
|
||||
std::map<uint64_t, std::shared_ptr<Relation>> relations;
|
||||
};
|
||||
}
|
|
@ -11,11 +11,11 @@ namespace osmp
|
|||
{
|
||||
typedef struct sBounds
|
||||
{
|
||||
float minlat, minlon, maxlat, maxlon;
|
||||
double minlat, minlon, maxlat, maxlon;
|
||||
} Bounds;
|
||||
|
||||
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);
|
||||
double GetSafeAttributeFloat(const tinyxml2::XMLElement* elem, const std::string& name);
|
||||
uint64_t GetSafeAttributeUint64(const tinyxml2::XMLElement* elem, const std::string& name);
|
||||
bool GetSafeAttributeBool(const tinyxml2::XMLElement* elem, const std::string& name);
|
||||
}
|
|
@ -11,12 +11,12 @@ namespace osmp
|
|||
type(type), parent(parent)
|
||||
{
|
||||
// Get Attribute
|
||||
id = GetSafeAttributeUint(element, "id");
|
||||
id = GetSafeAttributeUint64(element, "id");
|
||||
user = GetSafeAttributeString(element, "user");
|
||||
uid = GetSafeAttributeUint(element, "uid");
|
||||
uid = GetSafeAttributeUint64(element, "uid");
|
||||
visible = GetSafeAttributeBool(element, "visible");
|
||||
version = GetSafeAttributeString(element, "version");
|
||||
changeset = GetSafeAttributeUint(element, "changeset");
|
||||
changeset = GetSafeAttributeUint64(element, "changeset");
|
||||
timestamp = GetSafeAttributeString(element, "timestamp");
|
||||
|
||||
const xml::XMLElement* tag_element = element->FirstChildElement("tag");
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace osmp
|
|||
std::vector<std::shared_ptr<Node>> Object::GetNodes() const
|
||||
{
|
||||
std::vector<std::shared_ptr<Node>> vecNodes;
|
||||
for (std::map<unsigned int, std::shared_ptr<Node>>::const_iterator it = nodes.begin(); it != nodes.end(); it++)
|
||||
for (std::map<uint64_t, std::shared_ptr<Node>>::const_iterator it = nodes.begin(); it != nodes.end(); it++)
|
||||
vecNodes.push_back(it->second);
|
||||
|
||||
return vecNodes;
|
||||
|
@ -85,9 +85,9 @@ namespace osmp
|
|||
return nodes.size();
|
||||
}
|
||||
|
||||
std::shared_ptr<Node> Object::GetNode(unsigned int id) const
|
||||
std::shared_ptr<Node> Object::GetNode(uint64_t id) const
|
||||
{
|
||||
std::map<unsigned int, std::shared_ptr<Node>>::const_iterator node = nodes.find(id);
|
||||
std::map<uint64_t, std::shared_ptr<Node>>::const_iterator node = nodes.find(id);
|
||||
if (node != nodes.end())
|
||||
return node->second;
|
||||
|
||||
|
@ -97,7 +97,7 @@ namespace osmp
|
|||
std::vector<std::shared_ptr<Way>> Object::GetWays() const
|
||||
{
|
||||
std::vector<std::shared_ptr<Way>> vecWays;
|
||||
for (std::map<unsigned int, std::shared_ptr<Way>>::const_iterator it = ways.begin(); it != ways.end(); it++)
|
||||
for (std::map<uint64_t, std::shared_ptr<Way>>::const_iterator it = ways.begin(); it != ways.end(); it++)
|
||||
vecWays.push_back(it->second);
|
||||
|
||||
return vecWays;
|
||||
|
@ -108,9 +108,9 @@ namespace osmp
|
|||
return ways.size();
|
||||
}
|
||||
|
||||
std::shared_ptr<Way> Object::GetWay(unsigned int id) const
|
||||
std::shared_ptr<Way> Object::GetWay(uint64_t id) const
|
||||
{
|
||||
std::map<unsigned int, std::shared_ptr<Way>>::const_iterator way = ways.find(id);
|
||||
std::map<uint64_t, std::shared_ptr<Way>>::const_iterator way = ways.find(id);
|
||||
if (way != ways.end())
|
||||
return way->second;
|
||||
|
||||
|
@ -120,7 +120,7 @@ namespace osmp
|
|||
std::vector<std::shared_ptr<Relation>> Object::GetRelations() const
|
||||
{
|
||||
std::vector<std::shared_ptr<Relation>> vecRelations;
|
||||
for (std::map<unsigned int, std::shared_ptr<Relation>>::const_iterator it = relations.begin(); it != relations.end(); it++)
|
||||
for (std::map<uint64_t, std::shared_ptr<Relation>>::const_iterator it = relations.begin(); it != relations.end(); it++)
|
||||
vecRelations.push_back(it->second);
|
||||
|
||||
return vecRelations;
|
||||
|
@ -131,9 +131,9 @@ namespace osmp
|
|||
return relations.size();
|
||||
}
|
||||
|
||||
std::shared_ptr<Relation> Object::GetRelation(unsigned int id) const
|
||||
std::shared_ptr<Relation> Object::GetRelation(uint64_t id) const
|
||||
{
|
||||
std::map<unsigned int, std::shared_ptr<Relation>>::const_iterator relation = relations.find(id);
|
||||
std::map<uint64_t, std::shared_ptr<Relation>>::const_iterator relation = relations.find(id);
|
||||
if (relation != relations.end())
|
||||
return relation->second;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace osmp
|
|||
while (member_element != nullptr)
|
||||
{
|
||||
std::string memberType = GetSafeAttributeString(member_element, "type");
|
||||
unsigned int ref = GetSafeAttributeUint(member_element, "ref");
|
||||
uint64_t ref = GetSafeAttributeUint64(member_element, "ref");
|
||||
std::string role = GetSafeAttributeString(member_element, "role");
|
||||
|
||||
std::shared_ptr<IMember> member = nullptr;
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace osmp
|
|||
while (nd_elem != nullptr)
|
||||
{
|
||||
nodes.push_back(
|
||||
parent->GetNode(GetSafeAttributeUint(nd_elem, "ref"))
|
||||
parent->GetNode(GetSafeAttributeUint64(nd_elem, "ref"))
|
||||
);
|
||||
|
||||
nd_elem = nd_elem->NextSiblingElement("nd");
|
||||
|
|
|
@ -21,21 +21,20 @@ namespace osmp
|
|||
return returnStr;
|
||||
}
|
||||
|
||||
float GetSafeAttributeFloat(const tinyxml2::XMLElement* elem, const std::string& name)
|
||||
double GetSafeAttributeFloat(const tinyxml2::XMLElement* elem, const std::string& name)
|
||||
{
|
||||
float returnVal = 0.0f;
|
||||
double returnVal = 0.0f;
|
||||
|
||||
xml::XMLError result = elem->QueryFloatAttribute(name.c_str(), &returnVal);
|
||||
xml::XMLError result = elem->QueryDoubleAttribute(name.c_str(), &returnVal);
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
unsigned int GetSafeAttributeUint(const tinyxml2::XMLElement* elem, const std::string& name)
|
||||
uint64_t GetSafeAttributeUint64(const tinyxml2::XMLElement* elem, const std::string& name)
|
||||
{
|
||||
unsigned int returnVal = 0;
|
||||
|
||||
xml::XMLError result = elem->QueryUnsignedAttribute(name.c_str(), &returnVal);
|
||||
uint64_t returnVal = 0;
|
||||
|
||||
xml::XMLError result = elem->QueryUnsigned64Attribute(name.c_str(), &returnVal);
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue