Search in sources :

Example 21 with CompoundModel

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;
    }
}
Also used : IROI(org.eclipse.dawnsci.analysis.api.roi.IROI) IRectangularROI(org.eclipse.dawnsci.analysis.api.roi.IRectangularROI) CompoundModel(org.eclipse.scanning.api.points.models.CompoundModel) ArrayList(java.util.ArrayList)

Aggregations

CompoundModel (org.eclipse.scanning.api.points.models.CompoundModel)21 Test (org.junit.Test)10 ScanpathElementProcessor (gda.mscan.processor.ScanpathElementProcessor)8 IScanListener (org.eclipse.scanning.api.event.scan.IScanListener)8 ScanBean (org.eclipse.scanning.api.event.scan.ScanBean)8 ScanRequest (org.eclipse.scanning.api.event.scan.ScanRequest)7 StaticModel (org.eclipse.scanning.api.points.models.StaticModel)7 IRunnableDeviceDetectorElementProcessor (gda.mscan.processor.IRunnableDeviceDetectorElementProcessor)6 ArrayList (java.util.ArrayList)6 IScanPointGeneratorModel (org.eclipse.scanning.api.points.models.IScanPointGeneratorModel)6 NumberElementProcessor (gda.mscan.processor.NumberElementProcessor)5 AxialStepModel (org.eclipse.scanning.api.points.models.AxialStepModel)5 IDetectorModel (org.eclipse.scanning.api.device.models.IDetectorModel)4 ScanRegion (org.eclipse.scanning.api.points.models.ScanRegion)4 ScannableElementProcessor (gda.mscan.processor.ScannableElementProcessor)3 IMapPathModel (org.eclipse.scanning.api.points.models.IMapPathModel)3 RegionShapeElementProcessor (gda.mscan.processor.RegionShapeElementProcessor)2 File (java.io.File)2 HashMap (java.util.HashMap)2 IPosition (org.eclipse.scanning.api.points.IPosition)2