API: remove TileSource.getMapInfo(), cleanups
- move MapInfo to mapfile package
This commit is contained in:
parent
1738bfd0bc
commit
1421a1f6b6
@ -21,7 +21,6 @@ import org.oscim.backend.Log;
|
||||
import org.oscim.tiling.MapTile;
|
||||
import org.oscim.tiling.source.ITileDataSink;
|
||||
import org.oscim.tiling.source.ITileDataSource;
|
||||
import org.oscim.tiling.source.ITileDataSource.QueryResult;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@ -15,15 +15,12 @@
|
||||
package org.oscim.layers.tile.vector;
|
||||
|
||||
import org.oscim.backend.Log;
|
||||
import org.oscim.core.GeoPoint;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.layers.tile.TileLayer;
|
||||
import org.oscim.map.Map;
|
||||
import org.oscim.theme.IRenderTheme;
|
||||
import org.oscim.tiling.TileLoader;
|
||||
import org.oscim.tiling.TileManager;
|
||||
import org.oscim.tiling.source.ITileDataSource;
|
||||
import org.oscim.tiling.source.MapInfo;
|
||||
import org.oscim.tiling.source.TileSource;
|
||||
import org.oscim.tiling.source.TileSource.OpenResult;
|
||||
|
||||
@ -76,7 +73,7 @@ public class VectorTileLayer extends TileLayer<VectorTileLoader> {
|
||||
mTileLoader.get(i).setTileDataSource(tileDataSource);
|
||||
}
|
||||
|
||||
mTileManager.setZoomTable(mTileSource.getMapInfo().zoomLevel);
|
||||
//mTileManager.setZoomTable(mTileSource.getMapInfo().zoomLevel);
|
||||
|
||||
mMap.clearMap();
|
||||
|
||||
@ -96,35 +93,4 @@ public class VectorTileLayer extends TileLayer<VectorTileLoader> {
|
||||
|
||||
resumeLoaders();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public MapPosition getMapFileCenter() {
|
||||
if (mTileSource == null)
|
||||
return null;
|
||||
|
||||
MapInfo mapInfo = mTileSource.getMapInfo();
|
||||
if (mapInfo == null)
|
||||
return null;
|
||||
|
||||
GeoPoint startPos = mapInfo.startPosition;
|
||||
|
||||
if (startPos == null)
|
||||
startPos = mapInfo.mapCenter;
|
||||
|
||||
if (startPos == null)
|
||||
startPos = new GeoPoint(0, 0);
|
||||
|
||||
MapPosition mapPosition = new MapPosition();
|
||||
mapPosition.setPosition(startPos);
|
||||
|
||||
if (mapInfo.startZoomLevel == null)
|
||||
mapPosition.setZoomLevel(2);
|
||||
else
|
||||
mapPosition.setZoomLevel((mapInfo.startZoomLevel).byteValue());
|
||||
|
||||
return mapPosition;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -19,27 +19,21 @@ import java.util.HashMap;
|
||||
public abstract class TileSource {
|
||||
|
||||
public abstract ITileDataSource getDataSource();
|
||||
|
||||
public abstract OpenResult open();
|
||||
|
||||
public abstract void close();
|
||||
|
||||
protected final Options options = new Options();
|
||||
|
||||
public void setOption(String key, String value){
|
||||
public void setOption(String key, String value) {
|
||||
options.put(key, value);
|
||||
}
|
||||
|
||||
public String getOption(String key){
|
||||
public String getOption(String key) {
|
||||
return options.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the metadata for the current map file.
|
||||
* @throws IllegalStateException
|
||||
* if no map is currently opened.
|
||||
*/
|
||||
public abstract MapInfo getMapInfo();
|
||||
|
||||
|
||||
public static class Options extends HashMap<String, String> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ -59,6 +53,7 @@ public abstract class TileSource {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A FileOpenResult is a simple DTO which is returned by
|
||||
* IMapDatabase#open().
|
||||
|
||||
@ -17,20 +17,11 @@ package org.oscim.tiling.source.common;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
import org.oscim.core.BoundingBox;
|
||||
import org.oscim.core.GeoPoint;
|
||||
import org.oscim.tiling.source.MapInfo;
|
||||
import org.oscim.tiling.source.TileSource;
|
||||
|
||||
public abstract class UrlTileSource extends TileSource{
|
||||
public abstract class UrlTileSource extends TileSource {
|
||||
private final static String KEY_URL = "url";
|
||||
|
||||
private static final MapInfo mMapInfo =
|
||||
new MapInfo(new BoundingBox(-180, -90, 180, 90),
|
||||
new Byte((byte) 4), new GeoPoint(53.11, 8.85),
|
||||
null, 0, 0, 0, "de", "comment", "author", null);
|
||||
|
||||
|
||||
protected URL mUrl;
|
||||
|
||||
@Override
|
||||
@ -53,15 +44,8 @@ public abstract class UrlTileSource extends TileSource{
|
||||
|
||||
}
|
||||
|
||||
public boolean setUrl(String urlString){
|
||||
public boolean setUrl(String urlString) {
|
||||
options.put("url", urlString);
|
||||
return open() == OpenResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapInfo getMapInfo() {
|
||||
return mMapInfo;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,6 @@ import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
|
||||
import org.oscim.tiling.source.ITileDataSource;
|
||||
import org.oscim.tiling.source.MapInfo;
|
||||
import org.oscim.tiling.source.TileSource;
|
||||
import org.oscim.tiling.source.mapfile.header.MapFileHeader;
|
||||
import org.oscim.tiling.source.mapfile.header.MapFileInfo;
|
||||
@ -129,7 +128,6 @@ public class MapFileTileSource extends TileSource {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapInfo getMapInfo() {
|
||||
return fileInfo;
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
* 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;
|
||||
package org.oscim.tiling.source.mapfile;
|
||||
|
||||
import org.oscim.core.BoundingBox;
|
||||
import org.oscim.core.GeoPoint;
|
||||
@ -20,7 +20,7 @@ import org.oscim.core.Tag;
|
||||
* Contains the immutable metadata of a map file.
|
||||
*
|
||||
*/
|
||||
public class MapFileInfo extends org.oscim.tiling.source.MapInfo {
|
||||
public class MapFileInfo extends org.oscim.tiling.source.mapfile.MapInfo {
|
||||
|
||||
/**
|
||||
* True if the map file includes debug information, false otherwise.
|
||||
|
||||
@ -14,23 +14,16 @@
|
||||
*/
|
||||
package org.oscim.tiling.source.test;
|
||||
|
||||
import org.oscim.core.BoundingBox;
|
||||
import org.oscim.core.MapElement;
|
||||
import org.oscim.core.Tag;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.tiling.MapTile;
|
||||
import org.oscim.tiling.source.ITileDataSink;
|
||||
import org.oscim.tiling.source.ITileDataSource;
|
||||
import org.oscim.tiling.source.MapInfo;
|
||||
import org.oscim.tiling.source.TileSource;
|
||||
|
||||
public class TestTileSource extends TileSource {
|
||||
|
||||
private final MapInfo mMapInfo =
|
||||
new MapInfo(new BoundingBox(-180, -90, 180, 90),
|
||||
new Byte((byte) 5), null, null, 0, 0, 0,
|
||||
"", "", "", null);
|
||||
|
||||
// private boolean mOpenFile = false;
|
||||
|
||||
@Override
|
||||
@ -49,11 +42,6 @@ public class TestTileSource extends TileSource {
|
||||
// mOpenFile = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapInfo getMapInfo() {
|
||||
return mMapInfo;
|
||||
}
|
||||
|
||||
static class TileDataSource implements ITileDataSource {
|
||||
|
||||
private static final Tag[] mTags = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user