public void addEntry(AirspaceEntry entry) { entry.getEditor().addEditListener(this); this.getModel().addEntry(entry); this.updateShapeIntersection(); this.getApp().getAirspaceLayer().addRenderable(entry.getAirspace()); this.getApp().getWwd().redraw(); }
protected AirspaceEntry getEntryFor(Airspace airspace) { for (AirspaceEntry entry : this.getModel().getEntries()) { if (entry.getAirspace() == airspace) { return entry; } } return null; }
public void removeEntry(AirspaceEntry entry) { entry.getEditor().removeEditListener(this); if (this.getSelectedEntry() == entry) { this.selectEntry(null, true); } this.getModel().removeEntry(entry); this.updateShapeIntersection(); this.getApp().getAirspaceLayer().removeRenderable(entry.getAirspace()); this.getApp().getWwd().redraw(); }
protected void updateShapeIntersection() { AirspaceEntry selected = this.getSelectedEntry(); if (selected != null) { boolean hasIntersection = false; for (AirspaceEntry entry : this.getModel().getEntries()) { if (entry != selected) { boolean intersecting = this.areShapesIntersecting(entry.getAirspace(), selected.getAirspace()); if (intersecting) hasIntersection = true; entry.setIntersecting(intersecting); } } selected.setIntersecting(hasIntersection); } else { for (AirspaceEntry entry : this.getModel().getEntries()) { entry.setIntersecting(false); } } }