unfolding icon indicating copy to clipboard operation
unfolding copied to clipboard

Template with examples not working

Open Amoranemix opened this issue 4 years ago • 18 comments

Dear Github members,

I have started a course on Object Oriented programming in Java from UCSD via the Coursera platform and using Eclipse. (I am not familiar with Eclipse.) The exercises are based on Unfolding Maps. The teachers made a starter program that we are supposed to extend , but that doesn't work. The reason seems to be that their program uses the no longer supported AppletViewer.

I decided to try out Unfolding Maps myself in the hope of learning how to modify the starter program from UCSD such that it works. So I downloaded unfolding_app_template_with_examples_0.9.6.zip and imported it in Eclipse.

I tried JDK 1.8 and 12. Running the first example, SimpleMapApp failed with both. With JDK 12, running as Java applet, the following error message is displayed in the console :

Error: Could not find or load main class sun.applet.AppletViewer
Caused by: java.lang.ClassNotFoundException: sun.applet.AppletViewer

Running as Java application, an empty map window appears and the following message in the console :

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jogamp.common.os.NativeLibrary$3 (file:/C:/Users/Frank%20Tavernier/Documents/School/eclipse-workspace/unfolding-app-template-with-examples/lib/gluegen-rt.jar) to method java.lang.ClassLoader.findLibrary(java.lang.String)
WARNING: Please consider reporting this to the maintainers of com.jogamp.common.os.NativeLibrary$3
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Unfolding Map v0.9.6
Using OpenGLMapDisplay with processing.opengl.PGraphics2D
server.org/tiles/bw-mapnik/10/549/336.png contains bad image data, or may not be an image.
The file http://a.www.toolserver.org/tiles/bw-mapnik/10/550/336.png contains bad image data, or may not be an image.
The file http://a.www.toolserver.org/tiles/bw-mapnik/10/549/335.png contains bad image data, or may not be an image.
The file http://a.www.toolserver.org/tiles/bw-mapnik/10/548/335.png contains bad image data, or may not be an image.
The file http://a.www.toolserver.org/tiles/bw-mapnik/10/548/336.png contains bad image data, or may not be an image.

+about 30 more similar lines

Can anyone explain how to make Unfolding Map work with Eclipse ?

Amoranemix avatar Sep 11 '19 18:09 Amoranemix

Please try out the latest beta at http://services.informatik.hs-mannheim.de/~nagel/GDV/unfolding_app_template_with_examples_0.9.92.zip

tillnagel avatar Sep 12 '19 09:09 tillnagel

Thanks for the suggestion.

I imported that new version. When running the first example, HellowUnfoldingWorld.java, with JDK 12, the console displays :

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jogamp.common.os.NativeLibrary$3 (file:/C:/Users/Frank%20Tavernier/Documents/School/eclipse-workspace/unfolding-app-template-with-examples/lib/gluegen-rt.jar) to method java.lang.ClassLoader.findLibrary(java.lang.String)
WARNING: Please consider reporting this to the maintainers of com.jogamp.common.os.NativeLibrary$3
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Unfolding Map v0.9.92
Using OpenGLMapDisplay with processing.opengl.PGraphics2D

A window opens that displays black. I suspect it is supposed to display a map.

I haven't set the native library as instructed in the readme because I don't know how to do that.

Amoranemix avatar Sep 12 '19 13:09 Amoranemix

Could you try Java 1.8 again?

tillnagel avatar Sep 12 '19 14:09 tillnagel

Running HelloUnfoldingWorld.java under JDK 1.8 does the same, except that there are no warnings.

Amoranemix avatar Sep 12 '19 14:09 Amoranemix

Is this HelloUnfoldingWorld example app the one from the distribution (i.e. from the Unfolding project), or one from the UCSD course? Please use the one from the distribution, or paste the code here.

tillnagel avatar Sep 12 '19 14:09 tillnagel

It is an example from the package that I downloaded from the link you posted, version 0.9.92.

Amoranemix avatar Sep 12 '19 14:09 Amoranemix

Ok, try out the SatelliteProviderMapApp to check if are able to see a map there.

Do you have a firewall prohibiting outgoing requests (the map tile images are requested from external servers).

tillnagel avatar Sep 13 '19 09:09 tillnagel

No. Running SatelliteProviderMapApp.java also shows a window that is filled with black, both under JDK 1.8 and 12.

As firewalls I have a router and Windows 10 Defender. I have had no problems with them since I have this computer, that is since 14 months ago. Temporarily disabling the latter appears to make no difference.

Amoranemix avatar Sep 13 '19 11:09 Amoranemix

If I understand correctly, there is no good way to use Unfolding Maps, at least not on my computer.

Amoranemix avatar Sep 23 '19 11:09 Amoranemix

Yes, seems like it. I am very sorry for that, but haven't heard of your problem before.

Last question: Did you try other OpenGL examples (from Processing and/or JOGL)? Do any of these examples work on your computer?

tillnagel avatar Sep 23 '19 14:09 tillnagel

No. How can I find these other OpenGL examples from Processing and/or OpenGL ?

Amoranemix avatar Sep 23 '19 18:09 Amoranemix

See e.g. https://processing.org/tutorials/p3d/

tillnagel avatar Sep 23 '19 18:09 tillnagel

I downloaded and installed Processing, which to my surprise was easy. Then I pasted the following code in the top of 2 windows :

float x,y,z; void setup() { size(200,200,P3D); x = width/2; y = height/2; z = 0; } void draw() { translate(x,y,z); rectMode(CENTER); rect(0,0,100,100); z++; // The rectangle moves forward as z increments. }

Then I told Processing to run that code and to my surprise it did. A window with a changing rectangle appeared. Warnings nor error messages appeared.

I tried using that code in Eclipse, but it tells me there are syntax errors in the code, like “P3D cannot be resolved to a variable”.

Amoranemix avatar Sep 24 '19 07:09 Amoranemix

Hi. I also used that version 0.9.92 yesterday, using IntellJ, using JDK 1.8. the SimpleMapApp needed a small change wrt using size() to adhere to the processing.org 3.0 style. I also set it to use JAVA2D instead of OPENGL.

package de.fhpotsdam.unfolding.examples;

import processing.core.PApplet;
import de.fhpotsdam.unfolding.UnfoldingMap;
import de.fhpotsdam.unfolding.geo.Location;
import de.fhpotsdam.unfolding.utils.MapUtils;

/**
 * An application with a basic interactive map. You can zoom and pan the map.
 */
public class SimpleMapApp extends PApplet {

	UnfoldingMap map;

	public void settings() {
		size(800, 600, JAVA2D);
	}

	public void setup() {
		map = new UnfoldingMap(this);
		map.zoomAndPanTo(10, new Location(52.5f, 13.4f));
		MapUtils.createDefaultEventDispatcher(this, map);
	}

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

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

This does show up for me.

r-hmn avatar Sep 26 '19 11:09 r-hmn

@ r-hmn: Using Eclipse, in the code of SimpleMapApp.java of the unfolding-app-template-with-examples package I replaced P2D with JAVA2D. I don't understand the other modification you suggested.

With that single change the program creates an interactive map showing Berlin.

I went back to my original problem with the UCSDUnfoldingMaps package and managed to make that work too with JDK 1.8 and JAVA2D as argument for size() i.s.o. P2D.

In the console the comment “No OpenGL renderer. Using Java2DMapDisplay.” appears when either program is run.

Amoranemix avatar Sep 26 '19 17:09 Amoranemix

I also tried to run the "SimpleMapApp" in Eclipse but this exception message always appears:

Exception in thread "main" java.lang.ExceptionInInitializerError Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 at processing.core.PApplet.(PApplet.java:118)

I have no experience with Eclipse. Could anyone tell me what should I modify?

rochanofa avatar Jan 29 '20 21:01 rochanofa

type following inside the HelloWorld class and Run as a Java application. It worked fine for me.

public static void main (String[] args) {

PApplet.main(module1.HelloWorld.class.getName());

}

Isurumax26 avatar Jun 26 '20 19:06 Isurumax26

Ok, try out the SatelliteProviderMapApp to check if are able to see a map there.

Do you have a firewall prohibiting outgoing requests (the map tile images are requested from external servers).

Thanks for this. For me the issue is RESOLVED here. It was due to my firewall blocking the images being loaded.

hiralshah265 avatar Sep 24 '20 13:09 hiralshah265