Eclipse + Processing 3.2.1 + UnfoldingMaps的错误

时间:2016-09-11 13:48:29

标签: eclipse processing

我下载了最新的JOGL,Processing 3.2.1并尝试编译此代码:

 
var mouseDownStart = 0,
    lastKeyupTime = 0;

function processKeyDown() {
  if (!mouseDownStart) {
    mouseDownStart = Date.now();
  }
}

function processKeyUp() {
  var now = Date.now(),
      isDoubleClick = lastKeyupTime && now - lastKeyupTime < 500;
      isHighliting = now - mouseDownStart > 150

  lastKeyupTime = now;
  mouseDownStart = 0;

  return {
    isDoubleClick: isDoubleClick,
    isHighliting: isHighliting
  }
}

$('#text').on('mousedown', function (e) {
  processKeyDown();
});


$('#text').on('mouseup', function (e) {
  var data = processKeyUp();
  if (data.isDoubleClick || data.isHighliting) return;
  $('#chatInput').focus();
});

然后我在控制台中收到此消息,无法在互联网上找到任何信息:

import de.fhpotsdam.unfolding.UnfoldingMap;
import de.fhpotsdam.unfolding.geo.Location;
import de.fhpotsdam.unfolding.providers.AbstractMapProvider;
import de.fhpotsdam.unfolding.providers.Google;
import de.fhpotsdam.unfolding.providers.MBTilesMapProvider;
import de.fhpotsdam.unfolding.providers.Microsoft;
import de.fhpotsdam.unfolding.providers.OpenStreetMap;
import de.fhpotsdam.unfolding.providers.Yahoo;
import de.fhpotsdam.unfolding.utils.MapUtils;
import processing.core.PApplet;

public class TwoMaps extends PApplet {

public UnfoldingMap map1;
public UnfoldingMap map2;

public static void main(String[] args) {
    PApplet.main("TwoMaps");


}

public void settings() {

    size(800, 600, P2D);

}



public void setup() {

    String mbTilesString = "blankLight-1-3.mbtiles";

    final boolean offline = false;

    this.background(200, 200, 200);

    AbstractMapProvider provider = new Microsoft.RoadProvider(); 
    int zoomLevel = 10;

    if (offline) {
        provider = new MBTilesMapProvider(mbTilesString);
        zoomLevel = 3;
    }

    map1 = new UnfoldingMap(this, 50, 50, 350, 500, provider);
    map2 = new UnfoldingMap(this, 425, 50, 350, 500, provider);

    map1.zoomAndPanTo(zoomLevel, new Location(32.9f, -117.2f));
    map2.zoomAndPanTo(zoomLevel, new Location(55.45f, 40f));

    MapUtils.createDefaultEventDispatcher(this, map1);
    MapUtils.createDefaultEventDispatcher(this, map2);

}

public void draw() {
    map1.draw();
    map2.draw();
}

}

但是,如果我不在Unfolding Map v0.9.6 java.lang.RuntimeException: java.lang.NoSuchFieldError: quality at processing.opengl.PSurfaceJOGL$2.run(PSurfaceJOGL.java:461) 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 TwoMaps.setup(TwoMaps.java:47) at processing.core.PApplet.handleDraw(PApplet.java:2387) at processing.opengl.PSurfaceJOGL$DrawListener.display(PSurfaceJOGL.java:871) 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) 方法中使用渲染P2D,那么它可以正常工作,但效果很差且很慢,并且只显示一张地图。

但最有趣的是,如果我使用Processing 2.2.1,其中scetch的基类是java.Applet,那么代码甚至可以在size()方法中使用P2D

AMD Mobility Radeon HD 5000驱动程序是最新版本。

1 个答案:

答案 0 :(得分:3)

看起来展开地图与处理3不兼容。现在你将不得不坚持处理2。

如果你真的,真的,真的需要使用Processing 3,你可以在这里尝试答案:Creating UnfoldingMap instance with java.lang.NoSuchFieldError: quality error

但你最好回到Processing 2。

另一个注意事项:你根本不应该下载JOGL。 Processing附带了它需要的JOGL版本。你应该使用那个版本的JOGL,而不是你单独下载的新版本。