Creating UnfoldingMap instance with java.lang.NoSu

2019-07-18 13:14发布

I try to create PApplet (Processing) with UnfoldingMap (v0.9.6). Unfortunatelly I get java.lang.NoSuchFieldError: quality error at this line: map = new UnfoldingMap(this, p1). What may be the reason if it?

import de.fhpotsdam.unfolding.UnfoldingMap;
import de.fhpotsdam.unfolding.providers.AbstractMapProvider;
import de.fhpotsdam.unfolding.providers.Google;
import de.fhpotsdam.unfolding.utils.MapUtils;
import processing.core.PApplet;

public class MyPApplet2 extends PApplet{

    UnfoldingMap map;

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

    public void settings() {
        size(400, 400, P2D);
    }

    public void setup() {
        AbstractMapProvider p1 = new Google.GoogleTerrainProvider();
        map = new UnfoldingMap(this, p1);
        MapUtils.createDefaultEventDispatcher(this, map);       
    }

    public void draw() {        
        map.draw();
    }   
}

I receive the following error:

Exception in thread "Thread-3" java.lang.RuntimeException: java.lang.NoSuchFieldError: quality
    at processing.opengl.PSurfaceJOGL$2.run(PSurfaceJOGL.java:443)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoSuchFieldError: quality
    at de.fhpotsdam.unfolding.mapdisplay.OpenGLMapDisplay.<init>(Unknown Source)
    at de.fhpotsdam.unfolding.mapdisplay.MapDisplayFactory.getMapDisplay(Unknown Source)
    at de.fhpotsdam.unfolding.UnfoldingMap.<init>(Unknown Source)
    at de.fhpotsdam.unfolding.UnfoldingMap.<init>(Unknown Source)
    at module3.MyPApplet2.setup(MyPApplet2.java:23)
    at processing.core.PApplet.handleDraw(PApplet.java:2374)
    at processing.opengl.PSurfaceJOGL$DrawListener.display(PSurfaceJOGL.java:731)
    at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:692)
    at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:674)
    at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:443)
    at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293)
    at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147)
    at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:759)
    at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:81)
    at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:452)
    at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178)
    at java.util.TimerThread.mainLoop(Unknown Source)
    at java.util.TimerThread.run(Unknown Source)

1条回答
我只想做你的唯一
2楼-- · 2019-07-18 13:58

This error is thrown because we changed the definition of a specific class and we didn’t re-compile those classes that have a reference to that class.

 /**
 * Creates a new full canvas map with the given ID.
 * 
 * @param p
 *            The main applet.
 * @param id
 *            The ID of this map.
 */
public UnfoldingMap(PApplet p, String id) {
    this(p, id, 0, 0, p.width, p.height, true, false, null, null);
}

Try to use something like this:

    AbstractMapProvider p1 = new Google.GoogleTerrainProvider(); 
    settings();
    map = new UnfoldingMap(this, 50, 50, 500, 350, p1);
查看更多
登录 后发表回答