This is my first question at stackoverflow so if I miss information let me know. I want to make a program which shows a worldmap in which you can zoom in and out and place marker which moves around (like a game map). Because I would like the world map to be used offline I am using unfoldingmaps http://unfoldingmaps.org/. This works great if I use the examples. Now I would like to integrate this into the program I have already written. I am trying to integrate the Papplet of the unfoldingmaps into a JPanel. This JPanel is part of a tabbedPanel.
This is the code I use to add it to the tabbedPanel:
//Create game map menu
gameMapMenu = new JPanel();
tabbedPanelMain.addTab("World map", gameMapMenu);
//tabbedPanelMain.setEnabledAt(2, false);
worldMap = map.WorldMap.getWorldMap();
gameMapMenu.add("World map", worldMap);
This is the code (in a separate Class) which is used to generate the unfolding map:
UnfoldingMap map;
public void setup() {
size(800, 600, OPENGL);
map = new UnfoldingMap(this, new MBTilesMapProvider(mbTilesString));
MapUtils.createDefaultEventDispatcher(this, map);
map.setZoomRange(1, 10);
}
public void draw() {
background(0);
map.draw();
}
public static WorldMap getWorldMap() {
WorldMap worldMap = new WorldMap();
return worldMap;
}
I have two questions I have been really struggling with and I cannot find any answers for:
The example above does not give any errors. It starts the application and tabbedPanel but does not show the map. If I run the Papplet of the world map in Eclipse as a Applet it works fine. How do I add the Papplet with the map to my existing application so it is viewed through the tabbedPanel?
To update the markers on the world map I was thinking about adding functions to the class with the worldmap Papplet. Is this the way to interact with the Papplet from the application?