Give some examples (Unfolding library)

Hello @Ciosiek ,

This example uses Processing 4.3 library and Unfolding 0.9.92 library and worked in Visual Studio Code 1.88.1:

import processing.core.*;

import java.util.List;

import de.fhpotsdam.unfolding.UnfoldingMap;
import de.fhpotsdam.unfolding.data.Feature;
//import de.fhpotsdam.unfolding.geo.Location;
import de.fhpotsdam.unfolding.marker.Marker;
import de.fhpotsdam.unfolding.utils.MapUtils;
import de.fhpotsdam.unfolding.data.GPXReader; //GPX Reader

public class App extends PApplet {
    UnfoldingMap map;

    public void setup() {
        map = new UnfoldingMap(this, 0, 0, width, height);
        MapUtils.createDefaultEventDispatcher(this, map);

        // Load location
        String url1 = "https://raw.githubusercontent.com/gps-touring/sample-gpx/master/RoscoffCoastal/Trebeurden_Lannion_parcours13.2RE.gpx";

        List<Feature> features = GPXReader.loadData(this, url1);

        List<Marker> markers = MapUtils.createSimpleMarkers(features);
        map.addMarkers(markers);

        map.zoomAndPanToFitAllMarkers();
    }

    public void draw() {
        background(240);

        // Draw map tiles and country markers
        map.draw();
    }

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

    static public void main(String[] passedArgs) {
        String[] appletArgs = new String[] { "App" };
        if (passedArgs != null) {
            PApplet.main(concat(appletArgs, passedArgs));
        } else {
            PApplet.main(appletArgs);
        }
    }
}

This is a link to the Unfolding 0.9.92 library I used:

I did initially have this issue in Virtual Studio Code:

java.lang.UnsatisfiedLinkError: Can't load library: D:\Users\GLV\Documents\VS Code\P4.3\test_java 1 0 0\Test\natives\windows-amd64\gluegen_rt.dll

Adding the line with vmArgs (for my system) to the launch.json resolved the issue:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        
        {
            "type": "java",
            "name": "Current File",
            "request": "launch",
            "mainClass": "${file}"
        },
        {
            "type": "java",
            "name": "App",
            "request": "launch",
            "mainClass": "App",
            "projectName": "Test_8db5bd73",
            "vmArgs": "-Djava.library.path=D:\\Program_Portable\\processing-4.3\\core\\library\\windows-amd64"
        }
    ]
}

I did not use these in my exploration since I am working with the latest Unfolding 0.9.92 version:

This was my first effort using Visual Studio Code and was able to make this work with some effort. Some experience with Eclipse helped.

I may keep using Visual Code Studio!

Keep at it!

:)

1 Like