blob: dd661fe113b1283f4bbc4ffd23eb961b98124ccc [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pierre Allard,
* Regent L'Archeveque - initial API and implementation
*
* SPDX-License-Identifier: EPL-1.0
*
*******************************************************************************/
package org.eclipse.apogy.addons.sensors.range.impl;
import org.eclipse.apogy.addons.sensors.fov.ApogyAddonsSensorsFOVFactory;
import org.eclipse.apogy.addons.sensors.fov.CircularSectorFieldOfView;
import org.eclipse.apogy.common.topology.Node;
import org.eclipse.emf.common.util.EList;
public class LineRangeScannerCustomImpl extends LineRangeScannerImpl {
protected CircularSectorFieldOfView fov = null;
@Override
public synchronized CircularSectorFieldOfView getFieldOfView() {
if (this.fov == null) {
// Search the list of children of the LineRangeScanner to find a
// CircularSectorFieldOfView.
EList<Node> children = getChildren();
for (Node node : children) {
if (node instanceof CircularSectorFieldOfView) {
this.fov = (CircularSectorFieldOfView) node;
}
}
// If no CircularSectorFieldOfView is found, creates one.
if (this.fov == null) {
this.fov = ApogyAddonsSensorsFOVFactory.eINSTANCE.createCircularSectorFieldOfView();
getChildren().add(this.fov);
}
}
return this.fov;
}
} // LineRangeScannerImpl