Package com.mapmidlet.projection

Examples of com.mapmidlet.projection.WorldCoordinate


        RecordStore recordStore = null;
        markers = new Vector();
        routeEnds = new Vector();
        for (int i = 0; i < 2; i++) {
            ScreenMarker routeEnd = new ScreenMarker();
            routeEnd.worldCoordinate = new WorldCoordinate();
            routeEnd.worldCoordinate.latitude = Double.NaN;
            routeEnd.worldCoordinate.longitude = Double.NaN;
            routeEnds.addElement(routeEnd);
            routeEnd.iconName = "route_point.png";
        }
        try {
            recordStore = RecordStore.openRecordStore("MapMidlet Options", true);
            if (recordStore != null && recordStore.getNumRecords() > 0) {
                RecordEnumeration records = recordStore.enumerateRecords(null, null, false);
                byte[] record = records.nextRecord();
                ByteArrayInputStream byteStream = new ByteArrayInputStream(record);
                DataInputStream dataStream = new DataInputStream(byteStream);

                useFileApi = dataStream.readBoolean();
                rootName = dataStream.readUTF();
                String tileProvider = dataStream.readUTF();
                setTileFactory(tileProvider);
                debugMode = dataStream.readBoolean();
                gpsUrl = dataStream.readUTF();
                gpsEnabled = dataStream.readBoolean();
                fadeEffect = dataStream.readBoolean();

                fileReadInSeparateThread = dataStream.readBoolean();
                maxRetries = dataStream.readInt();
                onlineMode = dataStream.readBoolean();

                center = new WorldCoordinate();

                center.latitude = dataStream.readDouble();
                center.longitude = dataStream.readDouble();

                zoom = dataStream.readInt();
View Full Code Here


        gpsEnabled = false;
        gpsUrl = "socket://localhost:20175";
        zoom = 1;
        setTileFactory((String) tileFactories.keys().nextElement());

        center = new WorldCoordinate();

        skinPath = "default";
        replayDir = IOTool.getDefaultNmeaLogsDir();
        replaySpeed = 1;
        debugMode = true;
View Full Code Here

                for (int i = 0; i < array.length(); i++) {
                    JSONObject feature = array.getJSONObject(i);
                    ScreenMarker result = new ScreenMarker();
                    result.name = feature.getJSONObject("properties").getString("name");
                    JSONArray coordinates = feature.getJSONObject("centroid").getJSONArray("coordinates");
                    WorldCoordinate worldCoordinate = new WorldCoordinate();
                    worldCoordinate.latitude = coordinates.getDouble(0);
                    worldCoordinate.longitude = coordinates.getDouble(1);
                    result.worldCoordinate = worldCoordinate;
                    result.iconName = "search_result.png";
                    result.visible = true;
View Full Code Here

    public Route getRoute(WorldCoordinate c1, WorldCoordinate c2) {
        if (lastC1 != null && lastC1.latitude == c1.latitude && lastC1.longitude == c1.longitude
                && lastC2.latitude == c2.latitude && lastC2.longitude == c2.longitude) {
            return lastRoute;
        }
        lastC1 = new WorldCoordinate(c1);
        lastC2 = new WorldCoordinate(c2);

        try {
            String routeGpx = IOTool.download("http://routes.cloudmade.com/e4b1777b4b5154d69dbfc4678216183a/api/0.3/"
                    + c1.latitude + "," + c1.longitude + "," + c2.latitude + "," + c2.longitude + "/"
                    + ROUTING_OPTIONS.get(Options.getInstance().routeType) + "?units=km&lang=en");
            if (Options.getInstance().debugMode) {
                System.out.println(routeGpx);
            }
            XmlParser parser = new XmlParser(new InputStreamReader(new ByteArrayInputStream(routeGpx.getBytes())));
            Document doc = new Document();
            doc.parse(parser);
            parser = null;
            Element root = doc.getRootElement();
            Route result = new Route();
            result.waypoints = new Vector();
            result.routeDirections = new Vector();
            for (int i = 0; i < root.getChildCount(); i++) {
                Object child = root.getChild(i);
                if (child instanceof Element) {
                    Element elem = (Element) child;
                    String name = elem.getName();
                    if (name.equals("extensions")) {
                        for (int j = 0; j < elem.getChildCount(); j++) {
                            Object child2 = elem.getChild(i);
                            if (child2 instanceof Element) {
                                Element elem2 = (Element) child2;
                                if (elem2.getName().equals("distance")) {
                                    result.distance = Long.parseLong(elem2.getText());
                                }
                            }

                        }
                    } else if (name.equals("wpt")) {
                        WorldCoordinate c = new WorldCoordinate();
                        c.latitude = Double.parseDouble(elem.getAttribute("lat").getValue());
                        c.longitude = Double.parseDouble(elem.getAttribute("lon").getValue());
                        result.waypoints.addElement(c);
                    } else if (name.equals("rte")) {
                        for (int j = 0; j < elem.getChildCount(); j++) {
View Full Code Here

    public void print() {
        System.out.println("distance=" + distance + "");
        System.out.println("waypoints:");
        for (int i = 0; i < waypoints.size(); i++) {
            WorldCoordinate c = (WorldCoordinate) waypoints.elementAt(i);
            System.out.println("    lat=" + c.latitude + ", lon=" + c.longitude);
        }
        System.out.println("route directions:");
        for (int i = 0; i < routeDirections.size(); i++) {
            RouteDirection d = (RouteDirection) routeDirections.elementAt(i);
View Full Code Here

    }

    private void setCoordinates(String[] strings, int i) {

        if (gpsState.worldCoordinate == null) {
            gpsState.worldCoordinate = new WorldCoordinate();
        } else {
            if (gpsState.prevWorldCoordinate == null) {
                gpsState.prevWorldCoordinate = new WorldCoordinate();
            }
            gpsState.prevWorldCoordinate.latitude = gpsState.worldCoordinate.latitude;
            gpsState.prevWorldCoordinate.longitude = gpsState.worldCoordinate.longitude;
        }
        if ("N".equals(strings[i + 1])) {
View Full Code Here

TOP

Related Classes of com.mapmidlet.projection.WorldCoordinate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.