Package slash.navigation.common

Examples of slash.navigation.common.NavigationPosition


        }
        return row;
    }

    private void movePosition(int row, Double longitude, Double latitude) {
        NavigationPosition reference = positionsModel.getPosition(row);
        Double diffLongitude = reference != null ? longitude - reference.getLongitude() : 0.0;
        Double diffLatitude = reference != null ? latitude - reference.getLatitude() : 0.0;

        boolean moveCompleteSelection = preferences.getBoolean(MOVE_COMPLETE_SELECTION_PREFERENCE, true);
        boolean cleanElevation = preferences.getBoolean(CLEAN_ELEVATION_ON_MOVE_PREFERENCE, false);
        boolean complementElevation = preferences.getBoolean(COMPLEMENT_ELEVATION_ON_MOVE_PREFERENCE, true);
        boolean cleanTime = preferences.getBoolean(CLEAN_TIME_ON_MOVE_PREFERENCE, false);
        boolean complementTime = preferences.getBoolean(COMPLEMENT_TIME_ON_MOVE_PREFERENCE, true);

        int minimum = row;
        for (int index : selectedPositionIndices) {
            if (index < minimum)
                minimum = index;

            NavigationPosition position = positionsModel.getPosition(index);
            if (position == null)
                continue;

            if (index != row) {
                if (!moveCompleteSelection)
                    continue;

                positionsModel.edit(index, new PositionColumnValues(asList(LONGITUDE_COLUMN_INDEX, LATITUDE_COLUMN_INDEX),
                        Arrays.<Object>asList(position.getLongitude() + diffLongitude, position.getLatitude() + diffLatitude)), false, true);
            } else {
                positionsModel.edit(index, new PositionColumnValues(asList(LONGITUDE_COLUMN_INDEX, LATITUDE_COLUMN_INDEX),
                        Arrays.<Object>asList(longitude, latitude)), false, true);
            }
View Full Code Here


*/

public class GoogleMapsPositionListCellRenderer extends DefaultListCellRenderer {
    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
        JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
        NavigationPosition position = NavigationPosition.class.cast(value);
        label.setText(position.getDescription() + " @ " + position.getLongitude() + "," + position.getLatitude());
        return label;
    }
View Full Code Here

    }

    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int rowIndex, int columnIndex) {
        JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, rowIndex, columnIndex);
        label.setHorizontalAlignment(alignment);
        NavigationPosition position = BaseNavigationPosition.class.cast(value);
        formatCell(label, position);
        return label;
    }
View Full Code Here

    public void removeCellEditorListener(CellEditorListener l) {
        editor.removeCellEditorListener(l);
    }

    public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
        NavigationPosition position = BaseNavigationPosition.class.cast(value);
        Object editedValue = extractValue(position);
        return editor.getTableCellEditorComponent(table, editedValue, isSelected, row, column);
    }
View Full Code Here

        int[] selectedRows = r.getPositionsView().getSelectedRows();
        int row = selectedRows.length > 0 ? selectedRows[0] : positionsModel.getRowCount();
        int insertRow = row > positionsModel.getRowCount() - 1 ? row : row + 1;
        Object[] objects = listResult.getSelectedValues();
        for (int i = objects.length - 1; i >= 0; i -= 1) {
            NavigationPosition position = (NavigationPosition) objects[i];
            positionsModel.add(insertRow, position.getLongitude(), position.getLatitude(),
                    position.getElevation(), null, null, position.getDescription());

            int[] rows = new int[]{insertRow};
            r.getPositionsSelectionModel().setSelectedPositions(rows, true);
            r.getBatchPositionAugmenter().addData(rows, false, true, true);
        }
View Full Code Here

        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;
View Full Code Here

                    new ContinousRange(rows, new RangeOperation() {
                        private int count = 1;

                        public void performOnIndex(final int index) {
                            NavigationPosition position = positionsModel.getPosition(index);
                            if (predicate.shouldOverwrite(position)) {
                                try {
                                    // ignoring the result since the performance boost of the continous
                                    // range operations outweights the possible optimization
                                    operation.run(index, position);
View Full Code Here

                    public void performOnStart() {
                    }

                    public boolean run(int index, NavigationPosition position) throws Exception {
                        NavigationPosition coordinates = googleMapsService.getPositionFor(position.getDescription());
                        if (coordinates != null)
                            positionsModel.edit(index,
                                    new PositionColumnValues(asList(LONGITUDE_COLUMN_INDEX, LATITUDE_COLUMN_INDEX),
                                            Arrays.<Object>asList(coordinates.getLongitude(), coordinates.getLatitude())), false, true);
                        return coordinates != null;
                    }

                    public String getErrorMessage() {
                        return RouteConverter.getBundle().getString("add-coordinates-error");
View Full Code Here

    private void downloadElevationData(int[] rows) {
        if (!elevationServiceFacade.isDownload())
            return;
        List<LongitudeAndLatitude> longitudeAndLatitudes = new ArrayList<>();
        for (int row : rows) {
            NavigationPosition position = positionsModel.getPosition(row);
            if (position.hasCoordinates())
                longitudeAndLatitudes.add(new LongitudeAndLatitude(position.getLongitude(), position.getLatitude()));
        }
        elevationServiceFacade.downloadElevationDataFor(longitudeAndLatitudes);
    }
View Full Code Here

                    public void performOnStart() {
                    }

                    public boolean run(int index, NavigationPosition position) throws Exception {
                        NavigationPosition predecessor = index > 0 && index < positionsModel.getRowCount() ? positionsModel.getPosition(index - 1) : null;
                        if (predecessor != null) {
                            Double previousSpeed = position.getSpeed();
                            Double nextSpeed = position.calculateSpeed(predecessor);
                            boolean changed = nextSpeed == null || !nextSpeed.equals(previousSpeed);
                            if (changed)
View Full Code Here

TOP

Related Classes of slash.navigation.common.NavigationPosition

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.