我尝试使用UnfoldingMap(v0.9.6)创建PApplet(处理)。不幸的是,我在这一行得到 java.lang.NoSuchFieldError:quality 错误:map = new UnfoldingMap(this,p1)。可能是什么原因呢?
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();
}
}
我收到以下错误:
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)
答案 0 :(得分:0)
抛出此错误是因为我们更改了特定类的定义,并且我们没有重新编译那些引用该类的类。
/**
* 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);
}
尝试使用以下内容:
AbstractMapProvider p1 = new Google.GoogleTerrainProvider();
settings();
map = new UnfoldingMap(this, 50, 50, 500, 350, p1);