OsmAnd/Osmand-kernel/osmand/src/mapObjects.h

84 lines
1.6 KiB
C
Raw Normal View History

2011-10-29 16:57:27 +02:00
#ifndef _OSMAND_MAP_OBJECTS_H
#define _OSMAND_MAP_OBJECTS_H
2011-10-25 01:10:06 +02:00
#include <vector>
2011-10-29 16:57:27 +02:00
#include <string>
2012-04-30 15:58:02 +02:00
#include <limits.h>
2011-10-25 01:10:06 +02:00
2011-10-28 16:01:00 +02:00
#include "common.h"
2011-10-25 01:10:06 +02:00
2012-04-30 13:33:05 +02:00
typedef pair<std::string, std::string> tag_value;
typedef pair<int, int> int_pair;
typedef vector< pair<int, int> > coordinates;
2011-10-30 00:57:40 +02:00
2011-10-29 16:57:27 +02:00
2012-04-17 23:56:41 +02:00
class MapDataObject
{
static const unsigned int UNDEFINED_STRING = INT_MAX;
2012-04-17 23:56:41 +02:00
public:
2011-10-29 16:57:27 +02:00
2012-04-17 23:56:41 +02:00
std::vector<tag_value> types;
std::vector<tag_value> additionalTypes;
2012-04-28 21:43:14 +02:00
coordinates points;
2012-04-17 23:56:41 +02:00
std::vector < coordinates > polygonInnerCoordinates;
2012-04-30 15:58:02 +02:00
HMAP::hash_map< std::string, unsigned int> stringIds;
2012-04-17 23:56:41 +02:00
2012-04-30 15:58:02 +02:00
HMAP::hash_map< std::string, std::string > objectNames;
2012-04-17 23:56:41 +02:00
bool area;
long long id;
//
bool cycle(){
return points[0] == points[points.size() -1];
}
bool containsAdditional(std::string key, std::string val) {
std::vector<tag_value>::iterator it = additionalTypes.begin();
while (it != additionalTypes.end()) {
if (it->first == key) {
return it->second == val;
}
it++;
}
return false;
}
2012-04-28 18:37:20 +02:00
bool contains(std::string key, std::string val) {
std::vector<tag_value>::iterator it = types.begin();
while (it != types.end()) {
if (it->first == key) {
return it->second == val;
}
it++;
}
return false;
}
2012-04-17 23:56:41 +02:00
int getSimpleLayer() {
std::vector<tag_value>::iterator it = additionalTypes.begin();
while (it != additionalTypes.end()) {
if (it->first == "layer") {
if(it->second.length() > 0) {
if(it->second[0] == '-'){
return -1;
} else {
return 0;
}
} else {
return 0;
}
}
it++;
}
return 0;
}
2011-10-29 16:57:27 +02:00
};
2011-10-25 01:10:06 +02:00
2012-04-17 23:56:41 +02:00
void deleteObjects(std::vector <MapDataObject* > & v);
2011-10-25 01:10:06 +02:00
2011-10-30 00:57:40 +02:00
2011-10-29 16:57:27 +02:00
#endif /*_OSMAND_MAP_OBJECTS_H*/