/** * Processes the given number of POIs. * * @param mapDataSink the callback which handles the extracted POIs. * @param numberOfPois how many POIs should be processed. * @return true if the POIs could be processed successfully, false otherwise. */ private boolean processPOIs(ITileDataSink mapDataSink, int numberOfPois) { Tag[] poiTags = mTileSource.fileInfo.poiTags; MapElement e = mElem; int numTags = 0; for (int elementCounter = numberOfPois; elementCounter != 0; --elementCounter) { if (mDebugFile) { /* get and check the POI signature */ mSignaturePoi = mReadBuffer.readUTF8EncodedString(SIGNATURE_LENGTH_POI); if (!mSignaturePoi.startsWith("***POIStart")) { log.warn("invalid POI signature: " + mSignaturePoi); log.warn(DEBUG_SIGNATURE_BLOCK + mSignatureBlock); return false; } } /* get the POI latitude offset (VBE-S) */ int latitude = mTileLatitude + mReadBuffer.readSignedInt(); /* get the POI longitude offset (VBE-S) */ int longitude = mTileLongitude + mReadBuffer.readSignedInt(); /* get the special byte which encodes multiple flags */ byte specialByte = mReadBuffer.readByte(); /* bit 1-4 represent the layer */ byte layer = (byte) ((specialByte & POI_LAYER_BITMASK) >>> POI_LAYER_SHIFT); /* bit 5-8 represent the number of tag IDs */ byte numberOfTags = (byte) (specialByte & POI_NUMBER_OF_TAGS_BITMASK); if (numberOfTags != 0) { if (!mReadBuffer.readTags(e.tags, poiTags, numberOfTags)) return false; numTags = numberOfTags; } /* reset to common tag position */ e.tags.numTags = numTags; /* get the feature bitmask (1 byte) */ byte featureByte = mReadBuffer.readByte(); /* bit 1-3 enable optional features * check if the POI has a name */ if ((featureByte & POI_FEATURE_NAME) != 0) { String str = mReadBuffer.readUTF8EncodedString(); e.tags.add(new Tag(Tag.KEY_NAME, str, false)); } /* check if the POI has a house number */ if ((featureByte & POI_FEATURE_HOUSE_NUMBER) != 0) { // mReadBuffer.getPositionAndSkip(); // String str = mReadBuffer.readUTF8EncodedString(); } /* check if the POI has an elevation */ if ((featureByte & POI_FEATURE_ELEVATION) != 0) { mReadBuffer.readSignedInt(); // mReadBuffer.getPositionAndSkip();// tags.add(new // Tag(Tag.TAG_KEY_ELE, // Integer.toString(mReadBuffer.readSignedInt()))); } mTileProjection.projectPoint(latitude, longitude, e); e.setLayer(layer); mapDataSink.process(e); } return true; }