Search in sources :

Example 6 with PointDetails

use of jmri.jmrit.signalling.entryexit.PointDetails in project JMRI by JMRI.

the class EntryExitPairs method getNxPairNumbers.

public int getNxPairNumbers(LayoutEditor panel) {
    int total = 0;
    for (Entry<PointDetails, Source> e : nxpair.entrySet()) {
        PointDetails key = e.getKey();
        LayoutEditor pan = key.getPanel();
        if (pan == panel) {
            total = total + e.getValue().getNumberOfDestinations();
        }
    // end while
    }
    return total;
}
Also used : LayoutEditor(jmri.jmrit.display.layoutEditor.LayoutEditor) PointDetails(jmri.jmrit.signalling.entryexit.PointDetails) Source(jmri.jmrit.signalling.entryexit.Source)

Example 7 with PointDetails

use of jmri.jmrit.signalling.entryexit.PointDetails in project JMRI by JMRI.

the class EntryExitPairs method providePoint.

/**
     * Return a point if it already exists, or create a new one if not.
     */
private PointDetails providePoint(LayoutBlock source, List<LayoutBlock> protecting, LayoutEditor panel) {
    PointDetails sourcePoint = getPointDetails(source, protecting, panel);
    if (sourcePoint == null) {
        sourcePoint = new PointDetails(source, protecting);
        sourcePoint.setPanel(panel);
    }
    return sourcePoint;
}
Also used : PointDetails(jmri.jmrit.signalling.entryexit.PointDetails)

Example 8 with PointDetails

use of jmri.jmrit.signalling.entryexit.PointDetails in project JMRI by JMRI.

the class EntryExitPairs method getSourcePanelList.

public ArrayList<LayoutEditor> getSourcePanelList() {
    ArrayList<LayoutEditor> list = new ArrayList<LayoutEditor>();
    for (Entry<PointDetails, Source> e : nxpair.entrySet()) {
        PointDetails key = e.getKey();
        LayoutEditor pan = key.getPanel();
        if (!list.contains(pan)) {
            list.add(pan);
        }
    }
    return list;
}
Also used : LayoutEditor(jmri.jmrit.display.layoutEditor.LayoutEditor) ArrayList(java.util.ArrayList) PointDetails(jmri.jmrit.signalling.entryexit.PointDetails) Source(jmri.jmrit.signalling.entryexit.Source)

Example 9 with PointDetails

use of jmri.jmrit.signalling.entryexit.PointDetails in project JMRI by JMRI.

the class EntryExitPairs method addNXSourcePoint.

public void addNXSourcePoint(NamedBean source, LayoutEditor panel) {
    if (source == null) {
        log.error("source bean supplied is null");
        return;
    }
    if (panel == null) {
        log.error("panel supplied is null");
        return;
    }
    PointDetails point;
    point = providePoint(source, panel);
    if (point == null) {
        log.error("Unable to find a location on the panel " + panel.getLayoutName() + " for item " + source.getDisplayName());
        return;
    }
}
Also used : PointDetails(jmri.jmrit.signalling.entryexit.PointDetails)

Example 10 with PointDetails

use of jmri.jmrit.signalling.entryexit.PointDetails in project JMRI by JMRI.

the class EntryExitPairs method addNXDestination.

public void addNXDestination(NamedBean source, NamedBean destination, LayoutEditor panel, String id) {
    if (source == null) {
        log.error("no source Object provided");
        return;
    }
    if (destination == null) {
        log.error("no destination Object provided");
        return;
    }
    PointDetails sourcePoint = providePoint(source, panel);
    if (sourcePoint == null) {
        log.error("source point for " + source.getDisplayName() + " not created addNXDes");
        return;
    }
    sourcePoint.setPanel(panel);
    sourcePoint.setRefObject(source);
    PointDetails destPoint = providePoint(destination, panel);
    if (destPoint != null) {
        destPoint.setPanel(panel);
        destPoint.setRefObject(destination);
        if (!nxpair.containsKey(sourcePoint)) {
            nxpair.put(sourcePoint, new Source(sourcePoint));
        }
        nxpair.get(sourcePoint).addDestination(destPoint, id);
    }
    firePropertyChange("length", null, null);
}
Also used : PointDetails(jmri.jmrit.signalling.entryexit.PointDetails) Source(jmri.jmrit.signalling.entryexit.Source)

Aggregations

PointDetails (jmri.jmrit.signalling.entryexit.PointDetails)13 Source (jmri.jmrit.signalling.entryexit.Source)6 LayoutEditor (jmri.jmrit.display.layoutEditor.LayoutEditor)5 ArrayList (java.util.ArrayList)3 LayoutBlock (jmri.jmrit.display.layoutEditor.LayoutBlock)2 JmriException (jmri.JmriException)1 NamedBean (jmri.NamedBean)1