Examples of WorldCoordinate


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

Examples of com.mapmidlet.projection.WorldCoordinate

        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

Examples of com.mapmidlet.projection.WorldCoordinate

                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

Examples of com.mapmidlet.projection.WorldCoordinate

    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

Examples of com.mapmidlet.projection.WorldCoordinate

    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

Examples of com.mapmidlet.projection.WorldCoordinate

    }

    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

Examples of mods.railcraft.api.core.WorldCoordinate

            rebuildDelay++;
            if (rebuildDelay >= REBUILD_DELAY.length)
                rebuildDelay = REBUILD_DELAY.length - 1;
            rebuildQueue();
        }
        WorldCoordinate index = getNextLavaBlock(true);

        if (index != null && coolLava(index.x, index.y, index.z)) {
            charge++;
            rebuildDelay = 0;
        }
View Full Code Here

Examples of mods.railcraft.api.core.WorldCoordinate

    private WorldCoordinate getNextLavaBlock(boolean remove) {
        if (queue.isEmpty())
            return null;

        if (remove) {
            WorldCoordinate index = queue.pollFirst();
            return index;
        }
        return queue.peekFirst();
    }
View Full Code Here

Examples of mods.railcraft.api.core.WorldCoordinate

        queueForFilling(x, y + 1, z);
        queueForFilling(x, y - 1, z);
    }

    public void queueForFilling(int x, int y, int z) {
        WorldCoordinate index = new WorldCoordinate(0, x, y, z);
        if (visitedBlocks.add(index)) {
            if ((x - xCoord) * (x - xCoord) + (z - zCoord) * (z - zCoord) > 64 * 64)
                return;

            Block block = WorldPlugin.getBlock(worldObj, x, y, z);
View Full Code Here

Examples of mods.railcraft.api.core.WorldCoordinate

            NBTTagCompound nbt = data.getCompoundTag("last");
            int dim = nbt.getInteger("dim");
            int x = nbt.getInteger("x");
            int y = nbt.getInteger("y");
            int z = nbt.getInteger("z");
            lastMarker = new WorldCoordinate(dim, x, y, z);
        }
        colorSeed = data.getLong("seed");
        timestamp = data.getLong("time");
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.