Processing and unfolding maps and opengl problem

edited February 2018 in Library Questions

Hi,

I am trying to make an interactive map app in Eclipse with processing.core:* imported using Unfolding maps.

import java.awt.*;
import java.util.HashMap;
import java.util.List;
import de.fhpotsdam.unfolding.*;
import de.fhpotsdam.unfolding.data.Feature;
import de.fhpotsdam.unfolding.data.GeoJSONReader;
import de.fhpotsdam.unfolding.marker.Marker;
import de.fhpotsdam.unfolding.utils.MapUtils;
import processing.core.*;
import processing.data.*;
import codeanticode.glgraphics.*;




public class MM extends PApplet

{
    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    UnfoldingMap map;
    String dataFile = "C:\\Users\\Miska\\eclipse-workspace\\countries.csv";
    Checkbox checkbox;

    HashMap<String, DataEntry> dataEntriesMap;
    List<Marker> countryMarkers;


    public static void main(String[] args) 
    {
        PApplet.main(new String[] {MM.class.getName()});
    }

    public void setup()
    {
        size(800, 600, GLConstants.GLGRAPHICS);
        map = new UnfoldingMap(this);
        map.zoomToLevel(3);
        map.setBackgroundColor(240);
        MapUtils.createDefaultEventDispatcher(this, map);
    }

I have trouble with the OpengGL library as I keep getting this error

Exception in thread "Animation Thread" java.lang.NoClassDefFoundError: processing/opengl/PGraphicsOpenGL$ImageCache
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
    at java.lang.Class.getConstructor0(Unknown Source)
    at java.lang.Class.getConstructor(Unknown Source)
    at processing.core.PApplet.makeGraphics(PApplet.java:1918)
    at processing.core.PApplet.size(PApplet.java:1771)
    at processing.core.PApplet.size(PApplet.java:1742)
    at MM.setup(MM.java:45)
    at processing.core.PApplet.handleDraw(PApplet.java:2361)
    at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:240)
    at processing.core.PApplet.run(PApplet.java:2256)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: processing.opengl.PGraphicsOpenGL$ImageCache
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)

I tried this library https://codeanticode.wordpress.com/ , but that appears not to help in this particular case. Any suggestions?

Answers

  • Before you get into Eclipse, could you run a quick test using the PDE instead? You can load an unfolding map examples and check that your OPENGL is working and that you have a good version of unfolding. Could you comment where did you get the unfolding library? Did you downloaded from the website?

    Kf

  • Yes, from the website.

    When I do not use GLConstants.GLGRAPHICS in the setup, it shows me a map and it works fine but it does not have all the features I need.

    I found a couple similar topics and most of them say that the problem is that Processing 2.0 is not compatible with unfolding.

    I am not sure how to get Processing 1.5 into eclipse or where to get it or if I need to use a different map library.

  • @M_Vys

    My suggestion is that you get the latest Processing (v3.3.6) and get unfolding running there. However, the unfolding libraries in the website doe snot work for Processing 3. I will tag @tnagel and hopefully he will contribute to this post and he will provide you a zip file with the latest unfolding library. The way I will do it is to get a test program running in Processing and then export your project to Eclipse.

    I do not have experience with Processing 1x or 2x, so I cannot help with the current available jars from the unfoldingmaps' website.

    @tnagel: Could I get a copy of the latest jars of your library as well. I believe there was a recent release if I am not mistaken.

    Kf

  • @kfrajer I sent you a msg.

    Anyone else, please send us an e-mail to our unfolding e-mail, or sent me a msg on this forum (but this might take a while before I notice).

Sign In or Register to comment.