Unfolding Map

Is there anyone who can help me with unfolding map. i want to create markers on map and want to save them too in .csv file so that if i want my device to follow that path . it will follow that without any error.

import de.fhpotsdam.unfolding.providers.Microsoft;
import de.fhpotsdam.unfolding.*;
import de.fhpotsdam.unfolding.utils.*;
import de.fhpotsdam.unfolding.marker.*;
import de.fhpotsdam.unfolding.geo.*;


UnfoldingMap map ;
SimpleLinesMarker connectionMarker;

UnfoldingMap currentMap; 

void setup() {
  size(800, 600);
  map = new UnfoldingMap(this, new Microsoft.AerialProvider());
  MapUtils.createDefaultEventDispatcher(this, map);
  currentMap = map;

  map = new UnfoldingMap(this);
  Location startLocation = new Location(32.2, 76.3);
  Location endLocation = new Location(53.35, -6.26);
  SimpleLinesMarker connectionMarker = new SimpleLinesMarker(startLocation, endLocation);
  MapUtils.createDefaultEventDispatcher(this, map);

}

void draw() {
  currentMap.draw();
}

void keyPressed() {
    if (key == '1') {
        currentMap = map;
    } 
}

Answers

  • i make two markers but they are not working

  • I would suggest approaching @tnagel. The examples provided in unfoldingmaps' website working with lines are not clear. My question to him is how do you associate line 22 to the currentMap object? I tried:

    currentMap.addMarkers(connectionMarker);

    but nothing happended.

    Kf

  • there is one issue too with this , all your control hide behind the map so you can only see when you map is in background . i am even working on that , need to make few controls on map so that i can change tab anytime when i want.

  • Answer ✓

    It seems you are using Unfolding for P3 beta which does not support the default renderer Java2D anymore. Simply use

    size(800, 600, P2D);

    and the line will show up. (You need to add your connectionMarker to the map, as @kfrajer suggested).

  • edited January 2017

    Also check out the examples

    marker.SimpleMarkerManagerApp Demonstrates simple line markers

    marker.custom.MyLinesMarkerApp Demonstrates creating own lines marker (extending SimpleLinesMarker)

    marker.connectionmarker.NeighborMarkersMap Demonstrates using connection marker for showing lines between two markers (instead of between two locations)

  • @tnagel : P2D , P3D , OPENGL is not working for me , now i am trying a different approach but still i am stuck and sure i will check all those link which you send me and let you know what result i get afterthat and yes you are right i am using P3version

  • and yes i have already checked all those examples but for that i think i need eclipse IDE for processing which i don't have and even have no idea if i link that with simple processing , will they work together or not and yes package making me some trouble , sorry never make one so that's the reason.

  • edited January 2017

    Thanks @tnagel !!!

    @James_Anderson

    This next code works for me.

    Kf

    import de.fhpotsdam.unfolding.providers.Microsoft;
    import de.fhpotsdam.unfolding.*;
    import de.fhpotsdam.unfolding.utils.*;
    import de.fhpotsdam.unfolding.marker.*;
    import de.fhpotsdam.unfolding.geo.*;
    
    
    UnfoldingMap map ;
    SimpleLinesMarker connectionMarker;
    
    UnfoldingMap currentMap; 
    boolean selectNow=false;
    
    void setup() {
      size(800, 600,P2D);
      //map = new UnfoldingMap(this, new Microsoft.AerialProvider());
      //MapUtils.createDefaultEventDispatcher(this, map);
      //currentMap = map;
    
      currentMap = new UnfoldingMap(this,0,0,width*0.8,height);
      Location startLocation = new Location(32.2, 76.3);  
      Location endLocation = new Location(53.35, -6.26);
      Location midLocation = new Location(32.2/2+53.35/2,76.3/2-6.26/2);
      currentMap.zoomAndPanTo(3,midLocation);
      connectionMarker = new SimpleLinesMarker(startLocation, endLocation);
      connectionMarker.setColor(color(25,25,250));
      connectionMarker.setStrokeWeight(4);
      connectionMarker.setHighlightColor(color(255,25,25));
      currentMap.addMarkers(connectionMarker);
      MapUtils.createDefaultEventDispatcher(this, currentMap);
    }
    
    void draw() {
      background(92);
      currentMap.draw();
      if(selectNow==true){
        text("Line\nHightlighted!",width*0.85,height/2);
      }
    }
    
    void keyPressed() {
      if (key == '1') {
        //currentMap = map;
      }
    }
    
    void mouseReleased(){
        connectionMarker.setSelected(selectNow=!selectNow);
    }
    
  • @kfrager : thank you but this is what i get when i try to runn above code . same error i am getting from long time

    Unfolding Map v0.9.6 java.lang.RuntimeException: java.lang.NoSuchFieldError: quality at processing.opengl.PSurfaceJOGL$2.run(PSurfaceJOGL.java:451) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NoSuchFieldError: quality at de.fhpotsdam.unfolding.mapdisplay.OpenGLMapDisplay.(Unknown Source) at de.fhpotsdam.unfolding.mapdisplay.MapDisplayFactory.getMapDisplay(Unknown Source) at de.fhpotsdam.unfolding.UnfoldingMap.(Unknown Source) at de.fhpotsdam.unfolding.UnfoldingMap.(Unknown Source) at sketch_170201b.setup(sketch_170201b.java:42) at processing.core.PApplet.handleDraw(PApplet.java:2378) at processing.opengl.PSurfaceJOGL$DrawListener.display(PSurfaceJOGL.java:861) 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(Timer.java:555) at java.util.TimerThread.run(Timer.java:505) Could not run the sketch (Target VM failed to initialize). For more information, read revisions.txt and Help ? Troubleshooting.

  • Seems like a versioning problem. Please name your Processing version, and which IDE you are using (I assume the Processing app, correct?).

  • @tnagel : i am using processing-3.1.1 version right now

Sign In or Register to comment.