Search in sources :

Example 6 with ProcessingRequest

use of org.eclipse.scanning.api.event.scan.ProcessingRequest in project gda-core by openGDA.

the class ScanRequestFactory method createScanRequest.

public ScanRequest createScanRequest(IRunnableDeviceService runnableDeviceService) throws ScanningException {
    // Populate the {@link ScanRequest} with the assembled objects
    var scanRequest = new ScanRequest();
    scanRequest.setTemplateFilePaths(new HashSet<>());
    prepareScanRequestAccordingToScanType(scanRequest);
    Optional.ofNullable(getAcquisition().getAcquisitionLocation()).map(URL::getPath).ifPresent(scanRequest::setFilePath);
    try {
        scanRequest.setCompoundModel(createCompoundModel());
    } catch (GDAException e) {
        throw new ScanningException("Cannot create compound model", e);
    }
    parseAcquisitionEngine(scanRequest, runnableDeviceService);
    addPosition(createStartPosition(), scanRequest::setStartPosition);
    addPosition(createEndPosition(), scanRequest::setEnd);
    scanRequest.setMonitorNamesPerPoint(parseMonitorNamesPerPoint());
    scanRequest.setProcessingRequest(new ProcessingRequest());
    scanRequest.getProcessingRequest().setRequest(new HashMap<>());
    for (ProcessingRequestPair<?> request : getAcquisitionConfiguration().getProcessingRequest()) {
        getProcessingRequestHandlerService().handle(request, scanRequest);
    }
    return scanRequest;
}
Also used : ScanRequest(org.eclipse.scanning.api.event.scan.ScanRequest) ScanningException(org.eclipse.scanning.api.scan.ScanningException) GDAException(uk.ac.gda.common.exception.GDAException) ProcessingRequest(org.eclipse.scanning.api.event.scan.ProcessingRequest)

Aggregations

ProcessingRequest (org.eclipse.scanning.api.event.scan.ProcessingRequest)6 ScanRequest (org.eclipse.scanning.api.event.scan.ScanRequest)6 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)3 URL (java.net.URL)2 File (java.io.File)1 Collection (java.util.Collection)1 TreeSet (java.util.TreeSet)1 Collectors.toCollection (java.util.stream.Collectors.toCollection)1 IDetectorModel (org.eclipse.scanning.api.device.models.IDetectorModel)1 MapPosition (org.eclipse.scanning.api.points.MapPosition)1 CompoundModel (org.eclipse.scanning.api.points.models.CompoundModel)1 IMapPathModel (org.eclipse.scanning.api.points.models.IMapPathModel)1 IScanPointGeneratorModel (org.eclipse.scanning.api.points.models.IScanPointGeneratorModel)1 ScanRegion (org.eclipse.scanning.api.points.models.ScanRegion)1 ScanningException (org.eclipse.scanning.api.scan.ScanningException)1 ConfigWrapper (uk.ac.diamond.daq.mapping.api.ConfigWrapper)1 IMappingScanRegion (uk.ac.diamond.daq.mapping.api.IMappingScanRegion)1 IScanModelWrapper (uk.ac.diamond.daq.mapping.api.IScanModelWrapper)1 IScriptFiles (uk.ac.diamond.daq.mapping.api.IScriptFiles)1