Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove SLF4J dependency #1167

Merged
merged 1 commit into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ allprojects {

ext.gdxVersion = "1.11.0"
ext.gwtVersion = "2.8.2"
ext.slf4jVersion = "1.7.28"

if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
Expand Down
1 change: 1 addition & 0 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Next version

- Remove SLF4J dependency [#1167](https://github.com/mapsforge/vtm/pull/1167)
- Disable `vtm-ios` [#1166](https://github.com/mapsforge/vtm/pull/1166)
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.24.0)

Expand Down
5 changes: 1 addition & 4 deletions docs/Integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ repositories {
```groovy
implementation '[PACKAGE]:vtm:[CURRENT-VERSION]'
implementation '[PACKAGE]:vtm-themes:[CURRENT-VERSION]'
implementation 'org.slf4j:slf4j-api:1.7.28'
```

### Android
Expand Down Expand Up @@ -148,9 +147,7 @@ implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.9'

```groovy
implementation '[PACKAGE]:vtm-jeo:[CURRENT-VERSION]'
implementation('com.github.jeo.jeo:jeo-carto:master-SNAPSHOT') {
exclude group: 'org.slf4j', module: 'slf4j-jdk14'
}
implementation 'com.github.jeo.jeo:jeo-carto:master-SNAPSHOT'
```

## Snapshots
Expand Down
1 change: 0 additions & 1 deletion vtm-android-example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ dependencies {
implementation project(':vtm-jts')
implementation project(':vtm-mvt')
implementation project(':vtm-themes')
implementation "org.slf4j:slf4j-android:$slf4jVersion"

implementation project(':vtm-android-gdx')
implementation project(':vtm-gdx')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,16 @@
//import org.oscim.theme.internal.VtmThemes;
//import org.oscim.theme.styles.TextStyle;
//import org.oscim.utils.IOUtils;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
//import java.io.IOException;
//import java.io.InputStream;
//import java.net.URL;
//import java.net.URLConnection;
//import java.util.Arrays;
//import java.util.logging.Logger;
//
//public class JeoIndoorActivity extends BaseMapActivity {
// public static final Logger log = LoggerFactory.getLogger(JeoIndoorActivity.class);
// private static final Logger log = Logger.getLogger(JeoIndoorActivity.class.getName());
//
// // from http://overpass-turbo.eu/s/2vp
// String PATH = "https://gist.githubusercontent.com/anonymous/09062103a66844a96048f25626078c8d/raw/1d3af6a5a55e9ea4adc9551fa633a051a44a5a9c/overpass.geojson";
Expand Down Expand Up @@ -165,7 +164,7 @@
// mIndoorLayer.activeLevels[i] ^= true;
// if (v instanceof ToggleButton)
// ((ToggleButton) v).setChecked(mIndoorLayer.activeLevels[i]);
// log.debug(Arrays.toString(mIndoorLayer.activeLevels));
// log.fine(Arrays.toString(mIndoorLayer.activeLevels));
// mIndoorLayer.update();
// }
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,17 @@
import org.oscim.theme.styles.RenderStyle;
import org.oscim.tiling.source.mapfile.MapFileTileSource;
import org.oscim.tiling.source.mapfile.MapInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.List;
import java.util.logging.Logger;
import java.util.zip.ZipInputStream;

public class MapsforgeActivity extends MapActivity {

private static final Logger log = LoggerFactory.getLogger(MapsforgeActivity.class);
private static final Logger log = Logger.getLogger(MapsforgeActivity.class.getName());

static final int SELECT_MAP_FILE = 0;
private static final int SELECT_THEME_ARCHIVE = 1;
Expand Down Expand Up @@ -227,7 +226,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
mPrefs.clear();
}
} catch (Exception e) {
log.error(e.toString());
log.severe(e.toString());
finish();
}
} else if (requestCode == SELECT_THEME_ARCHIVE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,12 @@
import org.oscim.layers.marker.MarkerItem;
import org.oscim.layers.marker.MarkerSymbol;
import org.oscim.map.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.logging.Logger;

/**
* POI search.<br/>
Expand All @@ -60,7 +59,7 @@
@SuppressWarnings("deprecation")
public class PoiSearchActivity extends MapsforgeActivity implements ItemizedLayer.OnItemGestureListener<MarkerInterface> {

private static final Logger log = LoggerFactory.getLogger(PoiSearchActivity.class);
private static final Logger log = Logger.getLogger(PoiSearchActivity.class.getName());

private static final String POI_CATEGORY = "Restaurants";
private static final int SELECT_POI_FILE = MapsforgeActivity.SELECT_THEME_FILE + 1;
Expand Down Expand Up @@ -299,7 +298,7 @@ protected Collection<PointOfInterest> doInBackground(BoundingBox... params) {
params[0].getMaxLatitude(), params[0].getMaxLongitude());
return mPersistenceManager.findInRect(bb, categoryFilter, patterns, null, Integer.MAX_VALUE, true);
} catch (Throwable t) {
log.error(t.toString(), t);
log.severe(t.toString());
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
import org.oscim.theme.styles.LineStyle;
import org.oscim.theme.styles.LineStyle.LineBuilder;
import org.oscim.theme.styles.RenderStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.logging.Logger;

public class ThemeStylerActivity extends BaseMapActivity implements OnSeekBarChangeListener {
final Logger log = LoggerFactory.getLogger(ThemeStylerActivity.class);
final Logger log = Logger.getLogger(ThemeStylerActivity.class.getName());

public ThemeStylerActivity() {
super(R.layout.activity_map_styler);
Expand Down Expand Up @@ -124,7 +124,7 @@ else if (id == R.id.seekBarV)
else if (id == R.id.seekBarH)
c.hue = progress / 100f;

log.debug((modArea ? "area" : "line")
log.fine((modArea ? "area" : "line")
+ " h:" + c.hue
+ " s:" + c.saturation
+ " v:" + c.value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,20 @@
import org.oscim.tiling.OverzoomDataSink;
import org.oscim.tiling.QueryResult;
import org.oscim.tiling.source.mvt.TileDecoder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.ByteArrayInputStream;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.logging.Logger;
import java.util.zip.GZIPInputStream;

/**
* A tile data source for MBTiles vector databases.
*/
public class MBTilesMvtTileDataSource extends MBTilesTileDataSource {

private static final Logger log = LoggerFactory.getLogger(MBTilesMvtTileDataSource.class);
private static final Logger log = Logger.getLogger(MBTilesMvtTileDataSource.class.getName());

private static final List<String> SUPPORTED_FORMATS = Collections.singletonList("pbf");
private static final String WHERE_FORMAT = "zoom_level=%d AND tile_column=%d AND tile_row=%d";
Expand All @@ -65,7 +64,7 @@ public MBTilesMvtTileDataSource(String path, String language) {
try {
assertDatabaseFormat();
} catch (MBTilesUnsupportedException e) {
log.error("Invalid MBTiles database", e);
log.severe("Invalid MBTiles database" + e);
}
}

Expand Down Expand Up @@ -135,7 +134,7 @@ public void query(MapTile requestTile, ITileDataSink requestDataSink) {
} else
responseDataSink.completed(QueryResult.TILE_NOT_FOUND);
} catch (Throwable t) {
log.error(t.toString(), t);
log.severe(t.toString());
responseDataSink.completed(QueryResult.FAILED);
} finally {
if (cursor != null)
Expand Down
15 changes: 7 additions & 8 deletions vtm-android/src/org/oscim/android/MapView.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,10 @@
import org.oscim.map.Map;
import org.oscim.renderer.MapRenderer;
import org.oscim.utils.Parameters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand All @@ -60,7 +59,7 @@
*/
public class MapView extends GLSurfaceView {

static final Logger log = LoggerFactory.getLogger(MapView.class);
private static final Logger log = Logger.getLogger(MapView.class.getName());

private static final Pattern GL_PATTERN = Pattern.compile("OpenGL ES (\\d(\\.\\d){0,2})");

Expand Down Expand Up @@ -143,7 +142,7 @@ public MapView(Context context, AttributeSet attributeSet) {
try {
setEGLContextFactory(new GlContextFactory());
} catch (Throwable t) {
log.error("Falling back to GLES 2", t);
log.severe("Falling back to GLES 2" + t);
setEGLContextClientVersion(2);
}
} else
Expand Down Expand Up @@ -314,7 +313,7 @@ public boolean postDelayed(Runnable action, long delay) {
}

public void pause(boolean pause) {
log.debug("pause... {}", pause);
log.fine("pause... " + pause);
mPausing = pause;
}
}
Expand All @@ -338,7 +337,7 @@ private int[] extractVersion(String versionString) {
version[1] = split.length < 2 ? 0 : parseInt(split[1], 0);
version[2] = split.length < 3 ? 0 : parseInt(split[2], 0);
} else {
log.error("Invalid version string: " + versionString);
log.severe("Invalid version string: " + versionString);
version[0] = 2;
version[1] = 0;
version[2] = 0;
Expand All @@ -353,7 +352,7 @@ private int parseInt(String value, int defaultValue) {
try {
return Integer.parseInt(value);
} catch (NumberFormatException e) {
log.error("Error parsing number: " + value + ", assuming: " + defaultValue);
log.severe("Error parsing number: " + value + ", assuming: " + defaultValue);
return defaultValue;
}
}
Expand All @@ -378,7 +377,7 @@ public void onSurfaceCreated(GL10 gl, EGLConfig config) {
else
GLAdapter.init(new AndroidGL());
} catch (Throwable t) {
log.error("Falling back to GLES 2", t);
log.severe("Falling back to GLES 2" + t);
GLAdapter.init(new AndroidGL());
}
}
Expand Down
30 changes: 12 additions & 18 deletions vtm-android/src/org/oscim/android/cache/TileCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,16 @@
import android.database.sqlite.SQLiteStatement;
import android.os.Build;
import android.os.ParcelFileDescriptor;

import org.oscim.core.Tile;
import org.oscim.tiling.ITileCache;
import org.slf4j.LoggerFactory;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.OutputStream;

import java.io.*;
import java.util.ArrayList;
import java.util.logging.Logger;

public class TileCache implements ITileCache {

static final org.slf4j.Logger log = LoggerFactory.getLogger(TileCache.class);
private static final Logger log = Logger.getLogger(TileCache.class.getName());
static final boolean dbg = false;

class CacheTileReader implements TileReader {
Expand Down Expand Up @@ -106,7 +100,7 @@ public void dispose() {
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public TileCache(Context context, String cacheDirectory, String dbName) {
if (dbg)
log.debug("open cache {}, {}", cacheDirectory, dbName);
log.fine("open cache " + cacheDirectory + ", " + dbName);

if (cacheDirectory != null)
dbName = new File(cacheDirectory, dbName).getAbsolutePath();
Expand Down Expand Up @@ -178,13 +172,13 @@ public SQLiteHelper(Context context, String dbName) {

@Override
public void onCreate(SQLiteDatabase db) {
log.debug("create table");
log.fine("create table");
db.execSQL(TILE_SCHEMA);
}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
log.debug("drop table");
log.fine("drop table");
db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
onCreate(db);
}
Expand All @@ -207,7 +201,7 @@ public void saveTile(Tile tile, ByteArrayOutputStream data, boolean success) {
}

if (dbg)
log.debug("store tile {} {}", tile, Boolean.valueOf(success));
log.fine("store tile " + tile + " " + success);

if (!success)
return;
Expand Down Expand Up @@ -237,14 +231,14 @@ public TileReader getTileApi11(Tile tile) {
ParcelFileDescriptor result = mStmtGetTile.simpleQueryForBlobFileDescriptor();
in = new FileInputStream(result.getFileDescriptor());
} catch (SQLiteDoneException e) {
log.debug("not in cache {}", tile);
log.fine("not in cache " + tile);
return null;
} finally {
mStmtGetTile.clearBindings();
}

if (dbg)
log.debug("load tile {}", tile);
log.fine("load tile " + tile);

return new CacheTileReader(tile, in);
}
Expand All @@ -267,7 +261,7 @@ public synchronized TileReader getTile(Tile tile) {

if (!cursor.moveToFirst()) {
if (dbg)
log.debug("not in cache {}", tile);
log.fine("not in cache " + tile);

cursor.close();
return null;
Expand All @@ -277,7 +271,7 @@ public synchronized TileReader getTile(Tile tile) {
cursor.close();

if (dbg)
log.debug("load tile {}", tile);
log.fine("load tile " + tile);

return new CacheTileReader(tile, in);
}
Expand Down
Loading
Loading