@Test public void testCenterOfVessel() { Position p; p = FreeFlowAnalysis.centerOfVessel(Position.create(56, 12), 0f, 0, 0, 0, 0); assertEquals(56f, p.getLatitude(), 1e-16); assertEquals(12f, p.getLongitude(), 1e-16); p = FreeFlowAnalysis.centerOfVessel(Position.create(56, 12), 0f, 50, 50, 10, 10); assertEquals(56.000000f, p.getLatitude(), 1e-6); assertEquals(12.000000f, p.getLongitude(), 1e-6); p = FreeFlowAnalysis.centerOfVessel(Position.create(56, 12), 90f, 50, 50, 10, 10); assertEquals(56.000000f, p.getLatitude(), 1e-6); assertEquals(12.000000f, p.getLongitude(), 1e-6); p = FreeFlowAnalysis.centerOfVessel(Position.create(56, 12), 180f, 50, 50, 10, 10); assertEquals(56.000000f, p.getLatitude(), 1e-6); assertEquals(12.000000f, p.getLongitude(), 1e-6); p = FreeFlowAnalysis.centerOfVessel(Position.create(56, 12), 0f, 25, 75, 10, 10); assertEquals(56.000225f, p.getLatitude(), 1e-6); assertEquals(12.000000f, p.getLongitude(), 1e-6); p = FreeFlowAnalysis.centerOfVessel(Position.create(56, 12), 0f, 75, 25, 10, 10); assertEquals(55.999774f, p.getLatitude(), 1e-6); assertEquals(12.000000f, p.getLongitude(), 1e-6); p = FreeFlowAnalysis.centerOfVessel(Position.create(56, 12), 0f, 50, 50, 5, 15); assertEquals(56.000000f, p.getLatitude(), 1e-6); assertEquals(12.000081f, p.getLongitude(), 1e-6); p = FreeFlowAnalysis.centerOfVessel(Position.create(56, 12), 0f, 50, 50, 15, 5); assertEquals(56.000000f, p.getLatitude(), 1e-6); assertEquals(11.999919f, p.getLongitude(), 1e-6); }
static Position centerOfVessel(Position aisPosition, float hdg, int dimStern, int dimBow, int dimPort, int dimStarboard) { final double thetaDeg = compass2cartesian(hdg); final Position geodeticReference = aisPosition; final CoordinateConverter coordinateConverter = new CoordinateConverter(geodeticReference.getLongitude(), geodeticReference.getLatitude()); final double trackLatitude = aisPosition.getLatitude(); final double trackLongitude = aisPosition.getLongitude(); final double x = coordinateConverter.lon2x(trackLongitude, trackLatitude); final double y = coordinateConverter.lat2y(trackLongitude, trackLatitude); final Point pAis = new Point(x, y); final Point pc = new Point((dimBow + dimStern)/2 - dimStern, (dimPort+dimStarboard)/2 - dimStarboard); final Point pcr = pc.rotate(pAis, thetaDeg); return Position.create(coordinateConverter.y2Lat(pcr.getX(), pcr.getY()), coordinateConverter.x2Lon(pcr.getX(), pcr.getY())); }
FreeFlowAnalysis extends PeriodicAnalysis { static Position centerOfVessel(Position aisPosition, float hdg, int dimStern, int dimBow, int dimPort, int dimStarboard) { final double thetaDeg = compass2cartesian(hdg); final Position geodeticReference = aisPosition; final CoordinateConverter coordinateConverter = new CoordinateConverter(geodeticReference.getLongitude(), geodeticReference.getLatitude()); final double trackLatitude = aisPosition.getLatitude(); final double trackLongitude = aisPosition.getLongitude(); final double x = coordinateConverter.lon2x(trackLongitude, trackLatitude); final double y = coordinateConverter.lat2y(trackLongitude, trackLatitude); final Point pAis = new Point(x, y); final Point pc = new Point((dimBow + dimStern)/2 - dimStern, (dimPort+dimStarboard)/2 - dimStarboard); final Point pcr = pc.rotate(pAis, thetaDeg); return Position.create(coordinateConverter.y2Lat(pcr.getX(), pcr.getY()), coordinateConverter.x2Lon(pcr.getX(), pcr.getY())); } }
FreeFlowAnalysis extends PeriodicAnalysis { static Position centerOfVessel(Position aisPosition, float hdg, int dimStern, int dimBow, int dimPort, int dimStarboard) { final double thetaDeg = compass2cartesian(hdg); final Position geodeticReference = aisPosition; final CoordinateConverter coordinateConverter = new CoordinateConverter(geodeticReference.getLongitude(), geodeticReference.getLatitude()); final double trackLatitude = aisPosition.getLatitude(); final double trackLongitude = aisPosition.getLongitude(); final double x = coordinateConverter.lon2x(trackLongitude, trackLatitude); final double y = coordinateConverter.lat2y(trackLongitude, trackLatitude); final Point pAis = new Point(x, y); final Point pc = new Point((dimBow + dimStern)/2 - dimStern, (dimPort+dimStarboard)/2 - dimStarboard); final Point pcr = pc.rotate(pAis, thetaDeg); return Position.create(coordinateConverter.y2Lat(pcr.getX(), pcr.getY()), coordinateConverter.x2Lon(pcr.getX(), pcr.getY())); } @Inject  FreeFlowAnalysis(Configuration configuration, AppStatisticsService statisticsService, EventEmittingTracker trackingService, EventRepository eventRepository); }
FreeFlowAnalysis extends PeriodicAnalysis { static Position centerOfVessel(Position aisPosition, float hdg, int dimStern, int dimBow, int dimPort, int dimStarboard) { final double thetaDeg = compass2cartesian(hdg); final Position geodeticReference = aisPosition; final CoordinateConverter coordinateConverter = new CoordinateConverter(geodeticReference.getLongitude(), geodeticReference.getLatitude()); final double trackLatitude = aisPosition.getLatitude(); final double trackLongitude = aisPosition.getLongitude(); final double x = coordinateConverter.lon2x(trackLongitude, trackLatitude); final double y = coordinateConverter.lat2y(trackLongitude, trackLatitude); final Point pAis = new Point(x, y); final Point pc = new Point((dimBow + dimStern)/2 - dimStern, (dimPort+dimStarboard)/2 - dimStarboard); final Point pcr = pc.rotate(pAis, thetaDeg); return Position.create(coordinateConverter.y2Lat(pcr.getX(), pcr.getY()), coordinateConverter.x2Lon(pcr.getX(), pcr.getY())); } @Inject  FreeFlowAnalysis(Configuration configuration, AppStatisticsService statisticsService, EventEmittingTracker trackingService, EventRepository eventRepository); @Override String toString(); }
FreeFlowAnalysis extends PeriodicAnalysis { static Position centerOfVessel(Position aisPosition, float hdg, int dimStern, int dimBow, int dimPort, int dimStarboard) { final double thetaDeg = compass2cartesian(hdg); final Position geodeticReference = aisPosition; final CoordinateConverter coordinateConverter = new CoordinateConverter(geodeticReference.getLongitude(), geodeticReference.getLatitude()); final double trackLatitude = aisPosition.getLatitude(); final double trackLongitude = aisPosition.getLongitude(); final double x = coordinateConverter.lon2x(trackLongitude, trackLatitude); final double y = coordinateConverter.lat2y(trackLongitude, trackLatitude); final Point pAis = new Point(x, y); final Point pc = new Point((dimBow + dimStern)/2 - dimStern, (dimPort+dimStarboard)/2 - dimStarboard); final Point pcr = pc.rotate(pAis, thetaDeg); return Position.create(coordinateConverter.y2Lat(pcr.getX(), pcr.getY()), coordinateConverter.x2Lon(pcr.getX(), pcr.getY())); } @Inject  FreeFlowAnalysis(Configuration configuration, AppStatisticsService statisticsService, EventEmittingTracker trackingService, EventRepository eventRepository); @Override String toString();  }