-
Notifications
You must be signed in to change notification settings - Fork 0
/
parse_svg.h
40 lines (31 loc) · 872 Bytes
/
parse_svg.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#if !defined __BAH_PARSE_SVG_H__
#define __BAH_PARSE_SVG_H__
#include "TouchPolygon.h"
#include <vector>
#include <string>
#include <map>
class Key {
public:
Key() : _keys() { }
Key(const std::vector<TouchPolygon::Polygon> & v) : _keys(v) { }
void addPolygon(const TouchPolygon::Polygon & poly)
{
_keys.push_back(poly);
}
bool contains(const TouchPolygon::Point & p) const
{
for (std::vector<TouchPolygon::Polygon>::const_iterator poly =
_keys.begin(); poly != _keys.end(); ++poly) {
if (poly->contains(p)) {
return true;
}
}
return false;
}
size_t polygonCount() const { return _keys.size(); }
private:
std::vector<TouchPolygon::Polygon> _keys;
};
extern std::map<std::string, Key> keys;
void initKeys(void); // Sets up the above map.
#endif