Search in sources :

Example 1 with PoiSubType

use of net.osmand.binary.BinaryMapPoiReaderAdapter.PoiSubType in project Osmand by osmandapp.

the class BinaryInspector method printPOIDetailInfo.

private void printPOIDetailInfo(VerboseInfo verbose, BinaryMapIndexReader index, PoiRegion p) throws IOException {
    SearchRequest<Amenity> req = BinaryMapIndexReader.buildSearchPoiRequest(MapUtils.get31TileNumberX(verbose.lonleft), MapUtils.get31TileNumberX(verbose.lonright), MapUtils.get31TileNumberY(verbose.lattop), MapUtils.get31TileNumberY(verbose.latbottom), verbose.getZoom(), BinaryMapIndexReader.ACCEPT_ALL_POI_TYPE_FILTER, new ResultMatcher<Amenity>() {

        @Override
        public boolean publish(Amenity object) {
            Iterator<Entry<String, String>> it = object.getAdditionalInfo().entrySet().iterator();
            String s = "";
            while (it.hasNext()) {
                Entry<String, String> e = it.next();
                if (e.getValue().startsWith(" gz ")) {
                    s += " " + e.getKey() + "=...";
                } else {
                    s += " " + e.getKey() + "=" + e.getValue();
                }
            }
            println(object.getType().getKeyName() + ": " + object.getSubType() + " " + object.getName() + " " + object.getLocation() + " osmid=" + (object.getId() >> 1) + " " + s);
            return false;
        }

        @Override
        public boolean isCancelled() {
            return false;
        }
    });
    index.initCategories(p);
    println("\tRegion: " + p.name);
    println("\t\tBounds " + formatLatBounds(MapUtils.get31LongitudeX(p.left31), MapUtils.get31LongitudeX(p.right31), MapUtils.get31LatitudeY(p.top31), MapUtils.get31LatitudeY(p.bottom31)));
    println("\t\tCategories:");
    for (int i = 0; i < p.categories.size(); i++) {
        println("\t\t\t" + p.categories.get(i));
        for (int j = 0; j < p.subcategories.get(i).size(); j++) println("\t\t\t\t" + p.subcategories.get(i).get(j));
    }
    println("\t\tSubtypes:");
    for (int i = 0; i < p.subTypes.size(); i++) {
        PoiSubType st = p.subTypes.get(i);
        println("\t\t\t" + st.name + " " + (st.text ? "text" : (" encoded " + st.possibleValues.size())));
    }
    // req.poiTypeFilter = null;//for test only
    index.searchPoi(p, req);
}
Also used : Amenity(net.osmand.data.Amenity) Entry(java.util.Map.Entry) PoiSubType(net.osmand.binary.BinaryMapPoiReaderAdapter.PoiSubType) TLongIterator(gnu.trove.iterator.TLongIterator) Iterator(java.util.Iterator) TIntObjectIterator(gnu.trove.iterator.TIntObjectIterator)

Aggregations

TIntObjectIterator (gnu.trove.iterator.TIntObjectIterator)1 TLongIterator (gnu.trove.iterator.TLongIterator)1 Iterator (java.util.Iterator)1 Entry (java.util.Map.Entry)1 PoiSubType (net.osmand.binary.BinaryMapPoiReaderAdapter.PoiSubType)1 Amenity (net.osmand.data.Amenity)1