Feature parameters, fix #403
This commit is contained in:
parent
4903a4b5f4
commit
607cdeb5db
@ -12,6 +12,7 @@
|
|||||||
- Mapsforge fix artifacts zoom > 17 [#231](https://github.com/mapsforge/vtm/issues/231)
|
- Mapsforge fix artifacts zoom > 17 [#231](https://github.com/mapsforge/vtm/issues/231)
|
||||||
- PolyLabel default disabled [#402](https://github.com/mapsforge/vtm/issues/402)
|
- PolyLabel default disabled [#402](https://github.com/mapsforge/vtm/issues/402)
|
||||||
- vtm-theme-comparator module [#387](https://github.com/mapsforge/vtm/issues/387)
|
- vtm-theme-comparator module [#387](https://github.com/mapsforge/vtm/issues/387)
|
||||||
|
- Feature parameters [#403](https://github.com/mapsforge/vtm/issues/403)
|
||||||
- Internal render themes various improvements [#41](https://github.com/mapsforge/vtm/issues/41)
|
- Internal render themes various improvements [#41](https://github.com/mapsforge/vtm/issues/41)
|
||||||
- Many other minor improvements and bug fixes
|
- Many other minor improvements and bug fixes
|
||||||
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.9.0)
|
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.9.0)
|
||||||
|
@ -17,13 +17,13 @@ package org.oscim.android.test;
|
|||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import org.oscim.theme.ThemeLoader;
|
import org.oscim.utils.Parameters;
|
||||||
|
|
||||||
public class AtlasThemeActivity extends SimpleMapActivity {
|
public class AtlasThemeActivity extends SimpleMapActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
ThemeLoader.USE_ATLAS = true;
|
Parameters.TEXTURE_ATLAS = true;
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
@ -16,13 +16,13 @@ package org.oscim.android.test;
|
|||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
import org.oscim.utils.Parameters;
|
||||||
|
|
||||||
public class MapsforgePolyLabelActivity extends MapsforgeMapActivity {
|
public class MapsforgePolyLabelActivity extends MapsforgeMapActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
LabelLayer.POLY_LABEL = true;
|
Parameters.POLY_LABEL = true;
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the
|
* 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
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
@ -14,13 +14,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.oscim.android.test;
|
package org.oscim.android.test;
|
||||||
|
|
||||||
import org.oscim.map.Map;
|
import org.oscim.utils.Parameters;
|
||||||
|
|
||||||
public class NewGesturesActivity extends MarkerOverlayActivity {
|
public class NewGesturesActivity extends MarkerOverlayActivity {
|
||||||
|
|
||||||
public NewGesturesActivity() {
|
public NewGesturesActivity() {
|
||||||
super();
|
super();
|
||||||
Map.NEW_GESTURES = true;
|
Parameters.MAP_EVENT_LAYER2 = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -28,6 +28,6 @@ public class NewGesturesActivity extends MarkerOverlayActivity {
|
|||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
|
||||||
// Revert gestures for other activities
|
// Revert gestures for other activities
|
||||||
Map.NEW_GESTURES = false;
|
Parameters.MAP_EVENT_LAYER2 = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,13 +16,13 @@ package org.oscim.android.test;
|
|||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import org.oscim.theme.ThemeLoader;
|
import org.oscim.utils.Parameters;
|
||||||
|
|
||||||
public class POTTextureActivity extends SimpleMapActivity {
|
public class POTTextureActivity extends SimpleMapActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
ThemeLoader.POT_TEXTURES = true;
|
Parameters.POT_TEXTURES = true;
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ import org.oscim.backend.CanvasAdapter;
|
|||||||
import org.oscim.backend.GLAdapter;
|
import org.oscim.backend.GLAdapter;
|
||||||
import org.oscim.core.Tile;
|
import org.oscim.core.Tile;
|
||||||
import org.oscim.map.Map;
|
import org.oscim.map.Map;
|
||||||
|
import org.oscim.utils.Parameters;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -102,7 +103,7 @@ public class MapView extends GLSurfaceView {
|
|||||||
mMap.clearMap();
|
mMap.clearMap();
|
||||||
mMap.updateMap(false);
|
mMap.updateMap(false);
|
||||||
|
|
||||||
if (!Map.NEW_GESTURES) {
|
if (!Parameters.MAP_EVENT_LAYER2) {
|
||||||
GestureHandler gestureHandler = new GestureHandler(mMap);
|
GestureHandler gestureHandler = new GestureHandler(mMap);
|
||||||
mGestureDetector = new GestureDetector(context, gestureHandler);
|
mGestureDetector = new GestureDetector(context, gestureHandler);
|
||||||
mGestureDetector.setOnDoubleTapListener(gestureHandler);
|
mGestureDetector.setOnDoubleTapListener(gestureHandler);
|
||||||
|
@ -34,6 +34,7 @@ import org.oscim.map.Map;
|
|||||||
import org.oscim.renderer.MapRenderer;
|
import org.oscim.renderer.MapRenderer;
|
||||||
import org.oscim.theme.VtmThemes;
|
import org.oscim.theme.VtmThemes;
|
||||||
import org.oscim.tiling.TileSource;
|
import org.oscim.tiling.TileSource;
|
||||||
|
import org.oscim.utils.Parameters;
|
||||||
|
|
||||||
public abstract class GdxMap implements ApplicationListener {
|
public abstract class GdxMap implements ApplicationListener {
|
||||||
|
|
||||||
@ -85,7 +86,7 @@ public abstract class GdxMap implements ApplicationListener {
|
|||||||
mMapRenderer.onSurfaceChanged(w, h);
|
mMapRenderer.onSurfaceChanged(w, h);
|
||||||
|
|
||||||
InputMultiplexer mux = new InputMultiplexer();
|
InputMultiplexer mux = new InputMultiplexer();
|
||||||
if (!Map.NEW_GESTURES) {
|
if (!Parameters.MAP_EVENT_LAYER2) {
|
||||||
mGestureDetector = new GestureDetector(new GestureHandlerImpl(mMap));
|
mGestureDetector = new GestureDetector(new GestureHandlerImpl(mMap));
|
||||||
mux.addProcessor(mGestureDetector);
|
mux.addProcessor(mGestureDetector);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016-2017 Longri
|
* Copyright 2016-2017 Longri
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the
|
* 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
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
@ -19,7 +19,7 @@ import com.badlogic.gdx.backends.iosrobovm.IOSApplication;
|
|||||||
import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration;
|
import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration;
|
||||||
|
|
||||||
import org.oscim.backend.CanvasAdapter;
|
import org.oscim.backend.CanvasAdapter;
|
||||||
import org.oscim.theme.ThemeLoader;
|
import org.oscim.utils.Parameters;
|
||||||
import org.robovm.apple.foundation.NSAutoreleasePool;
|
import org.robovm.apple.foundation.NSAutoreleasePool;
|
||||||
import org.robovm.apple.glkit.GLKViewDrawableStencilFormat;
|
import org.robovm.apple.glkit.GLKViewDrawableStencilFormat;
|
||||||
import org.robovm.apple.uikit.UIApplication;
|
import org.robovm.apple.uikit.UIApplication;
|
||||||
@ -38,12 +38,12 @@ public class ExampleLauncher extends IOSApplication.Delegate {
|
|||||||
float scale = (float) (getIosVersion() >= 8 ? UIScreen.getMainScreen().getNativeScale() : UIScreen.getMainScreen().getScale());
|
float scale = (float) (getIosVersion() >= 8 ? UIScreen.getMainScreen().getNativeScale() : UIScreen.getMainScreen().getScale());
|
||||||
CanvasAdapter.dpi *= scale;
|
CanvasAdapter.dpi *= scale;
|
||||||
|
|
||||||
IOSMapApp iosMapApp = new IOSMapApp();
|
IOSMapApp iosMapApp = new IOSMapApp();
|
||||||
// IOSLineTexTest iosMapApp = new IOSLineTexTest();
|
// IOSLineTexTest iosMapApp = new IOSLineTexTest();
|
||||||
// IOSMapAppCluster iosMapApp = new IOSMapAppCluster();
|
// IOSMapAppCluster iosMapApp = new IOSMapAppCluster();
|
||||||
|
|
||||||
|
|
||||||
ThemeLoader.POT_TEXTURES = true;
|
Parameters.POT_TEXTURES = true;
|
||||||
iosMapApp.init();
|
iosMapApp.init();
|
||||||
|
|
||||||
return new IOSApplication(iosMapApp, config);
|
return new IOSApplication(iosMapApp, config);
|
||||||
|
@ -16,12 +16,12 @@
|
|||||||
package org.oscim.test;
|
package org.oscim.test;
|
||||||
|
|
||||||
import org.oscim.gdx.GdxMapApp;
|
import org.oscim.gdx.GdxMapApp;
|
||||||
import org.oscim.theme.ThemeLoader;
|
import org.oscim.utils.Parameters;
|
||||||
|
|
||||||
public class AtlasThemeMapTest extends MapTest {
|
public class AtlasThemeMapTest extends MapTest {
|
||||||
|
|
||||||
private AtlasThemeMapTest() {
|
private AtlasThemeMapTest() {
|
||||||
ThemeLoader.USE_ATLAS = true;
|
Parameters.TEXTURE_ATLAS = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
package org.oscim.test;
|
package org.oscim.test;
|
||||||
|
|
||||||
import org.oscim.gdx.GdxMapApp;
|
import org.oscim.gdx.GdxMapApp;
|
||||||
import org.oscim.layers.tile.vector.labeling.LabelLayer;
|
import org.oscim.utils.Parameters;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ public class MapsforgePolyLabelTest extends MapsforgeTest {
|
|||||||
private MapsforgePolyLabelTest(File mapFile) {
|
private MapsforgePolyLabelTest(File mapFile) {
|
||||||
super(mapFile);
|
super(mapFile);
|
||||||
|
|
||||||
LabelLayer.POLY_LABEL = true;
|
Parameters.POLY_LABEL = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the
|
* 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
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
@ -15,12 +15,12 @@
|
|||||||
package org.oscim.test;
|
package org.oscim.test;
|
||||||
|
|
||||||
import org.oscim.gdx.GdxMapApp;
|
import org.oscim.gdx.GdxMapApp;
|
||||||
import org.oscim.map.Map;
|
import org.oscim.utils.Parameters;
|
||||||
|
|
||||||
public class NewGesturesTest extends MarkerLayerTest {
|
public class NewGesturesTest extends MarkerLayerTest {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Map.NEW_GESTURES = true;
|
Parameters.MAP_EVENT_LAYER2 = true;
|
||||||
|
|
||||||
GdxMapApp.init();
|
GdxMapApp.init();
|
||||||
GdxMapApp.run(new NewGesturesTest());
|
GdxMapApp.run(new NewGesturesTest());
|
||||||
|
@ -18,12 +18,12 @@
|
|||||||
package org.oscim.test;
|
package org.oscim.test;
|
||||||
|
|
||||||
import org.oscim.gdx.GdxMapApp;
|
import org.oscim.gdx.GdxMapApp;
|
||||||
import org.oscim.theme.ThemeLoader;
|
import org.oscim.utils.Parameters;
|
||||||
|
|
||||||
public class POTTextureTest extends MapTest {
|
public class POTTextureTest extends MapTest {
|
||||||
|
|
||||||
private POTTextureTest() {
|
private POTTextureTest() {
|
||||||
ThemeLoader.POT_TEXTURES = true;
|
Parameters.POT_TEXTURES = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -38,8 +38,6 @@ public class LabelLayer extends Layer implements Map.UpdateListener, TileManager
|
|||||||
|
|
||||||
private static final long MAX_RELABEL_DELAY = 100;
|
private static final long MAX_RELABEL_DELAY = 100;
|
||||||
|
|
||||||
public static boolean POLY_LABEL;
|
|
||||||
|
|
||||||
private final LabelPlacement mLabelPlacer;
|
private final LabelPlacement mLabelPlacer;
|
||||||
private final Worker mWorker;
|
private final Worker mWorker;
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ import org.oscim.renderer.bucket.TextItem;
|
|||||||
import org.oscim.theme.styles.RenderStyle;
|
import org.oscim.theme.styles.RenderStyle;
|
||||||
import org.oscim.theme.styles.SymbolStyle;
|
import org.oscim.theme.styles.SymbolStyle;
|
||||||
import org.oscim.theme.styles.TextStyle;
|
import org.oscim.theme.styles.TextStyle;
|
||||||
|
import org.oscim.utils.Parameters;
|
||||||
import org.oscim.utils.geom.PolyLabel;
|
import org.oscim.utils.geom.PolyLabel;
|
||||||
|
|
||||||
import static org.oscim.core.GeometryBuffer.GeometryType.LINE;
|
import static org.oscim.core.GeometryBuffer.GeometryType.LINE;
|
||||||
@ -93,7 +94,7 @@ public class LabelTileLoaderHook implements TileLoaderThemeHook {
|
|||||||
float x = 0;
|
float x = 0;
|
||||||
float y = 0;
|
float y = 0;
|
||||||
if (label == null) {
|
if (label == null) {
|
||||||
if (LabelLayer.POLY_LABEL) {
|
if (Parameters.POLY_LABEL) {
|
||||||
label = PolyLabel.get(element);
|
label = PolyLabel.get(element);
|
||||||
x = label.x;
|
x = label.x;
|
||||||
y = label.y;
|
y = label.y;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 Andrey Novikov
|
* Copyright 2016 Andrey Novikov
|
||||||
* Copyright 2016 Stephan Leuschner
|
* Copyright 2016 Stephan Leuschner
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
* Copyright 2016 Longri
|
* Copyright 2016 Longri
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
@ -40,6 +40,7 @@ import org.oscim.theme.IRenderTheme;
|
|||||||
import org.oscim.theme.ThemeFile;
|
import org.oscim.theme.ThemeFile;
|
||||||
import org.oscim.theme.ThemeLoader;
|
import org.oscim.theme.ThemeLoader;
|
||||||
import org.oscim.tiling.TileSource;
|
import org.oscim.tiling.TileSource;
|
||||||
|
import org.oscim.utils.Parameters;
|
||||||
import org.oscim.utils.ThreadUtils;
|
import org.oscim.utils.ThreadUtils;
|
||||||
import org.oscim.utils.async.AsyncExecutor;
|
import org.oscim.utils.async.AsyncExecutor;
|
||||||
import org.oscim.utils.async.TaskQueue;
|
import org.oscim.utils.async.TaskQueue;
|
||||||
@ -50,11 +51,6 @@ public abstract class Map implements TaskQueue {
|
|||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(Map.class);
|
private static final Logger log = LoggerFactory.getLogger(Map.class);
|
||||||
|
|
||||||
/**
|
|
||||||
* If true the {@link MapEventLayer2} will be used instead of default {@link MapEventLayer}.
|
|
||||||
*/
|
|
||||||
public static boolean NEW_GESTURES = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listener interface for map update notifications.
|
* Listener interface for map update notifications.
|
||||||
* Layers implementing this interface they will be automatically register
|
* Layers implementing this interface they will be automatically register
|
||||||
@ -157,7 +153,7 @@ public abstract class Map implements TaskQueue {
|
|||||||
mAsyncExecutor = new AsyncExecutor(4, this);
|
mAsyncExecutor = new AsyncExecutor(4, this);
|
||||||
mMapPosition = new MapPosition();
|
mMapPosition = new MapPosition();
|
||||||
|
|
||||||
if (NEW_GESTURES)
|
if (Parameters.MAP_EVENT_LAYER2)
|
||||||
mEventLayer = new MapEventLayer2(this);
|
mEventLayer = new MapEventLayer2(this);
|
||||||
else
|
else
|
||||||
mEventLayer = new MapEventLayer(this);
|
mEventLayer = new MapEventLayer(this);
|
||||||
|
@ -20,12 +20,10 @@ package org.oscim.theme;
|
|||||||
|
|
||||||
import org.oscim.backend.CanvasAdapter;
|
import org.oscim.backend.CanvasAdapter;
|
||||||
import org.oscim.theme.IRenderTheme.ThemeException;
|
import org.oscim.theme.IRenderTheme.ThemeException;
|
||||||
|
import org.oscim.utils.Parameters;
|
||||||
|
|
||||||
public class ThemeLoader {
|
public class ThemeLoader {
|
||||||
|
|
||||||
public static boolean USE_ATLAS;
|
|
||||||
public static boolean POT_TEXTURES;
|
|
||||||
|
|
||||||
public static IRenderTheme load(String renderThemePath) throws ThemeException {
|
public static IRenderTheme load(String renderThemePath) throws ThemeException {
|
||||||
return load(new ExternalRenderTheme(renderThemePath));
|
return load(new ExternalRenderTheme(renderThemePath));
|
||||||
}
|
}
|
||||||
@ -49,9 +47,9 @@ public class ThemeLoader {
|
|||||||
public static IRenderTheme load(ThemeFile theme, ThemeCallback themeCallback) throws ThemeException {
|
public static IRenderTheme load(ThemeFile theme, ThemeCallback themeCallback) throws ThemeException {
|
||||||
IRenderTheme t;
|
IRenderTheme t;
|
||||||
if (ThemeUtils.isMapsforgeTheme(theme))
|
if (ThemeUtils.isMapsforgeTheme(theme))
|
||||||
t = USE_ATLAS ? XmlMapsforgeAtlasThemeBuilder.read(theme, themeCallback) : XmlMapsforgeThemeBuilder.read(theme, themeCallback);
|
t = Parameters.TEXTURE_ATLAS ? XmlMapsforgeAtlasThemeBuilder.read(theme, themeCallback) : XmlMapsforgeThemeBuilder.read(theme, themeCallback);
|
||||||
else
|
else
|
||||||
t = USE_ATLAS ? XmlAtlasThemeBuilder.read(theme, themeCallback) : XmlThemeBuilder.read(theme, themeCallback);
|
t = Parameters.TEXTURE_ATLAS ? XmlAtlasThemeBuilder.read(theme, themeCallback) : XmlThemeBuilder.read(theme, themeCallback);
|
||||||
if (t != null)
|
if (t != null)
|
||||||
t.scaleTextSize(CanvasAdapter.getScale() * CanvasAdapter.textScale);
|
t.scaleTextSize(CanvasAdapter.getScale() * CanvasAdapter.textScale);
|
||||||
return t;
|
return t;
|
||||||
|
@ -32,6 +32,7 @@ import org.oscim.layers.tile.MapTile;
|
|||||||
import org.oscim.tiling.ITileDataSink;
|
import org.oscim.tiling.ITileDataSink;
|
||||||
import org.oscim.tiling.ITileDataSource;
|
import org.oscim.tiling.ITileDataSource;
|
||||||
import org.oscim.tiling.source.mapfile.header.SubFileParameter;
|
import org.oscim.tiling.source.mapfile.header.SubFileParameter;
|
||||||
|
import org.oscim.utils.Parameters;
|
||||||
import org.oscim.utils.geom.TileClipper;
|
import org.oscim.utils.geom.TileClipper;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -532,7 +533,7 @@ public class MapDatabase implements ITileDataSource {
|
|||||||
} else if (blockSize == 0) {
|
} else if (blockSize == 0) {
|
||||||
/* the current block is empty, continue with the next block */
|
/* the current block is empty, continue with the next block */
|
||||||
continue;
|
continue;
|
||||||
} else if (blockSize > ReadBuffer.MAXIMUM_BUFFER_SIZE) {
|
} else if (blockSize > Parameters.MAXIMUM_BUFFER_SIZE) {
|
||||||
/* the current block is too large, continue with the next
|
/* the current block is too large, continue with the next
|
||||||
* block */
|
* block */
|
||||||
log.warn("current block size too large: " + blockSize);
|
log.warn("current block size too large: " + blockSize);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||||
|
* Copyright 2017 devemux86
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@ -18,6 +19,7 @@ package org.oscim.tiling.source.mapfile;
|
|||||||
|
|
||||||
import org.oscim.core.Tag;
|
import org.oscim.core.Tag;
|
||||||
import org.oscim.core.TagSet;
|
import org.oscim.core.TagSet;
|
||||||
|
import org.oscim.utils.Parameters;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.RandomAccessFile;
|
import java.io.RandomAccessFile;
|
||||||
@ -31,11 +33,6 @@ public class ReadBuffer {
|
|||||||
private static final String CHARSET_UTF8 = "UTF-8";
|
private static final String CHARSET_UTF8 = "UTF-8";
|
||||||
private static final Logger LOG = Logger.getLogger(ReadBuffer.class.getName());
|
private static final Logger LOG = Logger.getLogger(ReadBuffer.class.getName());
|
||||||
|
|
||||||
/**
|
|
||||||
* Maximum buffer size which is supported by this implementation.
|
|
||||||
*/
|
|
||||||
static final int MAXIMUM_BUFFER_SIZE = 8000000;
|
|
||||||
|
|
||||||
private byte[] mBufferData;
|
private byte[] mBufferData;
|
||||||
private int mBufferPosition;
|
private int mBufferPosition;
|
||||||
private final RandomAccessFile mInputFile;
|
private final RandomAccessFile mInputFile;
|
||||||
@ -67,7 +64,7 @@ public class ReadBuffer {
|
|||||||
// ensure that the read buffer is large enough
|
// ensure that the read buffer is large enough
|
||||||
if (mBufferData == null || mBufferData.length < length) {
|
if (mBufferData == null || mBufferData.length < length) {
|
||||||
// ensure that the read buffer is not too large
|
// ensure that the read buffer is not too large
|
||||||
if (length > MAXIMUM_BUFFER_SIZE) {
|
if (length > Parameters.MAXIMUM_BUFFER_SIZE) {
|
||||||
LOG.warning("invalid read length: " + length);
|
LOG.warning("invalid read length: " + length);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
47
vtm/src/org/oscim/utils/Parameters.java
Normal file
47
vtm/src/org/oscim/utils/Parameters.java
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2017 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.utils;
|
||||||
|
|
||||||
|
public final class Parameters {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If true the <code>MapEventLayer2</code> will be used instead of default <code>MapEventLayer</code>.
|
||||||
|
*/
|
||||||
|
public static boolean MAP_EVENT_LAYER2 = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maximum buffer size for map files.
|
||||||
|
*/
|
||||||
|
public static int MAXIMUM_BUFFER_SIZE = 8000000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optimal placement of text labels on polygons.
|
||||||
|
*/
|
||||||
|
public static boolean POLY_LABEL = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* POT textures in themes.
|
||||||
|
*/
|
||||||
|
public static boolean POT_TEXTURES = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Texture atlas in themes.
|
||||||
|
*/
|
||||||
|
public static boolean TEXTURE_ATLAS = false;
|
||||||
|
|
||||||
|
private Parameters() {
|
||||||
|
throw new IllegalStateException();
|
||||||
|
}
|
||||||
|
}
|
@ -19,7 +19,6 @@ import org.oscim.backend.CanvasAdapter;
|
|||||||
import org.oscim.backend.canvas.Bitmap;
|
import org.oscim.backend.canvas.Bitmap;
|
||||||
import org.oscim.backend.canvas.Canvas;
|
import org.oscim.backend.canvas.Canvas;
|
||||||
import org.oscim.renderer.bucket.TextureItem;
|
import org.oscim.renderer.bucket.TextureItem;
|
||||||
import org.oscim.theme.ThemeLoader;
|
|
||||||
import org.oscim.utils.math.MathUtils;
|
import org.oscim.utils.math.MathUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -47,7 +46,7 @@ public final class Utils {
|
|||||||
if (bitmap != null) {
|
if (bitmap != null) {
|
||||||
log.debug("loading {}", src);
|
log.debug("loading {}", src);
|
||||||
|
|
||||||
if (ThemeLoader.POT_TEXTURES) {
|
if (Parameters.POT_TEXTURES) {
|
||||||
int potWidth = MathUtils.nextPowerOfTwo(bitmap.getWidth());
|
int potWidth = MathUtils.nextPowerOfTwo(bitmap.getWidth());
|
||||||
int potHeight = MathUtils.nextPowerOfTwo(bitmap.getHeight());
|
int potHeight = MathUtils.nextPowerOfTwo(bitmap.getHeight());
|
||||||
if (potWidth != bitmap.getWidth() || potHeight != bitmap.getHeight()) {
|
if (potWidth != bitmap.getWidth() || potHeight != bitmap.getHeight()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user