Search in sources :

Example 1 with TransportPart

use of net.osmand.binary.OsmandIndex.TransportPart in project Osmand by osmandapp.

the class CachedOsmandIndexes method initFileIndex.

private BinaryMapIndexReader initFileIndex(FileIndex found, RandomAccessFile mf, File f) throws IOException {
    BinaryMapIndexReader reader = new BinaryMapIndexReader(mf, f, false);
    reader.version = found.getVersion();
    reader.dateCreated = found.getDateModified();
    for (MapPart index : found.getMapIndexList()) {
        MapIndex mi = new MapIndex();
        mi.length = (int) index.getSize();
        mi.filePointer = (int) index.getOffset();
        mi.name = index.getName();
        for (MapLevel mr : index.getLevelsList()) {
            MapRoot root = new MapRoot();
            root.length = (int) mr.getSize();
            root.filePointer = (int) mr.getOffset();
            root.left = mr.getLeft();
            root.right = mr.getRight();
            root.top = mr.getTop();
            root.bottom = mr.getBottom();
            root.minZoom = mr.getMinzoom();
            root.maxZoom = mr.getMaxzoom();
            mi.roots.add(root);
        }
        reader.mapIndexes.add(mi);
        reader.indexes.add(mi);
        reader.basemap = reader.basemap || mi.isBaseMap();
    }
    for (AddressPart index : found.getAddressIndexList()) {
        AddressRegion mi = new AddressRegion();
        mi.length = (int) index.getSize();
        mi.filePointer = (int) index.getOffset();
        mi.name = index.getName();
        mi.enName = index.getNameEn();
        mi.indexNameOffset = index.getIndexNameOffset();
        for (CityBlock mr : index.getCitiesList()) {
            CitiesBlock cblock = new CitiesBlock();
            cblock.length = (int) mr.getSize();
            cblock.filePointer = (int) mr.getOffset();
            cblock.type = mr.getType();
            mi.cities.add(cblock);
        }
        for (String s : index.getAdditionalTagsList()) {
            mi.attributeTagsTable.add(s);
        }
        reader.addressIndexes.add(mi);
        reader.indexes.add(mi);
    }
    for (PoiPart index : found.getPoiIndexList()) {
        PoiRegion mi = new PoiRegion();
        mi.length = (int) index.getSize();
        mi.filePointer = (int) index.getOffset();
        mi.name = index.getName();
        mi.left31 = index.getLeft();
        mi.right31 = index.getRight();
        mi.top31 = index.getTop();
        mi.bottom31 = index.getBottom();
        reader.poiIndexes.add(mi);
        reader.indexes.add(mi);
    }
    for (TransportPart index : found.getTransportIndexList()) {
        TransportIndex mi = new TransportIndex();
        mi.length = (int) index.getSize();
        mi.filePointer = (int) index.getOffset();
        mi.name = index.getName();
        mi.left = index.getLeft();
        mi.right = index.getRight();
        mi.top = index.getTop();
        mi.bottom = index.getBottom();
        mi.stopsFileLength = index.getStopsTableLength();
        mi.stopsFileOffset = index.getStopsTableOffset();
        mi.stringTable = new IndexStringTable();
        mi.stringTable.fileOffset = index.getStringTableOffset();
        mi.stringTable.length = index.getStringTableLength();
        reader.transportIndexes.add(mi);
        reader.indexes.add(mi);
    }
    for (RoutingPart index : found.getRoutingIndexList()) {
        RouteRegion mi = new RouteRegion();
        mi.length = (int) index.getSize();
        mi.filePointer = (int) index.getOffset();
        mi.name = index.getName();
        for (RoutingSubregion mr : index.getSubregionsList()) {
            RouteSubregion sub = new RouteSubregion(mi);
            sub.length = (int) mr.getSize();
            sub.filePointer = (int) mr.getOffset();
            sub.left = mr.getLeft();
            sub.right = mr.getRight();
            sub.top = mr.getTop();
            sub.bottom = mr.getBottom();
            sub.shiftToData = mr.getShifToData();
            if (mr.getBasemap()) {
                mi.basesubregions.add(sub);
            } else {
                mi.subregions.add(sub);
            }
        }
        reader.routingIndexes.add(mi);
        reader.indexes.add(mi);
    }
    return reader;
}
Also used : RouteSubregion(net.osmand.binary.BinaryMapRouteReaderAdapter.RouteSubregion) CityBlock(net.osmand.binary.OsmandIndex.CityBlock) RoutingPart(net.osmand.binary.OsmandIndex.RoutingPart) RoutingSubregion(net.osmand.binary.OsmandIndex.RoutingSubregion) MapRoot(net.osmand.binary.BinaryMapIndexReader.MapRoot) TransportPart(net.osmand.binary.OsmandIndex.TransportPart) IndexStringTable(net.osmand.binary.BinaryMapTransportReaderAdapter.IndexStringTable) PoiPart(net.osmand.binary.OsmandIndex.PoiPart) AddressPart(net.osmand.binary.OsmandIndex.AddressPart) RouteRegion(net.osmand.binary.BinaryMapRouteReaderAdapter.RouteRegion) MapPart(net.osmand.binary.OsmandIndex.MapPart) MapIndex(net.osmand.binary.BinaryMapIndexReader.MapIndex) CitiesBlock(net.osmand.binary.BinaryMapAddressReaderAdapter.CitiesBlock) MapLevel(net.osmand.binary.OsmandIndex.MapLevel) AddressRegion(net.osmand.binary.BinaryMapAddressReaderAdapter.AddressRegion) TransportIndex(net.osmand.binary.BinaryMapTransportReaderAdapter.TransportIndex) PoiRegion(net.osmand.binary.BinaryMapPoiReaderAdapter.PoiRegion)

Aggregations

AddressRegion (net.osmand.binary.BinaryMapAddressReaderAdapter.AddressRegion)1 CitiesBlock (net.osmand.binary.BinaryMapAddressReaderAdapter.CitiesBlock)1 MapIndex (net.osmand.binary.BinaryMapIndexReader.MapIndex)1 MapRoot (net.osmand.binary.BinaryMapIndexReader.MapRoot)1 PoiRegion (net.osmand.binary.BinaryMapPoiReaderAdapter.PoiRegion)1 RouteRegion (net.osmand.binary.BinaryMapRouteReaderAdapter.RouteRegion)1 RouteSubregion (net.osmand.binary.BinaryMapRouteReaderAdapter.RouteSubregion)1 IndexStringTable (net.osmand.binary.BinaryMapTransportReaderAdapter.IndexStringTable)1 TransportIndex (net.osmand.binary.BinaryMapTransportReaderAdapter.TransportIndex)1 AddressPart (net.osmand.binary.OsmandIndex.AddressPart)1 CityBlock (net.osmand.binary.OsmandIndex.CityBlock)1 MapLevel (net.osmand.binary.OsmandIndex.MapLevel)1 MapPart (net.osmand.binary.OsmandIndex.MapPart)1 PoiPart (net.osmand.binary.OsmandIndex.PoiPart)1 RoutingPart (net.osmand.binary.OsmandIndex.RoutingPart)1 RoutingSubregion (net.osmand.binary.OsmandIndex.RoutingSubregion)1 TransportPart (net.osmand.binary.OsmandIndex.TransportPart)1