Search in sources :

Example 11 with PointDetails

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

the class EntryExitPairs method getSourceList.

/**
     * Return a list of all source (origin) points on a given
     * Layout Editor panel.
     *
     * @param panel  A Layout Editor panel
     * @return A list of source objects
     */
public List<Object> getSourceList(LayoutEditor panel) {
    List<Object> list = new ArrayList<Object>();
    for (Entry<PointDetails, Source> e : nxpair.entrySet()) {
        Object obj = (e.getKey()).getRefObject();
        LayoutEditor pan = (e.getKey()).getPanel();
        if (pan == panel) {
            if (!list.contains(obj)) {
                list.add(obj);
            }
        }
    // end while
    }
    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 12 with PointDetails

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

the class EntryExitPairs method addNXSourcePoint.

public void addNXSourcePoint(LayoutBlock facing, List<LayoutBlock> protecting, NamedBean loc, LayoutEditor panel) {
    PointDetails point = providePoint(facing, protecting, panel);
    point.setRefObject(loc);
}
Also used : PointDetails(jmri.jmrit.signalling.entryexit.PointDetails)

Example 13 with PointDetails

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

the class EntryExitPairs method providePoint.

/**
     * Generate the point details, given a known source and a
     * Layout Editor panel.
     *
     * @param source Origin of movement
     * @param panel  A Layout Editor panel
     * @return A PointDetails object
     */
public PointDetails providePoint(NamedBean source, LayoutEditor panel) {
    PointDetails sourcePoint = getPointDetails(source, panel);
    if (sourcePoint == null) {
        LayoutBlock facing = InstanceManager.getDefault(jmri.jmrit.display.layoutEditor.LayoutBlockManager.class).getFacingBlockByNamedBean(source, panel);
        List<LayoutBlock> protecting = InstanceManager.getDefault(jmri.jmrit.display.layoutEditor.LayoutBlockManager.class).getProtectingBlocksByNamedBean(source, panel);
        if ((facing == null) && (protecting == null)) {
            log.error("Unable to find facing and protecting block");
            return null;
        }
        sourcePoint = providePoint(facing, protecting, panel);
        sourcePoint.setRefObject(source);
    }
    return sourcePoint;
}
Also used : LayoutBlock(jmri.jmrit.display.layoutEditor.LayoutBlock) PointDetails(jmri.jmrit.signalling.entryexit.PointDetails)

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