use of org.eclipse.scanning.api.points.models.CompoundModel in project gda-core by openGDA.
the class ClausesContext method addPathDefinitionToCompoundModel.
/**
* Accepts an empty Scan model to be populated with the state set in the context for a scan path clause. The content
* is validated first to check that all the necessary elements for a scan path clause are present. Flags are also
* set to indicate successful storage of the scan path and processing of the clause.
*
* @param scanModel The {@link ScanModel} to be filled in
* @throws IllegalArgumentException if the {@link IROI} fails to validate the supplied parameters on creation
*/
public void addPathDefinitionToCompoundModel(final CompoundModel scanModel) {
nullCheck(scanModel, CompoundModel.class.getSimpleName());
if (validateAndAdjustPathClause() && scanpath != null) {
LOGGER.debug("Valid scan definition clause detected and added");
ArrayList<Number> boundingBoxParams = new ArrayList<>();
IROI roi = getRegionShape().createIROI(getBounds());
if (roi != null) {
IRectangularROI boundingRoi = roi.getBounds();
boundingBoxParams.add(boundingRoi.getPointX());
boundingBoxParams.add(boundingRoi.getPointY());
boundingBoxParams.add(boundingRoi.getLength(0));
boundingBoxParams.add(boundingRoi.getLength(1));
}
scanModel.setData(scanpath.get().createModel(scannables, getModelPathParams(), boundingBoxParams, mutatorUses), roi);
scanPathSeen = true;
clauseProcessed = true;
}
}
Aggregations