void OsmMapIndex::postGeometryChange(Element* e) { if (e->getElementType() == ElementType::Way) { addWay(_map.getWay(e->getId())); } if (_nodeToWayMap != 0) { VALIDATE(_nodeToWayMap->validate(_map)); } if (_elementToRelationMap != 0) { // add all the relations that were impacted back into the index. for (set<long>::iterator it = _pendingRelationChange.begin(); it != _pendingRelationChange.end(); ++it) { _elementToRelationMap->addRelation(_map, _map.getRelation(*it)); } _pendingRelationChange.clear(); VALIDATE(_elementToRelationMap->validate(_map)); } }
void OsmDataManager::load(const QString filename){ QFile file(filename); if(!file.open(QIODevice::ReadOnly)) { QMessageBox::information(0, "error", file.errorString()); return; } QXmlStreamReader xml(&file); if(xml.readNextStartElement()){ if(xml.name() == "osm"){ while(xml.readNextStartElement()){ QString name = xml.name().toString(); if(name == "bounds"){ xllcorner = xml.attributes().value("minlon").toFloat(); yllcorner = xml.attributes().value("minlat").toFloat(); xurcorner = xml.attributes().value("maxlon").toFloat(); yurcorner = xml.attributes().value("maxlat").toFloat(); xml.skipCurrentElement(); } else if(name == "node"){ addNode(xml); } else if(name == "way"){ addWay(xml); } else{ xml.skipCurrentElement(); } } } } xml.clear(); file.close(); generateGrid(); }