I have an old project which involves using Unfolding Maps and Processing to draw, well...maps haha. The project works fine, but I was checking something out to help a colleague and encountered something I don't quite understand.
My question is as follows: if I call Unfolding Map's draw()
method (map.draw()
) in Processing's draw()
method, everything works fine, everything gets redrawn continuously and I can properly interact with the app and whatnot. However, if I do map.draw()
in Processing's setup()
method and then avoid Processing's draw()
method from ever running, shouldn't the map get drawn once and then everything get shut down?
Instead, when I run map.draw()
in setup()
and then force everything to stop, it doesn't draw anything, not even once.
Also, I've tried running Processing's draw()
method just once and calling map.draw()
just once in Processing's draw()
method, by using noLoop()
at the end of setup()
. My project is really long, so I'll just post a bit of code only meant to test this small question of mine.
private static final boolean offline = false;
public static String mbTilesString = "/Users/roy/IdeaProjects/UnfoldingMaps/data/blankLight-1-3.mbtiles"
private UnfoldingMap map;
public void setup() {
size(900, 700, OPENGL);
if (offline) {
this.map = new UnfoldingMap(this, 200, 50, 650, 600, new MBTilesMapProvider(mbTilesString));
} else {
this.map = new UnfoldingMap(this, 200, 50, 650, 600, new Microsoft.RoadProvider());
}
MapUtils.createDefaultEventDispatcher(this, this.map);
noLoop(); // draw() gets called only once
}
public void draw() {
this.map.draw();
}
I expect the map to be drawn once and then everything to stop. Instead I get the following: