... the user friendly GPS tool


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Brouter meets GPXCreator
#2
Hallo,

seit heute gibt es eine neue BrouterVersion 0.96. Diese funktioniert jetzt, da es einen synchronen Routingaufruf gibt, bei mir sehr gut. Anbei der Sourcecode, welcher den Brouter aufruft und die entsprechenden Outputfiles erzeugt.
Fehlt nur noch der Einbau in RC Wink

Code:
package womisa.brouter;

import java.util.ArrayList;
import java.util.List;


import btools.router.OsmNodeNamed;
import btools.router.RoutingContext;
import btools.router.RoutingEngine;

public class BRouter {

    public void findROUTE(Double fromLon, Double fromLat, Double toLon, Double toLat) {
        List<OsmNodeNamed> wplist2 = createWaypointList(fromLon, fromLat, toLon, toLat);
        System.out.println("From:" + fromLon + "  " + fromLat);
        System.out.println("  To:" + toLon + "  " + toLat);
//        File fileXX = new File((new File(".").getCanonicalPath()) + "/output/);


        RoutingContext c = new RoutingContext();
        c.localFunction = "profiles2/trekking.brf";
        RoutingEngine re=new RoutingEngine("output/mytrack", "output/mylog", "segments2", wplist2, c);
        re.doRun( 0 );
        if ( re.getErrorMessage() != null )
        {
            System.out.println( re.getErrorMessage() );
        }
    }

    private List<OsmNodeNamed> createWaypointList(Double fromLon, Double fromLat, Double toLon, Double toLat) {
        List<OsmNodeNamed> wplist = new ArrayList<OsmNodeNamed>();
        OsmNodeNamed n = new OsmNodeNamed();
        n.name = "from";
        n.ilon = (int) ((fromLon + 180.) * 1000000. + 0.5);
        n.ilat = (int) ((fromLat + 90.) * 1000000. + 0.5);
        wplist.add(n);

        n = new OsmNodeNamed();
        n.name = "to";
        n.ilon = (int) ((toLon + 180.) * 1000000. + 0.5);
        n.ilat = (int) ((toLat + 90.) * 1000000. + 0.5);
        wplist.add(n);
        return wplist;
    }
}
Grüsse Achim
Reply


Messages In This Thread
Brouter meets GPXCreator - by womisa - 20.10.2013, 17:06
RE: Brouter meets GPXCreator - by womisa - 27.10.2013, 21:48
RE: Brouter meets GPXCreator - by womisa - 29.10.2013, 17:34
RE: Brouter meets GPXCreator - by kumo - 11.01.2014, 12:05
RE: Brouter meets GPXCreator - by kumo - 13.01.2014, 15:50

Forum Jump:


Users browsing this thread: 1 Guest(s)