Browse Source

Skeleton for performing search

develop^2
LO Kam Tao Leo 3 years ago
parent
commit
6fd5e347fa
  1. 16
      src/main/java/org/leolo/map/osm/extract/model/ActionFile.java
  2. 32
      src/main/java/org/leolo/map/osm/extract/model/SearchItem.java

16
src/main/java/org/leolo/map/osm/extract/model/ActionFile.java

@ -24,6 +24,10 @@ public class ActionFile {
private Map<Long,ExtractItem> way = new Hashtable<>();
private Map<Long,ExtractItem> node = new Hashtable<>();
private String baseLanguage;
private HashSet<String> otherLanguage = new HashSet<>();
public ActionFile(InputFile path) throws IOException, SAXException, ParserConfigurationException {
log.atInfo().log("Parsing action file");
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
@ -86,6 +90,18 @@ public class ActionFile {
continue;
}
}
NodeList languages = rootElement.getElementsByTagName("language");
if(languages.getLength()>0){
NodeList children = languages.item(0).getChildNodes();
for(int i=0;i<children.getLength();i++) {
Node child = children.item(i);
if("base".equals(child.getNodeName())){
this.baseLanguage = child.getTextContent();
}else if("other".equals(child.getNodeName())){
this.otherLanguage.add(child.getTextContent());
}
}
}
}

32
src/main/java/org/leolo/map/osm/extract/model/SearchItem.java

@ -0,0 +1,32 @@
package org.leolo.map.osm.extract.model;
import de.topobyte.osm4j.core.model.iface.OsmNode;
import de.topobyte.osm4j.core.model.iface.OsmRelation;
import de.topobyte.osm4j.core.model.iface.OsmWay;
public abstract class SearchItem {
private ActionFile af;
public SearchItem(ActionFile af){
this.af = af;
}
public SearchItem(){
//Empty constructor
}
protected abstract boolean matchString(String target);
public boolean matchNode(OsmNode node){
return false;
}
public boolean matchWay(OsmWay way){
return false;
}
public boolean matchRelation(OsmRelation relation){
return false;
}
}
Loading…
Cancel
Save