@@ -0,0 +1,1656 @@
+package com.nutiteq.advancedmap3.datasource;%0A%0Aimport android.graphics.Bitmap;%0Aimport android.graphics.BitmapFactory;%0A%0Aimport com.nutiteq.core.MapTile;%0Aimport com.nutiteq.core.TileData;%0Aimport com.nutiteq.datasources.HTTPTileDataSource;%0Aimport com.nutiteq.utils.BitmapUtils;%0Aimport com.nutiteq.utils.Log;%0Aimport com.nutiteq.wrappedcommons.UnsignedCharVector;%0A%0Aimport java.io.BufferedInputStream;%0Aimport java.io.BufferedReader;%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.io.InputStreamReader;%0Aimport java.net.URL;%0A%0A/**%0A * A minimal custom vector tile data source which uses app-level HTTP requests%0A * It supports e.g. HTTPS%0A */%0Apublic class MyVectorHttpTileDataSource extends HTTPTileDataSource %7B%0A%0A%09public MyVectorHttpTileDataSource(int minZoom, int maxZoom, String baseURL) %7B%0A%09%09super(minZoom, maxZoom, baseURL);%0A%09%7D%0A%0A%09public TileData loadTile(MapTile tile) %7B%0A%0A%09%09String urlString = super.buildTileUrl(tile);%0A%0A        Log.debug(%22requesting tile: %22+urlString);%0A%0A        try %7B%0A            URL url = new URL(urlString);%0A            UnsignedCharVector tileBinary = new UnsignedCharVector();%0A%0A            InputStream is = url.openConnection().getInputStream();%0A%0A            byte%5B%5D buffer = new byte%5B4096%5D;%0A            int n;%0A            int len = 0;%0A            while ((n = is.read(buffer)) != -1) %7B%0A                for(int i=0;i%3Cn;i++)%7B%0A                    tileBinary.add(buffer%5Bi%5D);%0A                %7D%0A                len+=n;%0A            %7D%0A            Log.debug(%22loaded bytes %22 + len);%0A            return new TileData(tileBinary);%0A%0A        %7D catch (IOException e) %7B%0A            e.printStackTrace();%0A            return null;%0A        %7D%0A%09%7D%0A%7D%0A

add custom datasource for vector tile