Refactor amenity structure

This commit is contained in:
vshcherb 2013-11-10 16:54:28 +01:00
parent 635ed66e16
commit 119623e98a
3 changed files with 41 additions and 15 deletions

View file

@ -1280,8 +1280,8 @@ public class BinaryMapIndexReader {
poiAdapter.searchPoiIndex(req.left, req.right, req.top, req.bottom, req, poiIndex);
codedIS.popLimit(old);
log.info("Read " + req.numberOfReadSubtrees + " subtrees. Go through " + req.numberOfAcceptedSubtrees + " subtrees."); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
log.info("Search poi is done. Visit " + req.numberOfVisitedObjects + " objects. Read " + req.numberOfAcceptedObjects + " objects."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
log.info("Read " + req.numberOfReadSubtrees + " subtrees. Go through " + req.numberOfAcceptedSubtrees + " subtrees."); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
return req.getSearchResults();
}

View file

@ -1,15 +1,18 @@
package net.osmand.data;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
public class Amenity extends MapObject {
private static final long serialVersionUID = 132083949926339552L;
private String subType;
private AmenityType type;
// duplicate for fast access
private String openingHours;
private String phone;
private String description;
private String site;
private Map<String, String> additionalInfo;
public Amenity(){
}
@ -31,13 +34,40 @@ public class Amenity extends MapObject {
}
public String getOpeningHours() {
// getAdditionalInfo("opening_hours");
return openingHours;
}
public void setOpeningHours(String openingHours) {
setAdditionalInfo("opening_hours", openingHours);
this.openingHours = openingHours;
}
public String getAdditionalInfo(String key){
if(additionalInfo == null) {
return null;
}
return additionalInfo.get(key);
}
public Map<String, String> getAdditionalInfo() {
if(additionalInfo == null) {
return Collections.emptyMap();
}
return additionalInfo;
}
public void setAdditionalInfo(Map<String, String> additionalInfo) {
this.additionalInfo = additionalInfo;
}
public void setAdditionalInfo(String tag, String value) {
if(this.additionalInfo == null){
this.additionalInfo = new LinkedHashMap<String, String>();
}
setAdditionalInfo(tag, value);
}
@Override
public String toString() {
@ -45,27 +75,27 @@ public class Amenity extends MapObject {
}
public String getSite() {
return site;
return getAdditionalInfo("website");
}
public void setSite(String site) {
this.site = site;
setAdditionalInfo("website", site);
}
public String getPhone() {
return phone;
return getAdditionalInfo("phone");
}
public void setPhone(String phone) {
this.phone = phone;
setAdditionalInfo("phone", phone);
}
public String getDescription() {
return description;
return getAdditionalInfo("description");
}
public void setDescription(String description) {
this.description = description;
setAdditionalInfo("description", description);
}

View file

@ -8,14 +8,12 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import net.osmand.PlatformUtil;
import net.osmand.NativeLibrary;
import net.osmand.PlatformUtil;
import net.osmand.binary.BinaryMapIndexReader;
import net.osmand.data.LatLon;
import net.osmand.router.BinaryRoutePlanner.FinalRouteSegment;
@ -25,8 +23,6 @@ import net.osmand.router.RoutingConfiguration.Builder;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import com.ibm.icu.text.DateFormat;
public class TestRouting {
public static int MEMORY_TEST_LIMIT = 800;