Own internal RenderTheme ?

54 views
Skip to first unread message

Andre Höpfner

unread,
Jun 5, 2013, 5:22:36 AM6/5/13
to mapsfo...@googlegroups.com
Is it possible to expand the interface 'XmlRenderTheme'?

public InputStream getResourceAsStream (String AbsoluteName)
{
return .....;
}



And at ,XmlUtils' it back to grab when src.startsWith (PREFIX_JAR)

if (src.startsWith(PREFIX_JAR)) {
           
String absoluteName = getAbsoluteName(relativePathPrefix, src.substring(PREFIX_JAR.length()));
           
InputStream inputStream = Theme.getResourceAsStream(absoluteName);
           
if (inputStream == null) {
               
throw new FileNotFoundException("resource not found: " + absoluteName);
           
}
           
return inputStream;



Then we could pack our own Theme in our *.jar and do not have it in the mapsforge-map-0.4.0-SNAPSHOT.jar pack to access it?

Greeting Andre

Ludwig

unread,
Jun 5, 2013, 9:37:18 PM6/5/13
to mapsfo...@googlegroups.com
These things are certainly possible with only small modifications to the code.

I have some, as yet unpublished (because adding even more changes into rewrite will delay release even further), code that does similar things, e.g. loading renderthemes from apk assets. The following code snippets just might give you an idea what to do:

Loading a render theme file from assets by deriving an AssetsRenderTheme from XmlRenderTheme:

    public AssetsRenderTheme(Context context, String relativePathPrefix, String fileName) throws IOException {
        this.assetName = fileName;
        this.relativePathPrefix = relativePathPrefix;
        this.inputStream = context.getAssets().open(this.assetName);
    }

It is equally possible to add your own icon bitmaps from apk assets.

Once 0.4 is out I would like to merge it into the trunk, but I do not want to delay things further at the moment.

Ludwig




--
You received this message because you are subscribed to the Google Groups "mapsforge-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapsforge-de...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Andre Höpfner

unread,
Jun 6, 2013, 2:28:48 AM6/6/13
to mapsfo...@googlegroups.com
I also think that the release of 0.4.0 here has priority.

If I understand Git and Maven, I'd be willing to help you a little bit here. (at our project we use SVN)

Maybe there is even the possibility after the release that you explained it to me, enjoy a coffee in Berlin.

Greetings Andre
Reply all
Reply to author
Forward
0 new messages