vtm-mvt module with new MVT tile decoder (#481)

This commit is contained in:
Robin
2018-01-12 10:02:04 +11:00
committed by Emux
parent 5093f292ba
commit d049d378dd
15 changed files with 484 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ apply plugin: 'java'
dependencies {
implementation project(':vtm-http')
implementation project(':vtm-mvt')
testImplementation 'com.squareup.okhttp3:mockwebserver:3.8.0'
testImplementation 'junit:junit:4.12'
testImplementation 'org.easytesting:fest-assert-core:2.0M10'

Binary file not shown.

View File

@@ -0,0 +1,52 @@
/*
* Copyright 2018 boldtrn
* Copyright 2018 devemux86
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.tiling.source.mvt;
import org.junit.Test;
import org.oscim.backend.canvas.Bitmap;
import org.oscim.core.MapElement;
import org.oscim.core.Tile;
import org.oscim.tiling.ITileDataSink;
import org.oscim.tiling.QueryResult;
import static org.junit.Assert.assertEquals;
public class MvtTileDecoderTest {
@Test
public void tileDecodingTest() throws Exception {
MvtTileDecoder decoder = new MvtTileDecoder();
Tile tile = new Tile(0, 0, (byte) 0);
ITileDataSink sink = new ITileDataSink() {
@Override
public void process(MapElement element) {
if (element.tags.contains("class", "ocean"))
assertEquals(4, element.getNumPoints());
if (element.tags.contains("layer", "water_name"))
assertEquals("Irish Sea", element.tags.getValue("name"));
}
@Override
public void setTileImage(Bitmap bitmap) {
}
@Override
public void completed(QueryResult result) {
}
};
decoder.decode(tile, sink, getClass().getResourceAsStream("/mvt-test.pbf"));
}
}