Search in sources :

Example 46 with Location

use of jmri.jmrit.operations.locations.Location in project JMRI by JMRI.

the class PrintLocationsAction method printDetailsSelected.

private void printDetailsSelected() throws IOException {
    List<Location> locations = manager.getLocationsByNameList();
    String s = Bundle.getMessage("DetailedReport") + NEW_LINE;
    writer.write(s);
    for (Location location : locations) {
        if (_location != null && location != _location) {
            continue;
        }
        String name = location.getName();
        // services train direction
        int dir = location.getTrainDirections();
        s = NEW_LINE + name + getDirection(dir);
        writer.write(s);
        // services car and engine types
        s = getLocationTypes(location);
        writer.write(s);
        List<Track> yards = location.getTrackByNameList(Track.YARD);
        if (yards.size() > 0) {
            s = SPACE + Bundle.getMessage("YardName") + NEW_LINE;
            writer.write(s);
            printTrackInfo(location, yards);
        }
        List<Track> spurs = location.getTrackByNameList(Track.SPUR);
        if (spurs.size() > 0) {
            s = SPACE + Bundle.getMessage("SpurName") + NEW_LINE;
            writer.write(s);
            printTrackInfo(location, spurs);
        }
        List<Track> interchanges = location.getTrackByNameList(Track.INTERCHANGE);
        if (interchanges.size() > 0) {
            s = SPACE + Bundle.getMessage("InterchangeName") + NEW_LINE;
            writer.write(s);
            printTrackInfo(location, interchanges);
        }
        List<Track> stagings = location.getTrackByNameList(Track.STAGING);
        if (stagings.size() > 0) {
            s = SPACE + Bundle.getMessage("StagingName") + NEW_LINE;
            writer.write(s);
            printTrackInfo(location, stagings);
        }
    }
    if (printAnalysis.isSelected()) {
        writer.write(FORM_FEED);
    }
}
Also used : Track(jmri.jmrit.operations.locations.Track) Location(jmri.jmrit.operations.locations.Location)

Example 47 with Location

use of jmri.jmrit.operations.locations.Location in project JMRI by JMRI.

the class CarSetFrame method updateFinalDestination.

protected void updateFinalDestination() {
    if (finalDestinationBox.getSelectedItem() == null) {
        finalDestTrackBox.removeAllItems();
    } else {
        log.debug("CarSetFrame sees final destination: {}", finalDestinationBox.getSelectedItem());
        Location l = (Location) finalDestinationBox.getSelectedItem();
        l.updateComboBox(finalDestTrackBox, _car, autoFinalDestTrackCheckBox.isSelected(), true);
        if (_car != null && _car.getFinalDestination() != null && _car.getFinalDestination().equals(l) && _car.getFinalDestinationTrack() != null) {
            finalDestTrackBox.setSelectedItem(_car.getFinalDestinationTrack());
        }
    }
}
Also used : Location(jmri.jmrit.operations.locations.Location)

Example 48 with Location

use of jmri.jmrit.operations.locations.Location in project JMRI by JMRI.

the class CarSetFrame method updateReturnWhenEmpty.

protected void updateReturnWhenEmpty() {
    if (destReturnWhenEmptyBox.getSelectedItem() == null) {
        trackReturnWhenEmptyBox.removeAllItems();
    } else {
        log.debug("CarSetFrame sees return when empty: {}", destReturnWhenEmptyBox.getSelectedItem());
        Location l = (Location) destReturnWhenEmptyBox.getSelectedItem();
        l.updateComboBox(trackReturnWhenEmptyBox, getTestCar(_car), autoReturnWhenEmptyTrackCheckBox.isSelected(), true);
        if (_car != null && _car.getReturnWhenEmptyDestination() != null && _car.getReturnWhenEmptyDestination().equals(l) && _car.getReturnWhenEmptyDestTrack() != null) {
            trackReturnWhenEmptyBox.setSelectedItem(_car.getReturnWhenEmptyDestTrack());
        }
    }
}
Also used : Location(jmri.jmrit.operations.locations.Location)

Example 49 with Location

use of jmri.jmrit.operations.locations.Location in project JMRI by JMRI.

the class SetTrainIconPositionFrame method comboBoxActionPerformed.

@Override
public void comboBoxActionPerformed(java.awt.event.ActionEvent ae) {
    if (locationBox.getSelectedItem() == null) {
        resetSpinners();
        removeIcons();
    } else {
        Location l = (Location) locationBox.getSelectedItem();
        loadSpinners(l);
    }
}
Also used : Location(jmri.jmrit.operations.locations.Location)

Example 50 with Location

use of jmri.jmrit.operations.locations.Location in project JMRI by JMRI.

the class SetTrainIconPositionFrame method placeTestIcons.

// place test markers on panel
private void placeTestIcons() {
    removeIcons();
    if (locationBox.getSelectedItem() == null) {
        return;
    }
    Editor editor = PanelMenu.instance().getEditorByName(Setup.getPanelName());
    if (editor == null) {
        JOptionPane.showMessageDialog(this, MessageFormat.format(Bundle.getMessage("LoadPanel"), new Object[] { Setup.getPanelName() }), Bundle.getMessage("PanelNotFound"), JOptionPane.ERROR_MESSAGE);
        return;
    }
    Location l = (Location) locationBox.getSelectedItem();
    if (l != null) {
        // East icon
        if ((Setup.getTrainDirection() & Setup.EAST) == Setup.EAST) {
            _tIonEast = editor.addTrainIcon(Bundle.getMessage("East"));
            _tIonEast.getTooltip().setText(l.getName());
            _tIonEast.getTooltip().setBackgroundColor(Color.white);
            _tIonEast.setLocoColor(Setup.getTrainIconColorEast());
            _tIonEast.setLocation((Integer) spinTrainIconEastX.getValue(), (Integer) spinTrainIconEastY.getValue());
            addIconListener(_tIonEast);
        }
        // West icon
        if ((Setup.getTrainDirection() & Setup.WEST) == Setup.WEST) {
            _tIonWest = editor.addTrainIcon(Bundle.getMessage("West"));
            _tIonWest.getTooltip().setText(l.getName());
            _tIonWest.getTooltip().setBackgroundColor(Color.white);
            _tIonWest.setLocoColor(Setup.getTrainIconColorWest());
            _tIonWest.setLocation((Integer) spinTrainIconWestX.getValue(), (Integer) spinTrainIconWestY.getValue());
            addIconListener(_tIonWest);
        }
        // North icon
        if ((Setup.getTrainDirection() & Setup.NORTH) == Setup.NORTH) {
            _tIonNorth = editor.addTrainIcon(Bundle.getMessage("North"));
            _tIonNorth.getTooltip().setText(l.getName());
            _tIonNorth.getTooltip().setBackgroundColor(Color.white);
            _tIonNorth.setLocoColor(Setup.getTrainIconColorNorth());
            _tIonNorth.setLocation((Integer) spinTrainIconNorthX.getValue(), (Integer) spinTrainIconNorthY.getValue());
            addIconListener(_tIonNorth);
        }
        // South icon
        if ((Setup.getTrainDirection() & Setup.SOUTH) == Setup.SOUTH) {
            _tIonSouth = editor.addTrainIcon(Bundle.getMessage("South"));
            _tIonSouth.getTooltip().setText(l.getName());
            _tIonSouth.getTooltip().setBackgroundColor(Color.white);
            _tIonSouth.setLocoColor(Setup.getTrainIconColorSouth());
            _tIonSouth.setLocation((Integer) spinTrainIconSouthX.getValue(), (Integer) spinTrainIconSouthY.getValue());
            addIconListener(_tIonSouth);
        }
    }
}
Also used : Editor(jmri.jmrit.display.Editor) Location(jmri.jmrit.operations.locations.Location)

Aggregations

Location (jmri.jmrit.operations.locations.Location)186 Track (jmri.jmrit.operations.locations.Track)108 RouteLocation (jmri.jmrit.operations.routes.RouteLocation)82 Route (jmri.jmrit.operations.routes.Route)51 LocationManager (jmri.jmrit.operations.locations.LocationManager)43 Car (jmri.jmrit.operations.rollingstock.cars.Car)41 Engine (jmri.jmrit.operations.rollingstock.engines.Engine)29 RouteManager (jmri.jmrit.operations.routes.RouteManager)21 CarManager (jmri.jmrit.operations.rollingstock.cars.CarManager)20 Consist (jmri.jmrit.operations.rollingstock.engines.Consist)19 Test (org.junit.Test)18 JCheckBox (javax.swing.JCheckBox)13 EngineManager (jmri.jmrit.operations.rollingstock.engines.EngineManager)13 Train (jmri.jmrit.operations.trains.Train)13 CarTypes (jmri.jmrit.operations.rollingstock.cars.CarTypes)12 Schedule (jmri.jmrit.operations.locations.schedules.Schedule)11 EngineTypes (jmri.jmrit.operations.rollingstock.engines.EngineTypes)10 File (java.io.File)9 ScheduleItem (jmri.jmrit.operations.locations.schedules.ScheduleItem)9 TrainManager (jmri.jmrit.operations.trains.TrainManager)8