Skip to content

Commit

Permalink
Mapsforge themes parser united with VTM opensciencemap#100
Browse files Browse the repository at this point in the history
  • Loading branch information
devemux86 committed Jul 5, 2018
1 parent 40f2910 commit f2bf6cd
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 1,405 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright 2010, 2011, 2012 mapsforge.org
* Copyright 2016-2017 devemux86
* Copyright 2016-2018 devemux86
* Copyright 2017 Longri
*
* This program is free software: you can redistribute it and/or modify it under the
Expand All @@ -18,8 +18,6 @@

import org.oscim.theme.ExternalRenderTheme;
import org.oscim.theme.ThemeFile;
import org.oscim.theme.ThemeUtils;
import org.oscim.theme.XmlMapsforgeThemeBuilder;
import org.oscim.theme.XmlThemeBuilder;
import org.oscim.tiling.TileSource.OpenResult;
import org.xml.sax.InputSource;
Expand All @@ -41,11 +39,7 @@ public boolean accept(File file) {

try {
ThemeFile theme = new ExternalRenderTheme(file.getAbsolutePath());
DefaultHandler renderThemeHandler;
if (ThemeUtils.isMapsforgeTheme(theme))
renderThemeHandler = new XmlMapsforgeThemeBuilder(theme);
else
renderThemeHandler = new XmlThemeBuilder(theme);
DefaultHandler renderThemeHandler = new XmlThemeBuilder(theme);
XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
xmlReader.setContentHandler(renderThemeHandler);
xmlReader.parse(new InputSource(theme.getRenderThemeAsStream()));
Expand Down
8 changes: 2 additions & 6 deletions vtm/src/org/oscim/theme/ThemeLoader.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright 2013 Hannes Janetzek
* Copyright 2016-2017 devemux86
* Copyright 2016-2018 devemux86
* Copyright 2017 Longri
* Copyright 2017 Andrey Novikov
*
Expand Down Expand Up @@ -46,11 +46,7 @@ public static IRenderTheme load(ThemeFile theme) throws ThemeException {
}

public static IRenderTheme load(ThemeFile theme, ThemeCallback themeCallback) throws ThemeException {
IRenderTheme t;
if (theme.isMapsforgeTheme())
t = Parameters.TEXTURE_ATLAS ? XmlMapsforgeAtlasThemeBuilder.read(theme, themeCallback) : XmlMapsforgeThemeBuilder.read(theme, themeCallback);
else
t = Parameters.TEXTURE_ATLAS ? XmlAtlasThemeBuilder.read(theme, themeCallback) : XmlThemeBuilder.read(theme, themeCallback);
IRenderTheme t = Parameters.TEXTURE_ATLAS ? XmlAtlasThemeBuilder.read(theme, themeCallback) : XmlThemeBuilder.read(theme, themeCallback);
if (t != null)
t.scaleTextSize(CanvasAdapter.getScale() * CanvasAdapter.textScale);
return t;
Expand Down
2 changes: 1 addition & 1 deletion vtm/src/org/oscim/theme/XmlAtlasThemeBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public XmlAtlasThemeBuilder(ThemeFile theme, ThemeCallback themeCallback,

@Override
RenderTheme createTheme(Rule[] rules) {
return new AtlasRenderTheme(mMapBackground, mTextScale, rules, mLevels, regionMap, atlasList);
return new AtlasRenderTheme(mMapBackground, mTextScale, rules, mLevels, mMapsforgeTheme, regionMap, atlasList);
}

@Override
Expand Down
127 changes: 0 additions & 127 deletions vtm/src/org/oscim/theme/XmlMapsforgeAtlasThemeBuilder.java

This file was deleted.

Loading

0 comments on commit f2bf6cd

Please sign in to comment.