mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-24 14:38:45 +00:00
Bug 4316: Added Importer for Bravo extended files
This commit is contained in:
+2
-2
@@ -74,14 +74,14 @@ public class BravoWindImportServlet extends AbstractWindImportServlet {
|
||||
for (final Fields field : Fields.values()) {
|
||||
columnsMap.put(field.name(), field.ordinal());
|
||||
}
|
||||
BravoDataImporterImpl importer = new BravoDataImporterImpl(columnsMap);
|
||||
BravoDataImporterImpl importer = new BravoDataImporterImpl(BravoDataImporterImpl.BRAVO_TYPE, columnsMap);
|
||||
final Callback callback = new Callback() {
|
||||
@Override
|
||||
public void addFixes(Iterable<DoubleVectorFix> fixes, TrackFileImportDeviceIdentifier device) {
|
||||
for (final DoubleVectorFix fix : fixes) {
|
||||
// latitude / longitude are represented in funny NMEA-like way; the value divided by 100 as
|
||||
// a floored integer represents the full degrees; the value modulo 100 represents the decimal
|
||||
// minutes. Example: the pair (4124.645890, 213.738670) stands for N41°24.645890 E002°13.738670
|
||||
// minutes. Example: the pair (4124.645890, 213.738670) stands for N41�24.645890 E002�13.738670
|
||||
final Wind wind = new WindImpl(new DegreePosition(FunnyDegreeConverter.funnyLatLng(fix.get(Fields.Lat.ordinal())),
|
||||
FunnyDegreeConverter.funnyLatLng(fix.get(Fields.Lon.ordinal()))),
|
||||
fix.getTimePoint(), new KnotSpeedWithBearingImpl(fix.get(Fields.TWS.ordinal()),
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ public class BravoDataImportTest {
|
||||
private LearningBatchProcessor batchProcessor;
|
||||
private DownsamplerTo1HzProcessor downsampler;
|
||||
|
||||
private final DoubleVectorFixImporter bravoDataImporter = new BravoDataImporterImpl(BravoSensorDataMetadata.getColumnNamesToIndexInDoubleFix()) {
|
||||
private final DoubleVectorFixImporter bravoDataImporter = new BravoDataImporterImpl(BravoDataImporterImpl.BRAVO_TYPE, BravoSensorDataMetadata.getColumnNamesToIndexInDoubleFix()) {
|
||||
protected com.sap.sailing.server.trackfiles.impl.doublefix.DoubleFixProcessor createDownsamplingProcessor(
|
||||
DoubleVectorFixImporter.Callback callback,
|
||||
TrackFileImportDeviceIdentifier trackIdentifier) {
|
||||
|
||||
+5
-1
@@ -7,6 +7,7 @@ import org.osgi.framework.BundleActivator;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.ServiceRegistration;
|
||||
|
||||
import com.sap.sailing.domain.common.sensordata.BravoExtendedSensorDataMetadata;
|
||||
import com.sap.sailing.domain.common.sensordata.BravoSensorDataMetadata;
|
||||
import com.sap.sailing.server.trackfiles.common.GPSFixImporterRegistration;
|
||||
import com.sap.sailing.server.trackfiles.common.SensorDataImporterRegistration;
|
||||
@@ -18,7 +19,10 @@ public class Activator implements BundleActivator {
|
||||
public void start(BundleContext context) throws Exception {
|
||||
registrations.addAll(GPSFixImporterRegistration.register(new RouteConverterGPSFixImporterImpl(), context));
|
||||
registrations.addAll(SensorDataImporterRegistration.register(
|
||||
new BravoDataImporterImpl(BravoSensorDataMetadata.getColumnNamesToIndexInDoubleFix()), context));
|
||||
new BravoDataImporterImpl(BravoDataImporterImpl.BRAVO_TYPE, BravoSensorDataMetadata.getColumnNamesToIndexInDoubleFix()), context));
|
||||
registrations.addAll(SensorDataImporterRegistration
|
||||
.register(new BravoDataImporterImpl(BravoDataImporterImpl.BRAVO_EXTENDED_TYPE,
|
||||
BravoExtendedSensorDataMetadata.getColumnNamesToIndexInDoubleFix()), context));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+7
-2
@@ -41,11 +41,16 @@ import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
* different col definitions.
|
||||
*/
|
||||
public class BravoDataImporterImpl implements DoubleVectorFixImporter {
|
||||
public static final String BRAVO_TYPE = "BRAVO";
|
||||
public static final String BRAVO_EXTENDED_TYPE = "BRAVO_EXTENDED";
|
||||
|
||||
private final Logger LOG = Logger.getLogger(DoubleVectorFixImporter.class.getName());
|
||||
private final String BOF = "jjlDATE\tjjlTIME\tEpoch";
|
||||
private final Map<String, Integer> columnNamesInFileAndTheirValueIndexInResultingDoubleVectorFix;
|
||||
private final String type;
|
||||
|
||||
public BravoDataImporterImpl(Map<String, Integer> columnNamesInFileAndTheirValueIndexInResultingDoubleVectorFix) {
|
||||
public BravoDataImporterImpl(String type, Map<String, Integer> columnNamesInFileAndTheirValueIndexInResultingDoubleVectorFix) {
|
||||
this.type = type;
|
||||
this.columnNamesInFileAndTheirValueIndexInResultingDoubleVectorFix = columnNamesInFileAndTheirValueIndexInResultingDoubleVectorFix;
|
||||
}
|
||||
|
||||
@@ -168,7 +173,7 @@ public class BravoDataImporterImpl implements DoubleVectorFixImporter {
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "BRAVO";
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user