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;
}
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);
}
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;
}
Aggregations