Package slash.common.type

Examples of slash.common.type.CompactCalendar


                        }
                    }

                    if (!position.hasTime()) {
                        LongitudeAndLatitude lal = new LongitudeAndLatitude(position.getLongitude(), position.getLatitude());
                        CompactCalendar time = times.get(lal);
                        if (time != null) {
                            position.setTime(time);
                        }
                    }
                }
View Full Code Here


        assertEquals("E", position.getLongitudeAsValueAndOrientation().getOrientation().value());
        assertDoubleEquals(6.8534666667, position.getLongitude());
        assertDoubleEquals(49.24945, position.getLatitude());
        assertDoubleEquals(199.0, position.getElevation());
        String actual = DateFormat.getDateTimeInstance().format(position.getTime().getTime());
        CompactCalendar expectedCal = calendar(2007, 3, 21, 15, 22, 24);
        String expected = DateFormat.getDateTimeInstance().format(expectedCal.getTime());
        assertEquals(expected, actual);
        assertEquals(expectedCal, position.getTime());
        assertEquals("Kllertal-Radweg", position.getDescription());
    }
View Full Code Here

        assertEquals("E", position.getLongitudeAsValueAndOrientation().getOrientation().value());
        assertDoubleEquals(6.8534683333, position.getLongitude());
        assertDoubleEquals(49.2494533333, position.getLatitude());
        assertDoubleEquals(199.0, position.getElevation());
        String actual = DateFormat.getDateTimeInstance().format(position.getTime().getTime());
        CompactCalendar expectedCal = calendar(2007, 3, 21, 15, 22, 24);
        String expected = DateFormat.getDateTimeInstance().format(expectedCal.getTime());
        assertEquals(expected, actual);
        assertEquals(expectedCal, position.getTime());
        assertEquals("Kllertal-Radweg", position.getDescription());

        StringWriter writer = new StringWriter();
View Full Code Here

        Wgs84Position position = format.parsePosition("(47.13336181640625,15.496421813964844,401.0,1370092005)", null);
        assertDoubleEquals(15.496421813964844, position.getLongitude());
        assertDoubleEquals(47.13336181640625, position.getLatitude());
        assertDoubleEquals(401.0, position.getElevation());
        String actual = DateFormat.getDateTimeInstance().format(position.getTime().getTime());
        CompactCalendar expectedCal = utcCalendar(1370092005000L);
        String expected = DateFormat.getDateTimeInstance().format(expectedCal.getTime());
        assertEquals(expected, actual);
        assertEquals(expectedCal, position.getTime());
        assertNull(position.getDescription());
    }
View Full Code Here

        assertEquals(207.0, position.getHeading());
        assertEquals(1.6, position.getPdop());
        assertEquals(1.3, position.getHdop());
        assertEquals(0.9, position.getVdop());
        String actual = DateFormat.getDateTimeInstance().format(position.getTime().getTime());
        CompactCalendar expectedCal = calendar(2009, 5, 8, 8, 48, 15);
        String expected = DateFormat.getDateTimeInstance().format(expectedCal.getTime());
        assertEquals(expected, actual);
        assertEquals(expectedCal, position.getTime());
        assertEquals("VOX02971", position.getDescription());
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    private BaseRoute parseRoute(List<String> coordinates, NavigationPosition before, NavigationPosition after) {
        BaseRoute route = new NavigatingPoiWarnerFormat().createRoute(Waypoints, null, new ArrayList<NavigationPosition>());
        // count backwards as inserting at position 0
        CompactCalendar time = after.getTime();
        int positionInsertionCount = coordinates.size() / 5;
        for (int i = coordinates.size() - 1; i > 0; i -= 5) {
            String instructions = trim(coordinates.get(i));
            Double seconds = parseSeconds(coordinates.get(i - 1));
            // Double meters = parseDouble(coordinates.get(i - 2));
            Double longitude = parseDouble(coordinates.get(i - 3));
            Double latitude = parseDouble(coordinates.get(i - 4));
            if (seconds != null && time != null) {
                Calendar calendar = time.getCalendar();
                calendar.add(SECOND, -seconds.intValue());
                time = fromCalendar(calendar);
            }
            int positionNumber = positionsModel.getRowCount() + (positionInsertionCount - route.getPositionCount()) - 1;
            String description = instructions != null ? instructions : mapViewCallback.createDescription(positionNumber, null);
View Full Code Here

        */

        byte hdop = buffer.get();
        byte satellites = buffer.get();
        buffer.getShort(); //Second resolution 0.001  --> ignore
        CompactCalendar dateTime = decodeDateTime(buffer.getInt());
        buffer.getInt(); //SVs in solution --> ignore
        int latitude = buffer.getInt();
        int longitude = buffer.getInt();
        int altitudeCm = buffer.getInt();
        short speedMeterPerSecond = buffer.getShort();
View Full Code Here

    }

    public BoundingBox(List<? extends NavigationPosition> positions) {
        double maximumLongitude = -180.0, maximumLatitude = -90.0,
                minimumLongitude = 180.0, minimumLatitude = 90.0;
        CompactCalendar maximumTime = null, minimumTime = null;

        for (NavigationPosition position : positions) {
            Double longitude = position.getLongitude();
            if (longitude == null)
                continue;
            if (longitude > maximumLongitude)
                maximumLongitude = longitude;
            if (longitude < minimumLongitude)
                minimumLongitude = longitude;
            Double latitude = position.getLatitude();
            if (latitude == null)
                continue;
            if (latitude > maximumLatitude)
                maximumLatitude = latitude;
            if (latitude < minimumLatitude)
                minimumLatitude = latitude;
            CompactCalendar time = position.getTime();
            if (time == null)
                continue;
            if (maximumTime == null || time.after(maximumTime))
                maximumTime = time;
            if (minimumTime == null || time.before(minimumTime))
                minimumTime = time;
        }
        this.northEast = new SimpleNavigationPosition(maximumLongitude, maximumLatitude, maximumTime);
        this.southWest = new SimpleNavigationPosition(minimumLongitude, minimumLatitude, minimumTime);
    }
View Full Code Here

        if(longitude != 0.0)
            longitude /=2;
        double latitude = southWest.getLatitude() + northEast.getLatitude();
        if (latitude != 0.0)
            latitude /=2;
        CompactCalendar time = null;
        if (northEast.hasTime() && southWest.hasTime()) {
            long millis = northEast.getTime().getTimeInMillis() +
                    (southWest.getTime().getTimeInMillis() - northEast.getTime().getTimeInMillis()) / 2;
            time = fromMillis(millis);
        }
View Full Code Here

    private void recalculateDistance() {
        fireCalculatedDistance(0, 0);

        double distanceMeters = 0.0;
        long totalTimeMilliSeconds = 0;
        CompactCalendar minimumTime = null, maximumTime = null;
        NavigationPosition previous = null;
        for (int i = 0; i < positionsModel.getRowCount(); i++) {
            NavigationPosition next = positionsModel.getPosition(i);
            if (previous != null) {
                Double distance = previous.calculateDistance(next);
                if (distance != null)
                    distanceMeters += distance;
                Long time = previous.calculateTime(next);
                if (time != null && time > 0)
                    totalTimeMilliSeconds += time;
            }

            CompactCalendar time = next.getTime();
            if (time != null) {
                if (minimumTime == null || time.before(minimumTime))
                    minimumTime = time;
                if (maximumTime == null || time.after(maximumTime))
                    maximumTime = time;
            }

            if (i > 0 && i % 100 == 0)
                fireCalculatedDistance((int) distanceMeters, totalTimeMilliSeconds > 0 ? (int) (totalTimeMilliSeconds / 1000) : 0);
View Full Code Here

TOP

Related Classes of slash.common.type.CompactCalendar

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.