Exemplo n.º 1
0
 void handle(OsmNode& osmNode, XmapTree& xmapTree) {
     auto& tagMap = osmNode.getTagMap();
     const Symbol symbol = Main::rules.groupList.getSymbol(tagMap, ElemType::node);
     //info("sym id %d",id);
     Coords coords = osmNode.getCoords();
     coords = Main::transform.geographicToMap(coords);
     int id = symbol.Id();
     if (id != invalid_sym_id) {
         xmapTree.add(id, tagMap, coords);
     }
     int textId = symbol.TextId();
     if (textId != invalid_sym_id) {
         const std::string text = osmNode.getName();
         if (!text.empty()) {
             xmapTree.add(textId, tagMap, coords, text.c_str());
         }
     }
 }
Exemplo n.º 2
0
 void handle(OsmRelation& osmRelation, XmapTree& xmapTree) {
     if (!osmRelation.isMultipolygon()) {
         return;
     }
     auto& tagMap = osmRelation.getTagMap();
     const Symbol symbol = Main::rules.groupList.getSymbol(tagMap, ElemType::area);
     XmapWay way = xmapTree.add(symbol.Id(), tagMap);
     OsmMemberList memberList = osmRelation;
     OsmWay& osmWay = memberList.front();
     Coords lastCoords = addCoordsToWay(way,symbol,osmWay);
     memberList.pop_front();
     ///TODO check member role
     while (!memberList.empty()) {
         bool found = false;
         bool reverse = false;
         OsmMemberList::iterator iterator;
         for (auto it = memberList.begin();
              it != memberList.end();
              ++it) {
             iterator = it;
             if (lastCoords == iterator->getFirstCoords()) {
                 found = true;
                 reverse = false;
                 break;
             }
             if (lastCoords == iterator->getLastCoords()) {
                 found = true;
                 reverse = true;
                 break;
             }
         }
         if (found) {
             lastCoords = addCoordsToWay(way,symbol,*iterator,reverse);
             memberList.erase(iterator);
         }
         else {
             way.completeMultipolygonPart();
             OsmWay& osmWay = memberList.front();
             lastCoords = addCoordsToWay(way,symbol,osmWay);
             memberList.pop_front();
         }
     }
 }
Exemplo n.º 3
0
 void handle(OsmWay& osmWay, XmapTree& xmapTree) {
     auto& tagMap = osmWay.getTagMap();
     const Symbol symbol = Main::rules.groupList.getSymbol(tagMap, ElemType::way);
     XmapWay way = xmapTree.add(symbol.Id(), tagMap);
     addCoordsToWay(way,symbol,osmWay);
 }