mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-17 17:50:56 +00:00
Merge branch 'bug3296' into blogintegration
Conflicts: java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/common/client/i18n/TextMessages_zh.properties
This commit is contained in:
commit
a523c26fd3
1457 files changed
+95179
-26174
No files matched your search
@@ -1,18 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="lib/dom4j-1.6.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/xml-apis-1.0.b2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/xmlbeans-2.4.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/com.springsource.org.apache.commons.beanutils-1.8.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/com.springsource.org.apache.commons.collections-3.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/com.springsource.org.apache.commons.digester-1.8.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-jexl-2.0.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jxls-core-1.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jxls-reader-1.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/org.apache.poi_3.7.0.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="resources"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="resources"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -16,16 +16,11 @@ Require-Bundle: com.sap.sailing.server,
|
||||
jcl.over.slf4j;bundle-version="1.6.4",
|
||||
com.sap.sailing.resultimport,
|
||||
slf4j.api;bundle-version="1.6.4",
|
||||
com.sap.sse.common
|
||||
Bundle-ClassPath: lib/com.springsource.org.apache.commons.beanutils-1.8.0.jar,
|
||||
lib/com.springsource.org.apache.commons.collections-3.2.1.jar,
|
||||
lib/com.springsource.org.apache.commons.digester-1.8.0.jar,
|
||||
lib/commons-jexl-2.0.1.jar,
|
||||
lib/jxls-core-1.0.jar,
|
||||
lib/jxls-reader-1.0.jar,
|
||||
lib/org.apache.poi_3.7.0.jar,
|
||||
.,
|
||||
lib/xml-apis-1.0.b2.jar,
|
||||
lib/xmlbeans-2.4.0.jar,
|
||||
lib/dom4j-1.6.1.jar
|
||||
com.sap.sse.common,
|
||||
org.dom4j;bundle-version="1.6.1",
|
||||
org.apache.xmlbeans;bundle-version="2.3.0",
|
||||
org.apache.poi;bundle-version="3.9.0",
|
||||
org.apache.poi.ooxml;bundle-version="3.9.0",
|
||||
org.apache.poi.ooxml.schemas;bundle-version="3.9.0"
|
||||
Bundle-ClassPath: .
|
||||
Export-Package: com.sap.sailing.barbados.resultimport.impl;x-friends:="com.sap.sailing.barbados.resultimport.test"
|
||||
@@ -2,14 +2,4 @@ source.. = src/,\
|
||||
resources/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
lib/com.springsource.org.apache.commons.beanutils-1.8.0.jar,\
|
||||
lib/com.springsource.org.apache.commons.collections-3.2.1.jar,\
|
||||
lib/com.springsource.org.apache.commons.digester-1.8.0.jar,\
|
||||
lib/commons-jexl-2.0.1.jar,\
|
||||
lib/jxls-core-1.0.jar,\
|
||||
lib/jxls-reader-1.0.jar,\
|
||||
lib/org.apache.poi_3.7.0.jar,\
|
||||
lib/xml-apis-1.0.b2.jar,\
|
||||
lib/xmlbeans-2.4.0.jar,\
|
||||
lib/dom4j-1.6.1.jar
|
||||
.
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -27,46 +27,6 @@
|
||||
height: 100% !important;
|
||||
}
|
||||
|
||||
.bottomnotification {
|
||||
position: absolute !important;
|
||||
opacity: 0.9;
|
||||
background-color: #F0AB00;
|
||||
height: 0pt;
|
||||
line-height: 0pt;
|
||||
width: 100%;
|
||||
bottom: 0pt;
|
||||
text-align: center;
|
||||
font-size: 15pt;
|
||||
line-height: 30pt;
|
||||
color: black;
|
||||
font-family: 'Open Sans', Arial, Verdana, sans-serif;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.bottomnotificationshow {
|
||||
-webkit-transition: all 700ms cubic-bezier(0.480, 0, 0.000, 1);
|
||||
/* older webkit */
|
||||
-webkit-transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 2.650);
|
||||
-moz-transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 2.650);
|
||||
-o-transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 2.650);
|
||||
transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 2.650);
|
||||
/* custom */
|
||||
height: 30pt;
|
||||
line-height: 30pt;
|
||||
}
|
||||
|
||||
.bottomnotificationhidden {
|
||||
-webkit-transition: all 700ms cubic-bezier(0.480, 0, 0.000, 1);
|
||||
/* older webkit */
|
||||
-webkit-transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 1.650);
|
||||
-moz-transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 1.650);
|
||||
-o-transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 1.650);
|
||||
transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 1.650);
|
||||
/* custom */
|
||||
height: 0pt;
|
||||
line-height: 0pt;
|
||||
}
|
||||
|
||||
.eventLogo {
|
||||
position: absolute;
|
||||
right: 12.5px;
|
||||
@@ -74,62 +34,3 @@
|
||||
height: 22.5pt;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.wrongOrientationNotification {
|
||||
position: absolute !important;
|
||||
top: 50%;
|
||||
right: 50%;
|
||||
background-color: white;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.wrongOrientationNotification_shown {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
margin-right: -100px;
|
||||
margin-top: -100px;
|
||||
border-radius: 100px;
|
||||
-webkit-transition: all 700ms cubic-bezier(0.480, 0, 0.000, 1);
|
||||
/* older webkit */
|
||||
-webkit-transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 1.250);
|
||||
-moz-transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 1.250);
|
||||
-o-transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 1.250);
|
||||
transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 1.250);
|
||||
opacity: 1.0;
|
||||
}
|
||||
|
||||
.wrongOrientationNotification_hidden {
|
||||
width: 0px;
|
||||
height: 0px;
|
||||
marin-right: 0px;
|
||||
margin-top: 0px;
|
||||
border-radius: 0px;
|
||||
overflow: hidden;
|
||||
-webkit-transition: all 300ms;
|
||||
/* older webkit */
|
||||
-webkit-transition: all 300ms;
|
||||
-moz-transition: all 300ms;
|
||||
-o-transition: all 300ms;
|
||||
transition: all 300ms;
|
||||
opacity: 0.0;
|
||||
}
|
||||
|
||||
.wrongOrientationNotification_logo {
|
||||
max-width: 40%;
|
||||
max-height: 40%;
|
||||
margin: 30%;
|
||||
margin-top: 23%
|
||||
}
|
||||
|
||||
.wrongOrientationNotification_text {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 14px;
|
||||
top: 76%;
|
||||
line-height: 10px;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
font-size: 13px;
|
||||
color: grey;
|
||||
font-family: 'Open Sans', Arial, Verdana, sans-serif;
|
||||
}
|
||||
@@ -43,5 +43,5 @@
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.DevMode"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-superDevMode -incremental -war "${project_loc:com.sap.sailing.dashboards.gwt}" -startupUrl /dashboards/RibDashboard.html -noserver -remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -logLevel INFO -codeServerPort 9998 com.sap.sailing.dashboards.gwt.RibDashboard"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.dashboards.gwt"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XstartOnFirstThread -Xmx2048m"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx2048m"/>
|
||||
</launchConfiguration>
|
||||
@@ -21,21 +21,21 @@
|
||||
</listAttribute>
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
|
||||
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6" path="1" type="4"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.gwt.ui/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.gwt.ui/src/main/java" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.dashboards.gwt/src/main/java" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.dashboards.gwt/src/main/resources" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.server/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sse.gwt/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sse.common/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="com.sap.sailing.dashboards.gwt"/> </runtimeClasspathEntry> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.google.gwt.osgi/lib/gwt-servlet.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.google.gwt.osgi/lib/gwt-user.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.common/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/org.moxieapps.gwt.highcharts/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sse.gwt.adminconsole/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6" path="1" type="4"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.gwt.ui/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.gwt.ui/src/main/java" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.dashboards.gwt/src/main/java" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.dashboards.gwt/src/main/resources" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.server/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sse.gwt/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sse.common/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="com.sap.sailing.dashboards.gwt"/> </runtimeClasspathEntry> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.google.gwt.osgi/lib/gwt-servlet.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.google.gwt.osgi/lib/gwt-user.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.common/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/org.moxieapps.gwt.highcharts/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sse.gwt.adminconsole/src" path="3" type="2"/> "/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gwt.eclipse.core.moduleClasspathProvider"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
|
||||
@@ -43,5 +43,5 @@
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.DevMode"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-nosuperDevMode -incremental -war "${project_loc:com.sap.sailing.dashboards.gwt}" -startupUrl /dashboards/RibDashboard.html -noserver -remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -logLevel INFO -codeServerPort auto com.sap.sailing.dashboards.gwt.RibDashboard"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.dashboards.gwt"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XstartOnFirstThread -Xmx2048m"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx2048m"/>
|
||||
</launchConfiguration>
|
||||
+1
-2
@@ -41,9 +41,8 @@ public class RibDashboardEntryPoint extends AbstractEntryPoint<StringMessages> {
|
||||
applyMGWTSettings();
|
||||
RibDashboardPanel ribDashboardPanel = new RibDashboardPanel(ribdashboardService, sailingService, dataRetriever);
|
||||
RootLayoutPanel.get().add(ribDashboardPanel);
|
||||
WindBotDataRetriever windBotDataRetriever = new WindBotDataRetriever(sailingService);
|
||||
WindBotDataRetriever windBotDataRetriever = new WindBotDataRetriever(ribdashboardService, sailingService);
|
||||
windBotDataRetriever.addNumberOfWindBotsChangeListeners(ribDashboardPanel);
|
||||
dataRetriever.addRaceSelectionChangeListener(windBotDataRetriever);
|
||||
Timer dashboardTimer = new Timer(PlayModes.Live);
|
||||
dashboardTimer.setRefreshInterval(DASHBOARD_RERFRESH_INTERVAL);
|
||||
dashboardTimer.addTimeListener(windBotDataRetriever);
|
||||
|
||||
+5
-5
@@ -24,7 +24,7 @@ import com.sap.sailing.dashboards.gwt.client.dataretriever.WindBotDataRetrieverP
|
||||
import com.sap.sailing.dashboards.gwt.client.eventlogo.EventLogo;
|
||||
import com.sap.sailing.dashboards.gwt.client.notifications.WrongDeviceOrientationNotification;
|
||||
import com.sap.sailing.dashboards.gwt.client.startanalysis.StartlineAnalysisComponent;
|
||||
import com.sap.sailing.dashboards.gwt.client.startlineadvantage.StartLineAdvantageComponent;
|
||||
import com.sap.sailing.dashboards.gwt.client.startlineadvantage.StartLineAdvantageByGeometryComponent;
|
||||
import com.sap.sailing.dashboards.gwt.client.startlineadvantage.StartlineAdvantagesByWindComponent;
|
||||
import com.sap.sailing.dashboards.gwt.client.windchart.WindBotComponent;
|
||||
import com.sap.sailing.dashboards.gwt.shared.dto.RibDashboardRaceInfoDTO;
|
||||
@@ -45,7 +45,6 @@ public class RibDashboardPanel extends Composite implements RibDashboardDataRetr
|
||||
}
|
||||
|
||||
private static RootUiBinder uiBinder = GWT.create(RootUiBinder.class);
|
||||
private static final Logger logger = Logger.getLogger(RibDashboardPanel.class.getName());
|
||||
|
||||
@UiField
|
||||
RibDashboardPanelStyle style;
|
||||
@@ -84,18 +83,19 @@ public class RibDashboardPanel extends Composite implements RibDashboardDataRetr
|
||||
public StartlineAnalysisComponent startanalysisComponent;
|
||||
|
||||
@UiField(provided = true)
|
||||
public StartLineAdvantageComponent startlineAdvantageByGeometryComponent;
|
||||
public StartLineAdvantageByGeometryComponent startlineAdvantageByGeometryComponent;
|
||||
|
||||
private List<WindBotComponent> windBotComponents;
|
||||
private StringMessages stringConstants;
|
||||
private final String EVENT_ID_PARAMETER = "eventId";
|
||||
private static final Logger logger = Logger.getLogger(RibDashboardPanel.class.getName());
|
||||
|
||||
public RibDashboardPanel(RibDashboardServiceAsync ribDashboardService, SailingServiceAsync sailingServiceAsync, RibDashboardDataRetriever ribDashboardDataRetriever) {
|
||||
windBotComponents = new ArrayList<WindBotComponent>();
|
||||
ribDashboardDataRetriever.addDataObserver(this);
|
||||
startanalysisComponent = new StartlineAnalysisComponent(ribDashboardService, sailingServiceAsync);
|
||||
startlineAdvantagesByWindComponent = new StartlineAdvantagesByWindComponent(ribDashboardService);
|
||||
startlineAdvantageByGeometryComponent = new StartLineAdvantageComponent(ribDashboardDataRetriever);
|
||||
startlineAdvantageByGeometryComponent = new StartLineAdvantageByGeometryComponent(ribDashboardDataRetriever);
|
||||
stringConstants = StringMessages.INSTANCE;
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
initLogos();
|
||||
@@ -172,6 +172,7 @@ public class RibDashboardPanel extends Composite implements RibDashboardDataRetr
|
||||
@Override
|
||||
public void updateUIWithNewLiveRaceInfo(RibDashboardRaceInfoDTO liveRaceInfoDTO) {
|
||||
if (liveRaceInfoDTO != null && liveRaceInfoDTO.idOfLastTrackedRace != null) {
|
||||
logger.log(Level.INFO, "Updating UI with RibDashboardRaceInfoDTO race name");
|
||||
this.header.getElement().setInnerText(liveRaceInfoDTO.idOfLastTrackedRace.getRaceName());
|
||||
}
|
||||
}
|
||||
@@ -179,7 +180,6 @@ public class RibDashboardPanel extends Composite implements RibDashboardDataRetr
|
||||
@Override
|
||||
public void numberOfWindBotsChanged(List<String> windBotIDs,
|
||||
WindBotDataRetrieverProvider windBotDataRetrieverProvider) {
|
||||
logger.log(Level.INFO, "Number of Windbots changed");
|
||||
initWindBotComponents(windBotIDs, windBotDataRetrieverProvider);
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -36,8 +36,7 @@
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel styleName="{style.collumn} {style.collumn3}">
|
||||
<g:HTMLPanel styleName="{style.startline_advantage_by_geometry_container}">
|
||||
<startlineadvantage:StartLineAdvantageComponent
|
||||
ui:field="startlineAdvantageByGeometryComponent"></startlineadvantage:StartLineAdvantageComponent>
|
||||
<startlineadvantage:StartLineAdvantageByGeometryComponent ui:field="startlineAdvantageByGeometryComponent"></startlineadvantage:StartLineAdvantageByGeometryComponent>
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel styleName="{style.startline_advantage_by_wind_container}">
|
||||
<startlineadvantage:StartlineAdvantagesByWindComponent
|
||||
|
||||
+4
-1
@@ -7,10 +7,13 @@ import com.sap.sailing.dashboards.gwt.shared.dto.RibDashboardRaceInfoDTO;
|
||||
import com.sap.sailing.dashboards.gwt.shared.dto.StartlineAdvantagesWithMaxAndAverageDTO;
|
||||
import com.sap.sailing.dashboards.gwt.shared.dto.startanalysis.StartAnalysisDTO;
|
||||
import com.sap.sailing.domain.common.NoWindException;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
|
||||
public interface RibDashboardService extends RemoteService {
|
||||
RibDashboardRaceInfoDTO getLiveRaceInfo(String leaderboardName) throws NoWindException;
|
||||
RibDashboardRaceInfoDTO getLiveRaceInfo(String leaderboardName) throws NoWindException;
|
||||
|
||||
RegattaAndRaceIdentifier getIDFromRaceThatTakesWindFixesNow(String leaderboardName);
|
||||
|
||||
List<StartAnalysisDTO> getStartAnalysisListForCompetitorIDAndLeaderboardName(String competitorIdAsString, String leaderboardName);
|
||||
|
||||
|
||||
+4
@@ -6,6 +6,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sap.sailing.dashboards.gwt.shared.dto.RibDashboardRaceInfoDTO;
|
||||
import com.sap.sailing.dashboards.gwt.shared.dto.StartlineAdvantagesWithMaxAndAverageDTO;
|
||||
import com.sap.sailing.dashboards.gwt.shared.dto.startanalysis.StartAnalysisDTO;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
|
||||
public interface RibDashboardServiceAsync {
|
||||
@@ -17,4 +18,7 @@ public interface RibDashboardServiceAsync {
|
||||
void getCompetitorsInLeaderboard(String leaderboardName, AsyncCallback<List<CompetitorDTO>> callback);
|
||||
|
||||
void getAdvantagesOnStartline(String leaderboardName, AsyncCallback<StartlineAdvantagesWithMaxAndAverageDTO> callback);
|
||||
|
||||
void getIDFromRaceThatTakesWindFixesNow(String leaderboardName, AsyncCallback<RegattaAndRaceIdentifier> callback);
|
||||
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.sap.sailing.dashboards.gwt.client.actions;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sap.sailing.dashboards.gwt.client.RibDashboardServiceAsync;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sse.gwt.client.async.AsyncAction;
|
||||
|
||||
/**
|
||||
* @author Alexander Ries (D062114)
|
||||
*
|
||||
*/
|
||||
public class GetIDFromRaceThatTakesWindFixesNowAction implements AsyncAction<RegattaAndRaceIdentifier> {
|
||||
|
||||
private final RibDashboardServiceAsync ribDashboardService;
|
||||
private final String leaderboardName;
|
||||
|
||||
public GetIDFromRaceThatTakesWindFixesNowAction(RibDashboardServiceAsync ribDashboardService, String leaderboardName) {
|
||||
this.ribDashboardService = ribDashboardService;
|
||||
this.leaderboardName = leaderboardName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(AsyncCallback<RegattaAndRaceIdentifier> callback) {
|
||||
ribDashboardService.getIDFromRaceThatTakesWindFixesNow(leaderboardName, callback);
|
||||
}
|
||||
}
|
||||
+21
-3
@@ -4,6 +4,8 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
@@ -37,6 +39,7 @@ public class RibDashboardDataRetriever implements TimeListener, RaceSelectionPro
|
||||
private final Object MUTEX;
|
||||
|
||||
private static final String PARAM_LEADERBOARD_NAME = "leaderboardName";
|
||||
private static final Logger logger = Logger.getLogger(RibDashboardDataRetriever.class.getName());
|
||||
|
||||
public RibDashboardDataRetriever(RibDashboardServiceAsync ribDashboardService) {
|
||||
initNonFinalMemberVariablesWithNoArgumentConstructor();
|
||||
@@ -54,26 +57,40 @@ public class RibDashboardDataRetriever implements TimeListener, RaceSelectionPro
|
||||
private void loadLiveRaceInfoFromRibDashboadService() {
|
||||
|
||||
GetRibDashboardRaceInfoAction getRibDashboardRaceInfoAction = new GetRibDashboardRaceInfoAction(ribDashboardService, leaderboardName);
|
||||
|
||||
logger.log(Level.INFO, "Executing GetRibDashboardRaceInfoAction");
|
||||
asyncActionsExecutor.execute(getRibDashboardRaceInfoAction, new AsyncCallback<RibDashboardRaceInfoDTO>() {
|
||||
@Override
|
||||
public void onSuccess(RibDashboardRaceInfoDTO result) {
|
||||
logger.log(Level.INFO, "Received RibDashboardRaceInfoDTO");
|
||||
if (result != null) {
|
||||
switch (result.responseMessage) {
|
||||
case RACE_LIVE:
|
||||
List<RegattaAndRaceIdentifier> singletonList = Collections
|
||||
.singletonList(result.idOfLastTrackedRace);
|
||||
logger.log(Level.INFO, "RibDashboardRaceInfoDTO.responseMessage is RACE_LIVE");
|
||||
if(result.idOfLastTrackedRace != null) {
|
||||
logger.log(Level.INFO, "RibDashboardRaceInfoDTO idOfLastTrackedRace is "+result.idOfLastTrackedRace);
|
||||
List<RegattaAndRaceIdentifier> singletonList = Collections.singletonList(result.idOfLastTrackedRace);
|
||||
setSelection(singletonList);
|
||||
} else {
|
||||
logger.log(Level.INFO, "RibDashboardRaceInfoDTO.idOfLastTrackedRace is null");
|
||||
}
|
||||
notifyDataObservers(result);
|
||||
break;
|
||||
case NO_RACE_LIVE:
|
||||
logger.log(Level.INFO, "RibDashboardRaceInfoDTO.responseMessage is NO_RACE_LIVE");
|
||||
break;
|
||||
default:
|
||||
logger.log(Level.INFO, "RibDashboardRaceInfoDTO.responseMessage is null");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
logger.log(Level.INFO, "RibDashboardRaceInfoDTO is null");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
logger.log(Level.INFO, "Failed to received RibDashboardRaceInfoDTO");
|
||||
logger.log(Level.INFO, caught.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -93,6 +110,7 @@ public class RibDashboardDataRetriever implements TimeListener, RaceSelectionPro
|
||||
}
|
||||
|
||||
public void notifyDataObservers(RibDashboardRaceInfoDTO liveRaceInfoDTO) {
|
||||
logger.log(Level.INFO, "Notifing RibDashboardDataRetrieverListener about new RibDashboardRaceInfoDTO");
|
||||
List<RibDashboardDataRetrieverListener> dataObserverCopy;
|
||||
synchronized (MUTEX) {
|
||||
dataObserverCopy = new ArrayList<RibDashboardDataRetrieverListener>(dataRetrieverListener);
|
||||
|
||||
+43
-19
@@ -5,52 +5,60 @@ import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sap.sailing.dashboards.gwt.client.RibDashboardServiceAsync;
|
||||
import com.sap.sailing.dashboards.gwt.client.actions.GetIDFromRaceThatTakesWindFixesNowAction;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.common.WindSourceType;
|
||||
import com.sap.sailing.gwt.ui.actions.GetWindInfoAction;
|
||||
import com.sap.sailing.gwt.ui.client.RaceSelectionChangeListener;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.shared.WindInfoForRaceDTO;
|
||||
import com.sap.sse.gwt.client.async.AsyncActionsExecutor;
|
||||
import com.sap.sse.gwt.client.player.TimeListener;
|
||||
|
||||
public class WindBotDataRetriever implements TimeListener, RaceSelectionChangeListener, WindBotDataRetrieverProvider {
|
||||
public class WindBotDataRetriever implements TimeListener, WindBotDataRetrieverProvider {
|
||||
|
||||
private AsyncActionsExecutor asyncActionsExecutor;
|
||||
private final RibDashboardServiceAsync ribDashboardService;
|
||||
private final SailingServiceAsync sailingService;
|
||||
private RegattaAndRaceIdentifier currentLiveRace;
|
||||
private List<NumberOfWindBotsChangeListener> numberOfWindBotsChangeListeners;
|
||||
private List<WindBotDataRetrieverListener> windBotDataRetrieverListeners;
|
||||
private List<String> windBotIDsInLiveRace;
|
||||
private String leaderboardName;
|
||||
|
||||
private final Set<String> windSourceTypeNames;
|
||||
private final int WIND_CHART_RESOLUTION_IN_MILLISECONDS = 5000;
|
||||
private final int ONE_HOUR_IN_MILLISECONDS = 1000*60*60;
|
||||
private final String LODA_WIND_CHART_DATA_CATEGORY = "loadWindChartData";
|
||||
private static final String PARAM_LEADERBOARD_NAME = "leaderboardName";
|
||||
private boolean didInitialLoading;
|
||||
|
||||
private static final Logger logger = Logger.getLogger(WindBotDataRetriever.class.getName());
|
||||
|
||||
|
||||
public WindBotDataRetriever(SailingServiceAsync sailingService) {
|
||||
public WindBotDataRetriever(RibDashboardServiceAsync ribDashboardService, SailingServiceAsync sailingService) {
|
||||
this.ribDashboardService = ribDashboardService;
|
||||
this.sailingService = sailingService;
|
||||
currentLiveRace = null;
|
||||
didInitialLoading = false;
|
||||
asyncActionsExecutor = new AsyncActionsExecutor();
|
||||
numberOfWindBotsChangeListeners = new ArrayList<NumberOfWindBotsChangeListener>();
|
||||
windBotDataRetrieverListeners = new ArrayList<WindBotDataRetrieverListener>();
|
||||
windBotIDsInLiveRace = new ArrayList<String>();
|
||||
windSourceTypeNames = new HashSet<>();
|
||||
this.leaderboardName = Window.Location.getParameter(PARAM_LEADERBOARD_NAME);
|
||||
windSourceTypeNames.add(WindSourceType.EXPEDITION.name());
|
||||
}
|
||||
|
||||
private void loadWindBotData(Date from, Date to, RegattaAndRaceIdentifier selectedRaceIdentifier) {
|
||||
if(!didInitialLoading){
|
||||
if (!didInitialLoading) {
|
||||
didInitialLoading = true;
|
||||
from = new Date(from.getTime()-ONE_HOUR_IN_MILLISECONDS);
|
||||
}
|
||||
logger.log(Level.INFO, "Executing GetWindInfoAction with from "+from+" and to "+to);
|
||||
GetWindInfoAction getWindInfoAction = new GetWindInfoAction(sailingService, selectedRaceIdentifier, from, to,
|
||||
WIND_CHART_RESOLUTION_IN_MILLISECONDS, windSourceTypeNames, /*
|
||||
* onlyUpToNewestEvent==true because we don't want to
|
||||
@@ -60,18 +68,23 @@ public class WindBotDataRetriever implements TimeListener, RaceSelectionChangeLi
|
||||
new AsyncCallback<WindInfoForRaceDTO>() {
|
||||
@Override
|
||||
public void onSuccess(WindInfoForRaceDTO result) {
|
||||
logger.log(Level.INFO, "Received WindInfoForRaceDTO");
|
||||
if (result != null) {
|
||||
if(windBotIDsInLiveRace.size() != getWindBotIdsFrom(result).size()){
|
||||
windBotIDsInLiveRace = getWindBotIdsFrom(result);
|
||||
notifyListenersAboutNumberOfWindBotChange(windBotIDsInLiveRace);
|
||||
logger.log(Level.INFO, "Number of Windbots changed");
|
||||
}
|
||||
notifyWindBotDataRetrieverListeners(result);
|
||||
} else {
|
||||
logger.log(Level.INFO, "WindInfoForRaceDTO is null");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
||||
logger.log(Level.INFO, "Failed to received WindInfoForRaceDTO");
|
||||
logger.log(Level.INFO, caught.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -111,6 +124,7 @@ public class WindBotDataRetriever implements TimeListener, RaceSelectionChangeLi
|
||||
|
||||
@Override
|
||||
public void notifyWindBotDataRetrieverListeners(WindInfoForRaceDTO windInfoForRaceDTO) {
|
||||
logger.log(Level.INFO, "Notifing WindBotDataRetrieverListener about new WindInfoForRaceDTO");
|
||||
for (WindBotDataRetrieverListener windBotDataRetrieverListener : windBotDataRetrieverListeners) {
|
||||
windBotDataRetrieverListener.updateWindBotUI(windInfoForRaceDTO);
|
||||
}
|
||||
@@ -118,17 +132,27 @@ public class WindBotDataRetriever implements TimeListener, RaceSelectionChangeLi
|
||||
|
||||
@Override
|
||||
public void timeChanged(Date newTime, Date oldTime) {
|
||||
if (currentLiveRace != null) {
|
||||
loadWindBotData(oldTime, newTime, currentLiveRace);
|
||||
}
|
||||
}
|
||||
final Date finalNewTime = newTime;
|
||||
final Date finaloldTime = oldTime;
|
||||
GetIDFromRaceThatTakesWindFixesNowAction getIDFromRaceThatTakesWindFixesNowAction = new GetIDFromRaceThatTakesWindFixesNowAction(ribDashboardService, leaderboardName);
|
||||
logger.log(Level.INFO, "Executing GetIDFromRaceThatTakesWindFixesNowAction");
|
||||
asyncActionsExecutor.execute(getIDFromRaceThatTakesWindFixesNowAction, new AsyncCallback<RegattaAndRaceIdentifier>() {
|
||||
@Override
|
||||
public void onSuccess(RegattaAndRaceIdentifier result) {
|
||||
logger.log(Level.INFO, "Received RegattaAndRaceIdentifier from race that takes wind fixes now");
|
||||
if(result != null) {
|
||||
loadWindBotData(finaloldTime, finalNewTime, result);
|
||||
} else {
|
||||
logger.log(Level.INFO, "RegattaAndRaceIdentifier is null");
|
||||
logger.log(Level.INFO, "Can´t load wind data");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRaceSelectionChange(List<RegattaAndRaceIdentifier> selectedRaces) {
|
||||
if (selectedRaces == null) {
|
||||
currentLiveRace = null;
|
||||
} else if (selectedRaces.size() > 0) {
|
||||
currentLiveRace = selectedRaces.get(0);
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
logger.log(Level.INFO, " Failed to received RegattaAndRaceIdentifier from race that takes wind fixes now");
|
||||
logger.log(Level.INFO, caught.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+10
@@ -1,6 +1,8 @@
|
||||
package com.sap.sailing.dashboards.gwt.client.eventlogo;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.google.gwt.dom.client.Style.Visibility;
|
||||
import com.google.gwt.user.client.Window;
|
||||
@@ -12,6 +14,8 @@ import com.sap.sse.gwt.client.media.ImageDTO;
|
||||
|
||||
public class EventLogo extends Image {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(EventLogo.class.getName());
|
||||
|
||||
protected EventLogo() {
|
||||
super();
|
||||
this.getElement().addClassName("eventLogo");
|
||||
@@ -21,9 +25,11 @@ public class EventLogo extends Image {
|
||||
final EventLogo eventLogo = new EventLogo();
|
||||
try {
|
||||
final UUID eventUUID = UUID.fromString(eventId);
|
||||
logger.log(Level.INFO, "Loading EventDTO for id " + eventId);
|
||||
sailingServiceAsync.getEventById(eventUUID, true, new AsyncCallback<EventDTO>() {
|
||||
@Override
|
||||
public void onSuccess(final EventDTO event) {
|
||||
logger.log(Level.INFO, "Received EventDTO");
|
||||
if (event != null) {
|
||||
final ImageDTO logo = event.getLogoImage();
|
||||
if (logo != null) {
|
||||
@@ -34,11 +40,15 @@ public class EventLogo extends Image {
|
||||
if (event.getName() != null) {
|
||||
Window.setTitle(event.getName() + " Dashboard");
|
||||
}
|
||||
} else {
|
||||
logger.log(Level.INFO, "Received EventDTO is null");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
logger.log(Level.INFO, "Failed to received EventDTO");
|
||||
logger.log(Level.INFO, caught.getMessage());
|
||||
eventLogo.getElement().getStyle().setVisibility(Visibility.HIDDEN);
|
||||
}
|
||||
});
|
||||
|
||||
+18
-17
@@ -3,6 +3,7 @@ package com.sap.sailing.dashboards.gwt.client.notifications;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
@@ -21,38 +22,38 @@ public class BottomNotification extends FocusPanel {
|
||||
private Timer timer;
|
||||
private List<BottomNotificationClickListener> bottomNotificationClickListeners;
|
||||
|
||||
private static NotificationsResources resources = GWT.create(NotificationsResources.class);
|
||||
|
||||
public BottomNotification() {
|
||||
|
||||
this.addStyleName("bottomnotification");
|
||||
resources.notificationsStyle().ensureInjected();
|
||||
this.addStyleName(resources.notificationsStyle().bottomnotification());
|
||||
this.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
if (shown == true) {
|
||||
shown = false;
|
||||
BottomNotification.this.getElement().getStyle().setOpacity(1.0);
|
||||
nofitifyBottomNotificationClickListenersAboutClick();
|
||||
hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
this.addStyleName("bottomnotification");
|
||||
bottomNotificationClickListeners = new ArrayList<BottomNotificationClickListener>();
|
||||
}
|
||||
|
||||
public void show(BottomNotificationType bottomNotificationType) {
|
||||
shown = true;
|
||||
this.removeStyleName("bottomnotificationhidden");
|
||||
this.addStyleName("bottomnotificationshow");
|
||||
this.getElement().setInnerHTML(bottomNotificationType.getMessage());
|
||||
this.getElement().getStyle().setBackgroundColor(bottomNotificationType.getBackgroundColorAsHex());
|
||||
this.getElement().getStyle().setColor(bottomNotificationType.getTextColorAsHex());
|
||||
if (bottomNotificationType.isShouldDisappearAfter20Seconds()) {
|
||||
if (shown == false) {
|
||||
this.removeStyleName(resources.notificationsStyle().bottomnotification_hidden());
|
||||
this.addStyleName(resources.notificationsStyle().bottomnotification_shown());
|
||||
this.getElement().setInnerHTML(bottomNotificationType.getMessage());
|
||||
this.getElement().getStyle().setBackgroundColor(bottomNotificationType.getBackgroundColorAsHex());
|
||||
this.getElement().getStyle().setColor(bottomNotificationType.getTextColorAsHex());
|
||||
Timer timer = new Timer() {
|
||||
public void run() {
|
||||
hide();
|
||||
}
|
||||
};
|
||||
timer.schedule(20000);
|
||||
timer.schedule(bottomNotificationType.timeToDisappearInMilliseconds());
|
||||
shown = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,10 +61,10 @@ public class BottomNotification extends FocusPanel {
|
||||
if (timer != null) {
|
||||
timer.cancel();
|
||||
}
|
||||
shown = false;
|
||||
this.removeStyleName("bottomnotificationshow");
|
||||
this.addStyleName("bottomnotificationhidden");
|
||||
this.removeStyleName(resources.notificationsStyle().bottomnotification_shown());
|
||||
this.addStyleName(resources.notificationsStyle().bottomnotification_hidden());
|
||||
this.getElement().setInnerHTML("");
|
||||
shown = false;
|
||||
}
|
||||
|
||||
public void addBottomNotificationClickListener(BottomNotificationClickListener bottomNotificationClickListener) {
|
||||
@@ -75,8 +76,8 @@ public class BottomNotification extends FocusPanel {
|
||||
}
|
||||
|
||||
private void nofitifyBottomNotificationClickListenersAboutClick() {
|
||||
for (BottomNotificationClickListener bncl : bottomNotificationClickListeners) {
|
||||
bncl.bottomNotificationClicked();
|
||||
for (BottomNotificationClickListener bottomNotificationClickListener : bottomNotificationClickListeners) {
|
||||
bottomNotificationClickListener.bottomNotificationClicked();
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -4,18 +4,18 @@ import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
|
||||
public enum BottomNotificationType {
|
||||
|
||||
NEW_STARTANALYSIS_AVAILABLE(StringMessages.INSTANCE.dashboardNewStartAnalysisAvailable(), "#F0AB00", "#000000", true);
|
||||
NEW_STARTANALYSIS_AVAILABLE(StringMessages.INSTANCE.dashboardNewStartAnalysisAvailable(), "#F0AB00", "#000000", 20000);
|
||||
|
||||
private String message;
|
||||
private String backgroundColorAsHex;
|
||||
private String textColorAsHex;
|
||||
private boolean shouldDisappearAfter20Seconds;
|
||||
private int timeToDisappearInMilliseconds;
|
||||
|
||||
private BottomNotificationType(String message, String backgroundColorAsHex, String textColorAsHex, boolean shouldDisappearAfter20Seconds) {
|
||||
private BottomNotificationType(String message, String backgroundColorAsHex, String textColorAsHex, int timeToDisappearInMilliseconds) {
|
||||
this.message = message;
|
||||
this.backgroundColorAsHex = backgroundColorAsHex;
|
||||
this.textColorAsHex = textColorAsHex;
|
||||
this.shouldDisappearAfter20Seconds = shouldDisappearAfter20Seconds;
|
||||
this.timeToDisappearInMilliseconds = timeToDisappearInMilliseconds;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
@@ -30,7 +30,7 @@ public enum BottomNotificationType {
|
||||
return textColorAsHex;
|
||||
}
|
||||
|
||||
public boolean isShouldDisappearAfter20Seconds() {
|
||||
return shouldDisappearAfter20Seconds;
|
||||
public int timeToDisappearInMilliseconds() {
|
||||
return timeToDisappearInMilliseconds;
|
||||
}
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
@CHARSET "UTF-8";
|
||||
|
||||
.bottomnotification {
|
||||
position: absolute !important;
|
||||
opacity: 0.9;
|
||||
background-color: #F0AB00;
|
||||
height: 0pt;
|
||||
line-height: 0pt;
|
||||
width: 100%;
|
||||
bottom: 0pt;
|
||||
text-align: center;
|
||||
font-size: 15pt;
|
||||
line-height: 30pt;
|
||||
color: black;
|
||||
font-family: 'Open Sans', Arial, Verdana, sans-serif;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.bottomnotification_shown {
|
||||
-webkit-transition: all 700ms cubic-bezier(0.480, 0, 0.000, 1);
|
||||
/* older webkit */
|
||||
-webkit-transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 2.650);
|
||||
-moz-transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 2.650);
|
||||
-o-transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 2.650);
|
||||
transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 2.650);
|
||||
/* custom */
|
||||
height: 30pt;
|
||||
line-height: 30pt;
|
||||
}
|
||||
|
||||
.bottomnotification_hidden {
|
||||
-webkit-transition: all 700ms cubic-bezier(0.480, 0, 0.000, 1);
|
||||
/* older webkit */
|
||||
-webkit-transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 1.650);
|
||||
-moz-transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 1.650);
|
||||
-o-transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 1.650);
|
||||
transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 1.650);
|
||||
/* custom */
|
||||
height: 0pt;
|
||||
line-height: 0pt;
|
||||
}
|
||||
|
||||
.wrongorientationnotification {
|
||||
position: absolute !important;
|
||||
top: 50%;
|
||||
right: 50%;
|
||||
background-color: white;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.wrongorientationnotification_shown {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
margin-right: -100px;
|
||||
margin-top: -100px;
|
||||
border-radius: 100px;
|
||||
-webkit-transition: all 700ms cubic-bezier(0.480, 0, 0.000, 1);
|
||||
/* older webkit */
|
||||
-webkit-transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 1.250);
|
||||
-moz-transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 1.250);
|
||||
-o-transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 1.250);
|
||||
transition: all 700ms cubic-bezier(0.480, -0.035, 0.000, 1.250);
|
||||
opacity: 1.0;
|
||||
}
|
||||
|
||||
.wrongorientationnotification_hidden {
|
||||
width: 0px;
|
||||
height: 0px;
|
||||
marin-right: 0px;
|
||||
margin-top: 0px;
|
||||
border-radius: 0px;
|
||||
overflow: hidden;
|
||||
-webkit-transition: all 300ms;
|
||||
/* older webkit */
|
||||
-webkit-transition: all 300ms;
|
||||
-moz-transition: all 300ms;
|
||||
-o-transition: all 300ms;
|
||||
transition: all 300ms;
|
||||
opacity: 0.0;
|
||||
}
|
||||
|
||||
.wrongorientationnotification_logo {
|
||||
max-width: 40%;
|
||||
max-height: 40%;
|
||||
margin: 30%;
|
||||
margin-top: 23%
|
||||
}
|
||||
|
||||
.wrongorientationnotification_text {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 14px;
|
||||
top: 76%;
|
||||
line-height: 10px;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
font-size: 13px;
|
||||
color: grey;
|
||||
font-family: 'Open Sans', Arial, Verdana, sans-serif;
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.sap.sailing.dashboards.gwt.client.notifications;
|
||||
|
||||
import com.google.gwt.resources.client.ClientBundle;
|
||||
import com.google.gwt.resources.client.CssResource;
|
||||
|
||||
/**
|
||||
* @author Alexander Ries (D062114)
|
||||
*
|
||||
*/
|
||||
public interface NotificationsResources extends ClientBundle {
|
||||
|
||||
@Source("Notifications.css")
|
||||
NotificationsStyle notificationsStyle();
|
||||
|
||||
public interface NotificationsStyle extends CssResource {
|
||||
public String bottomnotification();
|
||||
public String bottomnotification_shown();
|
||||
public String bottomnotification_hidden();
|
||||
public String wrongorientationnotification();
|
||||
public String wrongorientationnotification_shown();
|
||||
public String wrongorientationnotification_hidden();
|
||||
public String wrongorientationnotification_logo();
|
||||
public String wrongorientationnotification_text();
|
||||
}
|
||||
}
|
||||
+12
-8
@@ -1,5 +1,6 @@
|
||||
package com.sap.sailing.dashboards.gwt.client.notifications;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.ui.AbsolutePanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
@@ -15,18 +16,21 @@ public class WrongDeviceOrientationNotification extends AbsolutePanel implements
|
||||
|
||||
private Label rotateDeviceLabel;
|
||||
|
||||
private static NotificationsResources resources = GWT.create(NotificationsResources.class);
|
||||
|
||||
public WrongDeviceOrientationNotification() {
|
||||
super();
|
||||
this.addStyleName("wrongOrientationNotification");
|
||||
this.addStyleName("wrongOrientationNotification_hidden");
|
||||
resources.notificationsStyle().ensureInjected();
|
||||
this.addStyleName(resources.notificationsStyle().wrongorientationnotification());
|
||||
this.addStyleName(resources.notificationsStyle().wrongorientationnotification_hidden());
|
||||
|
||||
Image rotateDeviceIcon = new Image();
|
||||
rotateDeviceIcon.setResource(RibDashboardImageResources.INSTANCE.rotatedevice());
|
||||
rotateDeviceIcon.getElement().addClassName("wrongOrientationNotification_logo");
|
||||
rotateDeviceIcon.getElement().addClassName(resources.notificationsStyle().wrongorientationnotification_logo());
|
||||
add(rotateDeviceIcon);
|
||||
|
||||
rotateDeviceLabel = new Label();
|
||||
rotateDeviceLabel.getElement().addClassName("wrongOrientationNotification_text");
|
||||
rotateDeviceLabel.getElement().addClassName(resources.notificationsStyle().wrongorientationnotification_text());
|
||||
rotateDeviceLabel.setText("Rotate Device");
|
||||
add(rotateDeviceLabel);
|
||||
|
||||
@@ -35,14 +39,14 @@ public class WrongDeviceOrientationNotification extends AbsolutePanel implements
|
||||
}
|
||||
|
||||
public void show() {
|
||||
this.removeStyleName("wrongOrientationNotification_hidden");
|
||||
this.addStyleName("wrongOrientationNotification_shown");
|
||||
this.removeStyleName(resources.notificationsStyle().wrongorientationnotification_hidden());
|
||||
this.addStyleName(resources.notificationsStyle().wrongorientationnotification_shown());
|
||||
BlurEffect.getInstance().addToView(RootLayoutPanel.get());
|
||||
}
|
||||
|
||||
public void hide() {
|
||||
this.removeStyleName("wrongOrientationNotification_shown");
|
||||
this.addStyleName("wrongOrientationNotification_hidden");
|
||||
this.removeStyleName(resources.notificationsStyle().wrongorientationnotification_shown());
|
||||
this.addStyleName(resources.notificationsStyle().wrongorientationnotification_hidden());
|
||||
BlurEffect.getInstance().removeFromView(RootLayoutPanel.get());
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -147,7 +147,7 @@ public class StartlineAnalysisCard extends Composite implements HasWidgets, Star
|
||||
RaceTimesInfoProvider raceTimesInfoProvider = new RaceTimesInfoProvider(sailingServiceAsync,
|
||||
asyncActionsExecutor, null, Collections.singletonList(startAnalysisDTO.regattaAndRaceIdentifier), 5000l /* requestInterval */);
|
||||
raceMap = new RaceMap(sailingServiceAsync, asyncActionsExecutor, null, timer, competitorSelectionModel,
|
||||
StringMessages.INSTANCE, false, false, false, startAnalysisDTO.regattaAndRaceIdentifier,
|
||||
StringMessages.INSTANCE, false, false, false, false, startAnalysisDTO.regattaAndRaceIdentifier,
|
||||
resources.combinedWindPanelStyle(), /* showHeaderPanel */ true);
|
||||
raceMap.onRaceSelectionChange(Collections.singletonList(startAnalysisDTO.regattaAndRaceIdentifier));
|
||||
raceMap.getSettings().setZoomSettings(new RaceMapZoomSettings(zoomTypes, false));
|
||||
|
||||
+27
-5
@@ -4,6 +4,8 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
@@ -116,6 +118,7 @@ public class StartlineAnalysisComponent extends Composite implements HasWidgets
|
||||
private static final String SELECTED_COMPETITOR_ID_COOKIE_KEY = "selectedCompetitorId";
|
||||
private static final int SELECTED_COMPETITOR_ID_COOKIE_KEY_EXPIRE_TIME_IN_MILLIS = 60 * 1000 * 60 * 5;
|
||||
private static final int SCROLL_OFFSET_STARTANALYSIS_CARDS = 83;
|
||||
private static final Logger logger = Logger.getLogger(StartlineAnalysisComponent.class.getName());
|
||||
|
||||
/**
|
||||
* Component that contains handles, displays and loads startanalysis cards.
|
||||
@@ -172,11 +175,13 @@ public class StartlineAnalysisComponent extends Composite implements HasWidgets
|
||||
}
|
||||
|
||||
private void loadStartAnalysisDTOsForCompetitorID(String competitorIdAsString){
|
||||
logger.log(Level.INFO, "Loading startanalysis for competitor id " + competitorIdAsString);
|
||||
ribDashboardServiceAsync.getStartAnalysisListForCompetitorIDAndLeaderboardName(
|
||||
competitorIdAsString, leaderboardName, new AsyncCallback<List<StartAnalysisDTO>>() {
|
||||
@Override
|
||||
public void onSuccess(List<StartAnalysisDTO> result) {
|
||||
if (!result.isEmpty()) {
|
||||
logger.log(Level.INFO, "Received startanalysis list");
|
||||
if (result != null && !result.isEmpty()) {
|
||||
|
||||
if (displayedStartAnalysisCompetitorDifferentToRequestedOne()) {
|
||||
removeAllStartAnalysisCards();
|
||||
@@ -185,14 +190,19 @@ public class StartlineAnalysisComponent extends Composite implements HasWidgets
|
||||
if (result.size() != starts.size()) {
|
||||
showNotificationForNewStartAnalysis();
|
||||
}
|
||||
logger.log(Level.INFO, "Updating UI with startanalysis list");
|
||||
addNewStartAnalysisCards(result);
|
||||
settingsButtonWithSelectionIndicationLabel
|
||||
.setSelectionIndicationTextOnLabel(result.get(0).competitor.getName());
|
||||
} else {
|
||||
logger.log(Level.INFO, "Received startanalysis list is null or empty");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
logger.log(Level.INFO, "Failed to received startanalysis list");
|
||||
logger.log(Level.INFO, caught.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -237,15 +247,27 @@ public class StartlineAnalysisComponent extends Composite implements HasWidgets
|
||||
}
|
||||
|
||||
private void loadCompetitorsAndShowCompetitorSelectionPopup() {
|
||||
logger.log(Level.INFO, "Requesting Competitors in Leaderboard");
|
||||
ribDashboardServiceAsync.getCompetitorsInLeaderboard(leaderboardName, new AsyncCallback<List<CompetitorDTO>>() {
|
||||
@Override
|
||||
public void onSuccess(List<CompetitorDTO> result) {
|
||||
if (result != null && result.size() > 0 && !competitorSelectionPopup.isShown())
|
||||
competitorSelectionPopup.show(result);
|
||||
logger.log(Level.INFO, "Received competitors for leaderboard name");
|
||||
if (result != null && result.size() > 0) {
|
||||
if (!competitorSelectionPopup.isShown()) {
|
||||
logger.log(Level.INFO, "Showing CompetitorSelectionPopup with competitors");
|
||||
competitorSelectionPopup.show(result);
|
||||
} else {
|
||||
logger.log(Level.INFO, "CompetitorSelectionPopup aleady shown");
|
||||
}
|
||||
} else {
|
||||
logger.log(Level.INFO, "Received competitors are null or empty");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
logger.log(Level.INFO, "Failed to received competitors for leaderboard name");
|
||||
logger.log(Level.INFO, caught.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -271,7 +293,7 @@ public class StartlineAnalysisComponent extends Composite implements HasWidgets
|
||||
if (displaysCards == true) {
|
||||
if (clickedLeft) {
|
||||
if (page != 0) {
|
||||
currentScrollPosition = currentScrollPosition + SCROLL_OFFSET_STARTANALYSIS_CARDS;
|
||||
currentScrollPosition += SCROLL_OFFSET_STARTANALYSIS_CARDS;
|
||||
page--;
|
||||
startanalysis_card_container.getElement().getStyle().setLeft(currentScrollPosition, Unit.PCT);
|
||||
notifyStartAnalysisPageChangeListener(page);
|
||||
@@ -323,7 +345,7 @@ public class StartlineAnalysisComponent extends Composite implements HasWidgets
|
||||
}
|
||||
|
||||
private void addStartAnalysisCard(final StartAnalysisDTO startAnalysisDTO) {
|
||||
|
||||
logger.log(Level.INFO, "Adding Startanalysis Card");
|
||||
if (displaysCards == false) {
|
||||
displaysCards = true;
|
||||
header.getElement().setInnerHTML("Start " + startAnalysisDTO.raceName);
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
|
||||
/**
|
||||
* The purpose of the class is to display a live and an average value of a continuously updating data source.
|
||||
* {@link StartLineAdvantageComponent} extends from it and the class {@link WindBotComponent} uses it to display wind
|
||||
* {@link StartLineAdvantageByGeometryComponent} extends from it and the class {@link WindBotComponent} uses it to display wind
|
||||
* data.
|
||||
*
|
||||
* @author Alexander Ries (D062114)
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package com.sap.sailing.dashboards.gwt.client.startlineadvantage;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.google.gwt.i18n.client.NumberFormat;
|
||||
import com.sap.sailing.dashboards.gwt.client.dataretriever.RibDashboardDataRetriever;
|
||||
import com.sap.sailing.dashboards.gwt.client.dataretriever.RibDashboardDataRetrieverListener;
|
||||
import com.sap.sailing.dashboards.gwt.shared.dto.RibDashboardRaceInfoDTO;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
|
||||
/**
|
||||
* The purpose of the class is to display the live and average start line advantage either by wind or by geometry. There
|
||||
* is only one advantage display at once, so the user can switch between these following two
|
||||
* {@link StartLineAdvantageComponentState}s {@link StartLineAdvantageComponentStateShowsAdvantageByWind} and
|
||||
* {@link StartLineAdvantageComponentStateShowsAdvantageByGeometry} by tabing somewhere at the widget. The class extends
|
||||
* from {@link LiveAverageComponent} to get necessary Ui Elements but customizes these with own CSS.
|
||||
*
|
||||
* @author Alexander Ries (D062114)
|
||||
*
|
||||
*/
|
||||
public class StartLineAdvantageByGeometryComponent extends LiveAverageComponent implements RibDashboardDataRetrieverListener {
|
||||
|
||||
private static StringMessages stringConstants = StringMessages.INSTANCE;
|
||||
private static final Logger logger = Logger.getLogger(StartLineAdvantageByGeometryComponent.class.getName());
|
||||
|
||||
public StartLineAdvantageByGeometryComponent(RibDashboardDataRetriever ribDashboardDataRetriever) {
|
||||
super(stringConstants.dashboardStartlineAdvantageByGeometry(), "m");
|
||||
StartLineAdvantageComponentRessources.INSTANCE.css().ensureInjected();
|
||||
this.header.setInnerText(stringConstants.dashboardStartlineAdvantageByGeometry());
|
||||
this.header.addClassName(StartLineAdvantageComponentRessources.INSTANCE.css().startLineAdvantageComponent_header());
|
||||
liveAveragePanel.getElement().addClassName(StartLineAdvantageComponentRessources.INSTANCE.css().startLineAdvantageComponent_liveAveragePanel());
|
||||
livePanel.getElement().addClassName(StartLineAdvantageComponentRessources.INSTANCE.css().startLineAdvantageComponent_livePanel());
|
||||
middleLine.getElement().addClassName(StartLineAdvantageComponentRessources.INSTANCE.css().startLineAdvantageComponent_middleLine());
|
||||
averagePanel.getElement().addClassName(StartLineAdvantageComponentRessources.INSTANCE.css().startLineAdvantageComponent_averagePanel());
|
||||
this.liveLabel.setInnerHTML(stringConstants.dashboardLiveWind());
|
||||
this.averageLabel.setInnerHTML(stringConstants.dashboardAverageWind()+"<br>"+stringConstants.dashboardAverageWindMinutes(15));
|
||||
ribDashboardDataRetriever.addDataObserver(this);
|
||||
}
|
||||
|
||||
public void setStartLineAdvantageValues(RibDashboardRaceInfoDTO liveRaceInfoDTO) {
|
||||
if (liveRaceInfoDTO.startLineAdvantageDTO != null) {
|
||||
logger.log(Level.INFO, "Updating UI with RibDashboardRaceInfoDTO.startLineAdvantageDTO");
|
||||
setLiveValue(NumberFormat.getFormat("#0.0").format(liveRaceInfoDTO.startLineAdvantageDTO.startLineAdvantage));
|
||||
setAverageValue(NumberFormat.getFormat("#0.0").format(liveRaceInfoDTO.startLineAdvantageDTO.average));
|
||||
} else {
|
||||
logger.log(Level.INFO, "RibDashboardRaceInfoDTO.startLineAdvantageDTO is null");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUIWithNewLiveRaceInfo(RibDashboardRaceInfoDTO liveRaceInfoDTO) {
|
||||
setStartLineAdvantageValues(liveRaceInfoDTO);
|
||||
}
|
||||
}
|
||||
-160
@@ -1,160 +0,0 @@
|
||||
package com.sap.sailing.dashboards.gwt.client.startlineadvantage;
|
||||
|
||||
import com.google.gwt.i18n.client.NumberFormat;
|
||||
import com.sap.sailing.dashboards.gwt.client.dataretriever.RibDashboardDataRetriever;
|
||||
import com.sap.sailing.dashboards.gwt.client.dataretriever.RibDashboardDataRetrieverListener;
|
||||
import com.sap.sailing.dashboards.gwt.client.startanalysis.StartlineAdvantageType;
|
||||
import com.sap.sailing.dashboards.gwt.shared.dto.RibDashboardRaceInfoDTO;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
|
||||
/**
|
||||
* The purpose of the class is to display the live and average start line advantage either by wind or by geometry. There
|
||||
* is only one advantage display at once, so the user can switch between these following two
|
||||
* {@link StartLineAdvantageComponentState}s {@link StartLineAdvantageComponentStateShowsAdvantageByWind} and
|
||||
* {@link StartLineAdvantageComponentStateShowsAdvantageByGeometry} by tabing somewhere at the widget. The class extends
|
||||
* from {@link LiveAverageComponent} to get necessary Ui Elements but customizes these with own CSS.
|
||||
*
|
||||
* @author Alexander Ries (D062114)
|
||||
*
|
||||
*/
|
||||
public class StartLineAdvantageComponent extends LiveAverageComponent implements RibDashboardDataRetrieverListener {
|
||||
|
||||
private StartLineAdvantageComponentState startLineAdvantageComponentState;
|
||||
private StartLineAdvantageComponentStateShowsAdvantageByWind startLineAdvantageComponentStateShowsAdvantageByWind;
|
||||
private StartLineAdvantageComponentStateShowsAdvantageByGeometry startLineAdvantageComponentStateShowsAdvantageByGeometry;
|
||||
private static StringMessages stringConstants = StringMessages.INSTANCE;
|
||||
|
||||
public StartLineAdvantageComponent(RibDashboardDataRetriever ribDashboardDataRetriever) {
|
||||
super(stringConstants.dashboardStartlineAdvantageByGeometry(), "m");
|
||||
initAndSetStartLineAdvantageStates();
|
||||
StartLineAdvantageComponentRessources.INSTANCE.css().ensureInjected();
|
||||
this.header.setInnerText(stringConstants.dashboardStartlineAdvantageByGeometry());
|
||||
this.header.addClassName(StartLineAdvantageComponentRessources.INSTANCE.css().startLineAdvantageComponent_header());
|
||||
liveAveragePanel.getElement().addClassName(
|
||||
StartLineAdvantageComponentRessources.INSTANCE.css().startLineAdvantageComponent_liveAveragePanel());
|
||||
livePanel.getElement().addClassName(
|
||||
StartLineAdvantageComponentRessources.INSTANCE.css().startLineAdvantageComponent_livePanel());
|
||||
middleLine.getElement().addClassName(
|
||||
StartLineAdvantageComponentRessources.INSTANCE.css().startLineAdvantageComponent_middleLine());
|
||||
averagePanel.getElement().addClassName(
|
||||
StartLineAdvantageComponentRessources.INSTANCE.css().startLineAdvantageComponent_averagePanel());
|
||||
this.liveLabel.setInnerHTML(stringConstants.dashboardLiveWind());
|
||||
this.averageLabel.setInnerHTML(stringConstants.dashboardAverageWind()+"<br>"+stringConstants.dashboardAverageWindMinutes(15));
|
||||
ribDashboardDataRetriever.addDataObserver(this);
|
||||
}
|
||||
|
||||
private void initAndSetStartLineAdvantageStates() {
|
||||
startLineAdvantageComponentStateShowsAdvantageByWind = new StartLineAdvantageComponentStateShowsAdvantageByWind();
|
||||
startLineAdvantageComponentStateShowsAdvantageByGeometry = new StartLineAdvantageComponentStateShowsAdvantageByGeometry();
|
||||
startLineAdvantageComponentState = startLineAdvantageComponentStateShowsAdvantageByGeometry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUIWithNewLiveRaceInfo(RibDashboardRaceInfoDTO liveRaceInfoDTO) {
|
||||
if (liveRaceInfoDTO.startLineAdvantageDTO != null) {
|
||||
if(liveRaceInfoDTO.startLineAdvantageDTO.startLineAdvatageType != null){
|
||||
setState(liveRaceInfoDTO.startLineAdvantageDTO.startLineAdvatageType);
|
||||
}
|
||||
startLineAdvantageComponentState.setStartLineAdvantageValues(this, liveRaceInfoDTO);
|
||||
}
|
||||
}
|
||||
|
||||
public void setState(StartlineAdvantageType startlineAdvantageType){
|
||||
switch (startlineAdvantageType) {
|
||||
case WIND:
|
||||
startLineAdvantageComponentState = startLineAdvantageComponentStateShowsAdvantageByWind;
|
||||
break;
|
||||
case GEOMETRIC:
|
||||
startLineAdvantageComponentState = startLineAdvantageComponentStateShowsAdvantageByGeometry;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
abstract class StartLineAdvantageComponentState {
|
||||
|
||||
protected String lastLiveValue;
|
||||
protected String lastAverageValue;
|
||||
|
||||
abstract void setStartLineAdvantageValues(StartLineAdvantageComponent statAdvantageComponent,
|
||||
RibDashboardRaceInfoDTO liveRaceInfoDTO);
|
||||
|
||||
abstract void changeStartLineAdvatageComponentsStateToOtherState(
|
||||
StartLineAdvantageComponent startLineAdvantageComponent);
|
||||
|
||||
public String getLastLiveValue() {
|
||||
return lastLiveValue;
|
||||
}
|
||||
|
||||
public String getLastAverageValue() {
|
||||
return lastAverageValue;
|
||||
}
|
||||
}
|
||||
|
||||
class StartLineAdvantageComponentStateShowsAdvantageByWind extends StartLineAdvantageComponentState {
|
||||
|
||||
@Override
|
||||
public void setStartLineAdvantageValues(StartLineAdvantageComponent startLineAdvantageComponent,
|
||||
RibDashboardRaceInfoDTO liveRaceInfoDTO) {
|
||||
String liveValue = NumberFormat.getFormat("#0.0").format(
|
||||
liveRaceInfoDTO.startLineAdvantageDTO.startLineAdvantage);
|
||||
String averageValue = NumberFormat.getFormat("#0.0").format(
|
||||
liveRaceInfoDTO.startLineAdvantageDTO.average);
|
||||
startLineAdvantageComponent.liveNumber.setInnerText(liveValue);
|
||||
startLineAdvantageComponent.averageNumber.setInnerText(averageValue);
|
||||
lastLiveValue = liveValue;
|
||||
lastAverageValue = averageValue;
|
||||
setLiveValue(NumberFormat
|
||||
.getFormat("#0.0").format(liveRaceInfoDTO.startLineAdvantageDTO.startLineAdvantage));
|
||||
setAverageValue(NumberFormat
|
||||
.getFormat("#0.0").format(liveRaceInfoDTO.startLineAdvantageDTO.average));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeStartLineAdvatageComponentsStateToOtherState(
|
||||
StartLineAdvantageComponent startLineAdvantageComponent) {
|
||||
startLineAdvantageComponent.header.setInnerText(stringConstants.dashboardStartlineAdvantagesByWind());
|
||||
startLineAdvantageComponent.startLineAdvantageComponentState = startLineAdvantageComponent.startLineAdvantageComponentStateShowsAdvantageByGeometry;
|
||||
startLineAdvantageComponent.liveNumber
|
||||
.setInnerText(startLineAdvantageComponent.startLineAdvantageComponentStateShowsAdvantageByGeometry
|
||||
.getLastLiveValue());
|
||||
startLineAdvantageComponent.averageNumber
|
||||
.setInnerText(startLineAdvantageComponent.startLineAdvantageComponentStateShowsAdvantageByGeometry
|
||||
.getLastAverageValue());
|
||||
}
|
||||
}
|
||||
|
||||
class StartLineAdvantageComponentStateShowsAdvantageByGeometry extends StartLineAdvantageComponentState {
|
||||
|
||||
@Override
|
||||
public void setStartLineAdvantageValues(StartLineAdvantageComponent startLineAdvantageComponent,
|
||||
RibDashboardRaceInfoDTO liveRaceInfoDTO) {
|
||||
String liveValue = NumberFormat.getFormat("#0.0").format(
|
||||
liveRaceInfoDTO.startLineAdvantageDTO.startLineAdvantage);
|
||||
String averageValue = NumberFormat.getFormat("#0.0").format(
|
||||
liveRaceInfoDTO.startLineAdvantageDTO.average);
|
||||
startLineAdvantageComponent.liveNumber.setInnerText(liveValue);
|
||||
startLineAdvantageComponent.averageNumber.setInnerText(averageValue);
|
||||
lastLiveValue = liveValue;
|
||||
lastAverageValue = averageValue;
|
||||
setLiveValue(NumberFormat
|
||||
.getFormat("#0.0").format(liveRaceInfoDTO.startLineAdvantageDTO.startLineAdvantage));
|
||||
setAverageValue(NumberFormat
|
||||
.getFormat("#0.0").format(liveRaceInfoDTO.startLineAdvantageDTO.average));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeStartLineAdvatageComponentsStateToOtherState(
|
||||
StartLineAdvantageComponent startLineAdvantageComponent) {
|
||||
startLineAdvantageComponent.header.setInnerText(stringConstants.dashboardStartlineAdvantageByGeometry());
|
||||
startLineAdvantageComponent.startLineAdvantageComponentState = startLineAdvantageComponent.startLineAdvantageComponentStateShowsAdvantageByWind;
|
||||
startLineAdvantageComponent.liveNumber
|
||||
.setInnerText(startLineAdvantageComponent.startLineAdvantageComponentStateShowsAdvantageByWind
|
||||
.getLastLiveValue());
|
||||
startLineAdvantageComponent.averageNumber
|
||||
.setInnerText(startLineAdvantageComponent.startLineAdvantageComponentStateShowsAdvantageByWind
|
||||
.getLastAverageValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
+26
-14
@@ -2,6 +2,8 @@ package com.sap.sailing.dashboards.gwt.client.startlineadvantage;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
@@ -14,6 +16,7 @@ import com.google.gwt.user.client.ui.HasWidgets;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.dashboards.gwt.client.RibDashboardServiceAsync;
|
||||
import com.sap.sailing.dashboards.gwt.client.actions.GetStartlineAdvantagesAction;
|
||||
import com.sap.sailing.dashboards.gwt.client.dataretriever.WindBotDataRetriever;
|
||||
import com.sap.sailing.dashboards.gwt.shared.dto.StartlineAdvantagesWithMaxAndAverageDTO;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sse.gwt.client.async.AsyncActionsExecutor;
|
||||
@@ -48,6 +51,7 @@ public class StartlineAdvantagesByWindComponent extends Composite implements Has
|
||||
|
||||
private RibDashboardServiceAsync ribDashboardService;
|
||||
private AsyncActionsExecutor asyncActionsExecutor;
|
||||
private static final Logger logger = Logger.getLogger(WindBotDataRetriever.class.getName());
|
||||
|
||||
public StartlineAdvantagesByWindComponent(RibDashboardServiceAsync ribDashboardService) {
|
||||
startlineAdvantagesOnLineChart = new StartlineAdvantagesOnLineChart();
|
||||
@@ -62,22 +66,30 @@ public class StartlineAdvantagesByWindComponent extends Composite implements Has
|
||||
}
|
||||
|
||||
private void loadData() {
|
||||
GetStartlineAdvantagesAction getRibDashboardRaceInfoAction = new GetStartlineAdvantagesAction(
|
||||
ribDashboardService, "");
|
||||
asyncActionsExecutor.execute(getRibDashboardRaceInfoAction, new AsyncCallback<StartlineAdvantagesWithMaxAndAverageDTO>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
}
|
||||
GetStartlineAdvantagesAction getRibDashboardRaceInfoAction = new GetStartlineAdvantagesAction(ribDashboardService, "");
|
||||
logger.log(Level.INFO, "Executing GetStartlineAdvantagesAction");
|
||||
asyncActionsExecutor.execute(getRibDashboardRaceInfoAction,
|
||||
new AsyncCallback<StartlineAdvantagesWithMaxAndAverageDTO>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(StartlineAdvantagesWithMaxAndAverageDTO result) {
|
||||
startlineAdvantagesOnLineChart.setStartlineAdvantages(result.advantages);
|
||||
advantageMaximumLiveAverage.setLiveValue(""+result.maximum);
|
||||
advantageMaximumLiveAverage.setAverageValue(""+result.average);
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(StartlineAdvantagesWithMaxAndAverageDTO result) {
|
||||
logger.log(Level.INFO, "Received StartlineAdvantagesWithMaxAndAverageDTO");
|
||||
if (result != null) {
|
||||
logger.log(Level.INFO, "Updating UI with StartlineAdvantagesWithMaxAndAverageDTO");
|
||||
startlineAdvantagesOnLineChart.setStartlineAdvantages(result.advantages);
|
||||
advantageMaximumLiveAverage.setLiveValue("" + result.maximum);
|
||||
advantageMaximumLiveAverage.setAverageValue("" + result.average);
|
||||
} else {
|
||||
logger.log(Level.INFO, "StartlineAdvantagesWithMaxAndAverageDTO is null");
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
logger.log(Level.INFO, "Failed to received StartlineAdvantagesWithMaxAndAverageDTO");
|
||||
logger.log(Level.INFO, caught.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initSampleTimer(){
|
||||
|
||||
+9
-28
@@ -2,8 +2,6 @@ package com.sap.sailing.dashboards.gwt.client.startlineadvantage;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.moxieapps.gwt.highcharts.client.Animation;
|
||||
import org.moxieapps.gwt.highcharts.client.Animation.Easing;
|
||||
@@ -67,7 +65,6 @@ public class StartlineAdvantagesOnLineChart extends Composite implements HasWidg
|
||||
private Series series;
|
||||
|
||||
private static final int POINT_ADDING_ANIMATION_DURATION_IN_MILLIS = 2000;
|
||||
private static final Logger logger = Logger.getLogger(StartlineAdvantagesOnLineChart.class.getName());
|
||||
|
||||
public StartlineAdvantagesOnLineChart() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
@@ -200,32 +197,20 @@ public class StartlineAdvantagesOnLineChart extends Composite implements HasWidg
|
||||
}
|
||||
|
||||
public void setStartlineAdvantages(List<StartLineAdvantageDTO> startlineAdvantages) {
|
||||
for(StartLineAdvantageDTO startLineAdvantageDTO : startlineAdvantages) {
|
||||
logger.log(Level.INFO, startLineAdvantageDTO.distanceToRCBoatInMeters +" "+startLineAdvantageDTO.startLineAdvantage);
|
||||
}
|
||||
if (series.getPoints() != null && series.getPoints().length > 0) {
|
||||
updateStartlineAdvantages(startlineAdvantages, series);
|
||||
} else {
|
||||
addStartlineAdvantages(startlineAdvantages, series);
|
||||
chart.addSeries(series , true, new Animation().setDuration(POINT_ADDING_ANIMATION_DURATION_IN_MILLIS).setEasing(Easing.SWING));
|
||||
if (startlineAdvantages != null) {
|
||||
if (series.getPoints() != null && series.getPoints().length > 0) {
|
||||
updateStartlineAdvantages(startlineAdvantages, series);
|
||||
} else {
|
||||
addStartlineAdvantages(startlineAdvantages, series);
|
||||
chart.addSeries(series, true, new Animation().setDuration(POINT_ADDING_ANIMATION_DURATION_IN_MILLIS).setEasing(Easing.SWING));
|
||||
}
|
||||
}
|
||||
chart.setSizeToMatchContainer();
|
||||
}
|
||||
|
||||
private void updateStartlineAdvantages(List<StartLineAdvantageDTO> startlineAdvantages, Series series) {
|
||||
// Series newSeries = createSeries(chart);
|
||||
// addStartlineAdvantages(startlineAdvantages, newSeries);
|
||||
removeAllSeriesPoints(chart.getSeries()[0]);
|
||||
logger.log(Level.INFO, "SERIES: " + chart.getSeries().length);
|
||||
addStartlineAdvantages(startlineAdvantages, series);
|
||||
// int counter = 0;
|
||||
// for (Point point : series.getPoints()) {
|
||||
// if(startlineAdvantages.size() -1 > counter){
|
||||
// StartLineAdvantageDTO currentNewStartlineAdvantage = startlineAdvantages.get(counter);
|
||||
// series.addPoint(currentNewStartlineAdvantage.distanceToRCBoatInMeters, currentNewStartlineAdvantage.startLineAdvantage);
|
||||
// counter++;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
private void removeAllSeriesPoints(Series series) {
|
||||
@@ -235,11 +220,10 @@ public class StartlineAdvantagesOnLineChart extends Composite implements HasWidg
|
||||
}
|
||||
|
||||
private void addStartlineAdvantages(List<StartLineAdvantageDTO> startlineAdvantages, Series series){
|
||||
//TODO Build this with forEach Consumer as soon as the bundle uses GWT 2.8 with Java 8 Support.
|
||||
//TODO Build this with forEach consumer as soon as the bundle uses GWT 2.8 with Java 8 Support.
|
||||
for (StartLineAdvantageDTO startlineAdvantage : startlineAdvantages) {
|
||||
Point point = new Point(startlineAdvantage.distanceToRCBoatInMeters, startlineAdvantage.startLineAdvantage);
|
||||
series.addPoint(point, false, false, false);
|
||||
//new Animation().setDuration(POINT_ADDING_ANIMATION_DURATION_IN_MILLIS)
|
||||
}
|
||||
setConfidenceGradientColorToSeries(series, startlineAdvantages);
|
||||
chart.redraw();
|
||||
@@ -287,10 +271,7 @@ public class StartlineAdvantagesOnLineChart extends Composite implements HasWidg
|
||||
lastConfidence = startlineAdvantageDTO.confidence;
|
||||
double gradientPosition = getGradientStopPositionFromStartlineLenghtAndDistanceToRCBoat(lineLenght,
|
||||
startlineAdvantageDTO.distanceToRCBoatInMeters);
|
||||
logger.log(Level.INFO, "Confidence " + startlineAdvantageDTO.confidence + "gradientPosition"
|
||||
+ gradientPosition);
|
||||
color.addColorStop(gradientPosition,
|
||||
getColorAsHexStringFromConfidence(startlineAdvantageDTO.confidence));
|
||||
color.addColorStop(gradientPosition, getColorAsHexStringFromConfidence(startlineAdvantageDTO.confidence));
|
||||
}
|
||||
}
|
||||
return color;
|
||||
|
||||
+6
@@ -3,6 +3,8 @@ package com.sap.sailing.dashboards.gwt.client.windchart;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.moxieapps.gwt.highcharts.client.Axis.Type;
|
||||
import org.moxieapps.gwt.highcharts.client.Chart;
|
||||
@@ -71,6 +73,8 @@ public class VerticalWindChart extends Composite implements HasWidgets {
|
||||
private static final int MAX_SERIES_POINTS = 100000000;
|
||||
|
||||
private static VerticalWindChartUiBinder uiBinder = GWT.create(VerticalWindChartUiBinder.class);
|
||||
|
||||
private static final Logger logger = Logger.getLogger(VerticalWindChart.class.getName());
|
||||
|
||||
interface VerticalWindChartUiBinder extends UiBinder<Widget, VerticalWindChart> {
|
||||
}
|
||||
@@ -194,9 +198,11 @@ public class VerticalWindChart extends Composite implements HasWidgets {
|
||||
if (verticalWindChartSeries == null) {
|
||||
initVerticalWindChartSeries();
|
||||
verticalWindChartSeries.setPoints(points, true);
|
||||
logger.log(Level.INFO, "Set Points");
|
||||
} else {
|
||||
for (Point point : points) {
|
||||
verticalWindChartSeries.addPoint(point, true, false, false);
|
||||
logger.log(Level.INFO, "Add Point");
|
||||
}
|
||||
}
|
||||
verticalWindChartSeries.updateThreshold("" + average);
|
||||
|
||||
+10
@@ -2,6 +2,8 @@ package com.sap.sailing.dashboards.gwt.client.windchart;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.moxieapps.gwt.highcharts.client.Point;
|
||||
|
||||
@@ -51,6 +53,7 @@ public class WindBotComponent extends Composite implements HasWidgets, WindBotDa
|
||||
|
||||
private static WindBotComponentUiBinder uiBinder = GWT.create(WindBotComponentUiBinder.class);
|
||||
private static final String IN_SIMULATION_MODE = "simulation";
|
||||
private static final Logger logger = Logger.getLogger(WindBotComponent.class.getName());
|
||||
|
||||
interface WindBotComponentUiBinder extends UiBinder<Widget, WindBotComponent> {
|
||||
}
|
||||
@@ -166,10 +169,13 @@ public class WindBotComponent extends Composite implements HasWidgets, WindBotDa
|
||||
* */
|
||||
@Override
|
||||
public void updateWindBotUI(WindInfoForRaceDTO windInfoForRaceDTO) {
|
||||
|
||||
if (windInfoForRaceDTO != null) {
|
||||
WindTrackInfoDTO windTrackInfoDTO = getWindTrackInfoDTOFromAndWindBotID(windInfoForRaceDTO, windBotId);
|
||||
if (windTrackInfoDTO != null) {
|
||||
logger.log(Level.INFO, "WindInfoForRaceDTO contains WindTrackInfoDTO for Windbot id "+ windBotId);
|
||||
if (windTrackInfoDTO.windFixes != null && windTrackInfoDTO.windFixes.size() > 0) {
|
||||
logger.log(Level.INFO, "Upating UI with Wind Fixes for WindBot id "+ windBotId);
|
||||
Point[] speedPoints = convertWindFixListIntoPointsArray(windTrackInfoDTO.windFixes, WindType.SPEED);
|
||||
Point[] directionPoints = convertWindFixListIntoPointsArray(windTrackInfoDTO.windFixes,
|
||||
WindType.DIRECTION);
|
||||
@@ -186,7 +192,11 @@ public class WindBotComponent extends Composite implements HasWidgets, WindBotDa
|
||||
movingAverageDirection.getAverage());
|
||||
locationPointerCompass.windBotPositionChanged(windTrackInfoDTO.windFixes
|
||||
.get(windTrackInfoDTO.windFixes.size() - 1).position);
|
||||
} else {
|
||||
logger.log(Level.INFO, "WindTrackInfoDTO.windFixes is null or empty");
|
||||
}
|
||||
} else {
|
||||
logger.log(Level.INFO, "WindInfoForRaceDTO does not contains WindTrackInfoDTO for Windbot id "+ windBotId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+35
-21
@@ -6,6 +6,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
@@ -31,6 +32,7 @@ import com.sap.sailing.domain.base.Waypoint;
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sailing.domain.common.NoWindException;
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.tracking.GPSFix;
|
||||
import com.sap.sailing.domain.leaderboard.Leaderboard;
|
||||
@@ -38,7 +40,6 @@ import com.sap.sailing.domain.polars.PolarDataService;
|
||||
import com.sap.sailing.domain.tracking.GPSFixTrack;
|
||||
import com.sap.sailing.domain.tracking.TrackedRace;
|
||||
import com.sap.sailing.server.RacingEventService;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.Util.Pair;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
@@ -89,7 +90,7 @@ public class RibDashboardServiceImpl extends RemoteServiceServlet implements Rib
|
||||
}
|
||||
|
||||
protected RacingEventService getRacingEventService() {
|
||||
return racingEventServiceTracker.getService(); // grab the service
|
||||
return racingEventServiceTracker.getService();
|
||||
}
|
||||
|
||||
private PolarDataService getPolarService() {
|
||||
@@ -129,6 +130,22 @@ public class RibDashboardServiceImpl extends RemoteServiceServlet implements Rib
|
||||
}
|
||||
return lRInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegattaAndRaceIdentifier getIDFromRaceThatTakesWindFixesNow(String leaderboardName) {
|
||||
RegattaAndRaceIdentifier result = null;
|
||||
if(leaderboardName != null) {
|
||||
List<TrackedRace> trackedRaces = getTrackedRacesFromLeaderboard(leaderboardName);
|
||||
List<TrackedRace> filteredTrackedRaces = trackedRaces.stream().filter(trackedRace -> trackedRace.takesWindFixWithTimePoint(MillisecondsTimePoint.now())).collect(Collectors.toList());
|
||||
if(filteredTrackedRaces != null && filteredTrackedRaces.size() > 0) {
|
||||
TrackedRace raceThatTakesWindNow = filteredTrackedRaces.get(0);
|
||||
if(raceThatTakesWindNow != null) {
|
||||
result = raceThatTakesWindNow.getRaceIdentifier();
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void fillLiveRaceInfoDTOWithRaceData(RibDashboardRaceInfoDTO lRInfo, TimePoint now) {
|
||||
if (runningRace != null) {
|
||||
@@ -164,16 +181,9 @@ public class RibDashboardServiceImpl extends RemoteServiceServlet implements Rib
|
||||
for (RaceColumn column : lb.getRaceColumns()) {
|
||||
for (Fleet fleet : column.getFleets()) {
|
||||
TrackedRace race = column.getTrackedRace(fleet);
|
||||
if (race != null) {
|
||||
if (race != null && race.isLive(MillisecondsTimePoint.now())) {
|
||||
result = race;
|
||||
notifyLiveTrackedRaceListenerAboutLiveTrackedRaceChange(race);
|
||||
TimePoint startOfRace = race.getStartOfRace();
|
||||
// not relying on isLive() because the time window is too short
|
||||
// to retrieve wind information we need to extend the time window
|
||||
if (startOfRace != null && race.getEndOfRace() == null &&
|
||||
MillisecondsTimePoint.now().after(startOfRace.minus(Duration.ONE_MINUTE.times(20)))) {
|
||||
result = race;
|
||||
// no break here as we want to have the last race that is deemed to be live
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -268,19 +278,23 @@ public class RibDashboardServiceImpl extends RemoteServiceServlet implements Rib
|
||||
@Override
|
||||
public List<StartAnalysisDTO> getStartAnalysisListForCompetitorIDAndLeaderboardName(String competitorIdAsString,
|
||||
String leaderboardName) {
|
||||
List<StartAnalysisDTO> startAnalysisDTOs = new ArrayList<StartAnalysisDTO>();
|
||||
if (leaderboardName != null) {
|
||||
Competitor competitor = baseDomainFactory.getCompetitorStore().getExistingCompetitorByIdAsString(competitorIdAsString);
|
||||
List<TrackedRace> trackedRacesForLeaderBoardName = getTrackedRacesFromLeaderboard(leaderboardName);
|
||||
for (TrackedRace trackedRace : trackedRacesForLeaderBoardName) {
|
||||
StartAnalysisDTO startAnalysisDTO = startAnalysisCreationController
|
||||
.checkStartAnalysisForCompetitorInTrackedRace(competitor, trackedRace);
|
||||
if (startAnalysisDTO != null) {
|
||||
startAnalysisDTOs.add(startAnalysisDTO);
|
||||
List<StartAnalysisDTO> result = null;
|
||||
if (competitorIdAsString != null && leaderboardName != null) {
|
||||
result = new ArrayList<StartAnalysisDTO>();
|
||||
try {
|
||||
Competitor competitor = baseDomainFactory.getCompetitorStore().getExistingCompetitorByIdAsString(competitorIdAsString);
|
||||
List<TrackedRace> trackedRacesForLeaderBoardName = getTrackedRacesFromLeaderboard(leaderboardName);
|
||||
for (TrackedRace trackedRace : trackedRacesForLeaderBoardName) {
|
||||
StartAnalysisDTO startAnalysisDTO = startAnalysisCreationController.checkStartAnalysisForCompetitorInTrackedRace(competitor, trackedRace);
|
||||
if (startAnalysisDTO != null) {
|
||||
result.add(startAnalysisDTO);
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
logger.log(Level.INFO, "", e);
|
||||
}
|
||||
}
|
||||
return startAnalysisDTOs;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+4
-3
@@ -10,8 +10,8 @@ import com.sap.sse.common.TimePoint;
|
||||
|
||||
public abstract class AbstractStartAnalysisCreationValidator {
|
||||
|
||||
private static int MINIMUM_MARKPASSIINGS_AT_FIRST_MARK = 3;
|
||||
private static long MINIMUM_RACE_PROGRESSION_IN_MILLISECONDS = 6*60*1000;
|
||||
protected static int MINIMUM_MARKPASSIINGS_AT_FIRST_MARK = 3;
|
||||
protected static long MINIMUM_RACE_PROGRESSION_IN_MILLISECONDS = 6*60*1000;
|
||||
|
||||
protected boolean threeCompetitorsPassedSecondWayPoint(TrackedRace trackedRace){
|
||||
Waypoint secondWaypoint = trackedRace.getRace().getCourse().getFirstLeg().getTo();
|
||||
@@ -45,7 +45,8 @@ public abstract class AbstractStartAnalysisCreationValidator {
|
||||
}
|
||||
|
||||
protected boolean raceProgressedFarEnough(Competitor competitor, TrackedRace trackedRace){
|
||||
if(trackedRace.isGateStart()){
|
||||
final Boolean isGateStart = trackedRace.isGateStart();
|
||||
if(isGateStart == Boolean.TRUE){
|
||||
return gateStartGolfFlagIsDown(trackedRace);
|
||||
}else{
|
||||
return competitorPassedSecondWayPoint(competitor, trackedRace);
|
||||
|
||||
+10
-9
@@ -19,15 +19,16 @@ public class StartAnalysisCreationController extends AbstractStartAnalysisCreati
|
||||
}
|
||||
|
||||
public StartAnalysisDTO checkStartAnalysisForCompetitorInTrackedRace(Competitor competitor, TrackedRace trackedRace) {
|
||||
StartAnalysisDTO startAnalysisDTO;
|
||||
if (threeCompetitorsPassedSecondWayPoint(trackedRace) &&
|
||||
raceProgressedFarEnough(competitor, trackedRace))
|
||||
{
|
||||
logger.log(Level.INFO, "Trigger StartAnalysisDTO creation");
|
||||
startAnalysisDTO = startAnalysisDTOFactory.createStartAnalysisForCompetitorAndTrackedRace(competitor, trackedRace);
|
||||
return startAnalysisDTO;
|
||||
}else{
|
||||
return null;
|
||||
StartAnalysisDTO result = null;
|
||||
if (competitor != null && trackedRace != null) {
|
||||
if (threeCompetitorsPassedSecondWayPoint(trackedRace) && raceProgressedFarEnough(competitor, trackedRace)) {
|
||||
logger.log(Level.INFO, "Creating startanalysis for race " + trackedRace.getRace().getName() + " and competitor: " + competitor.getName());
|
||||
result = startAnalysisDTOFactory.createStartAnalysisForCompetitorAndTrackedRace(competitor, trackedRace);
|
||||
|
||||
} else {
|
||||
logger.log(Level.INFO, "Waiting to create startanalysis for race " + trackedRace.getRace().getName() + " and competitor: " + competitor.getName());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+14
-20
@@ -32,7 +32,6 @@ public class StartAnalysisDTOFactory extends AbstractStartAnalysisCreationValida
|
||||
|
||||
private final com.sap.sailing.domain.base.DomainFactory baseDomainFactory;
|
||||
|
||||
private static int MINIMUM_NUMBER_COMPETITORS_FOR_STARTANALYSIS = 3;
|
||||
private static int DEFAULT_GATE_START_INTERVALL_IN_MILLISECONDS = 5*60*1000;
|
||||
private static int ONE_MINUTE_INTERVALL_IN_MILLISECONDS = 60*1000;
|
||||
|
||||
@@ -42,17 +41,14 @@ public class StartAnalysisDTOFactory extends AbstractStartAnalysisCreationValida
|
||||
baseDomainFactory = racingEventService.getBaseDomainFactory();
|
||||
}
|
||||
|
||||
public StartAnalysisDTO createStartAnalysisForCompetitorAndTrackedRace(Competitor competitor,
|
||||
TrackedRace trackedRace) {
|
||||
public StartAnalysisDTO createStartAnalysisForCompetitorAndTrackedRace(Competitor competitor, TrackedRace trackedRace) {
|
||||
StartAnalysisDTO startAnalysisDTO = new StartAnalysisDTO();
|
||||
addStaticDataToStartAnalysisDTOFrom(startAnalysisDTO, trackedRace);
|
||||
List<StartAnalysisCompetitorDTO> competitors = new ArrayList<StartAnalysisCompetitorDTO>();
|
||||
Waypoint secondWaypoint = trackedRace.getRace().getCourse().getFirstLeg().getTo();
|
||||
List<MarkPassing> markPassingsInOrder = convertMarkpPassingsIteratorToList(trackedRace.getMarkPassingsInOrder(
|
||||
secondWaypoint).iterator());
|
||||
|
||||
List<MarkPassing> markPassingsInOrder = convertMarkpPassingsIteratorToList(trackedRace.getMarkPassingsInOrder(secondWaypoint).iterator());
|
||||
boolean isCompetitorOneOfFirstThree = false;
|
||||
for (int i = 0; i < MINIMUM_NUMBER_COMPETITORS_FOR_STARTANALYSIS; i++) {
|
||||
for (int i = 0; i < MINIMUM_MARKPASSIINGS_AT_FIRST_MARK; i++) {
|
||||
competitors.add(createStartAnalysisCompetitorDTO(trackedRace, i + 1, markPassingsInOrder.get(i).getCompetitor()));
|
||||
if (markPassingsInOrder.get(i).getCompetitor().equals(competitor)) {
|
||||
isCompetitorOneOfFirstThree = true;
|
||||
@@ -60,17 +56,14 @@ public class StartAnalysisDTOFactory extends AbstractStartAnalysisCreationValida
|
||||
}
|
||||
|
||||
if (!isCompetitorOneOfFirstThree) {
|
||||
int rankOfCompetitorWhilePassingSecondWaypoint = getRankOfCompetitorWhilePassingSecondWaypoint(competitor,
|
||||
trackedRace);
|
||||
competitors.add(createStartAnalysisCompetitorDTO(trackedRace, rankOfCompetitorWhilePassingSecondWaypoint,
|
||||
competitor));
|
||||
int rankOfCompetitorWhilePassingSecondWaypoint = getRankOfCompetitorWhilePassingSecondWaypoint(competitor, trackedRace);
|
||||
competitors.add(createStartAnalysisCompetitorDTO(trackedRace, rankOfCompetitorWhilePassingSecondWaypoint, competitor));
|
||||
}
|
||||
|
||||
startAnalysisDTO.competitor = baseDomainFactory.getCompetitorStore().convertToCompetitorDTO(competitor);
|
||||
startAnalysisDTO.startAnalysisCompetitorDTOs = competitors;
|
||||
|
||||
if (trackedRace.isGateStart()) {
|
||||
logger.log(Level.INFO, "IS GATESTART");
|
||||
final Boolean isGateStart = trackedRace.isGateStart();
|
||||
if(isGateStart == Boolean.TRUE){
|
||||
logger.log(Level.INFO, "Creating startanalysis for gate start");
|
||||
startAnalysisDTO.racingProcedureType = RacingProcedureType.GateStart;
|
||||
long timePointOfGolfDownTime = trackedRace.getGateStartGolfDownTime();
|
||||
startAnalysisDTO.timeOfStartInMilliSeconds = trackedRace.getStartOfRace().asMillis();
|
||||
@@ -80,12 +73,13 @@ public class StartAnalysisDTOFactory extends AbstractStartAnalysisCreationValida
|
||||
startAnalysisDTO.tailLenghtInMilliseconds = timePointOfGolfDownTime-trackedRace.getStartOfRace().asMillis();
|
||||
}
|
||||
} else {
|
||||
logger.log(Level.INFO, "Creating startanalysis for ess start");
|
||||
startAnalysisDTO.racingProcedureType = RacingProcedureType.ESS;
|
||||
startAnalysisDTO.timeOfStartInMilliSeconds = trackedRace.getStartOfRace().asMillis();
|
||||
startAnalysisDTO.tailLenghtInMilliseconds = ONE_MINUTE_INTERVALL_IN_MILLISECONDS;
|
||||
}
|
||||
startAnalysisDTO.regattaAndRaceIdentifier = trackedRace.getRaceIdentifier();
|
||||
logger.log(Level.INFO, "Created StartAnalysis For Competitor " + competitor.getName() + " and "+ trackedRace.getRace().getName());
|
||||
logger.log(Level.INFO, "Created startanalysis for competitor " + competitor.getName() + " and "+ trackedRace.getRace().getName());
|
||||
return startAnalysisDTO;
|
||||
}
|
||||
|
||||
@@ -109,8 +103,7 @@ public class StartAnalysisDTOFactory extends AbstractStartAnalysisCreationValida
|
||||
return 0;
|
||||
}
|
||||
|
||||
private StartAnalysisDTO addStaticDataToStartAnalysisDTOFrom(StartAnalysisDTO startAnalysisDTO,
|
||||
TrackedRace trackedRace) {
|
||||
private StartAnalysisDTO addStaticDataToStartAnalysisDTOFrom(StartAnalysisDTO startAnalysisDTO, TrackedRace trackedRace) {
|
||||
startAnalysisDTO.raceName = trackedRace.getRace().getName();
|
||||
startAnalysisDTO.startAnalysisWindLineInfoDTO = createStartAnalysisWindAndLineData(trackedRace);
|
||||
return startAnalysisDTO;
|
||||
@@ -129,7 +122,8 @@ public class StartAnalysisDTOFactory extends AbstractStartAnalysisCreationValida
|
||||
tableentry.rankAtFirstMark = rank;
|
||||
tableentry.teamName = competitor.getName();
|
||||
tableentry.speedAtStartTime = trackedRace.getSpeed(competitor, 1).getKnots();
|
||||
if (trackedRace.isGateStart()) {
|
||||
final Boolean isGateStart = trackedRace.isGateStart();
|
||||
if(isGateStart == Boolean.TRUE){
|
||||
tableentry.distanceToLineAtStartTime = trackedRace.getDistanceFromStarboardSideOfStartLineWhenPassingStart(
|
||||
competitor).getMeters();
|
||||
} else {
|
||||
@@ -177,7 +171,7 @@ public class StartAnalysisDTOFactory extends AbstractStartAnalysisCreationValida
|
||||
return StartlineAdvantageType.WIND;
|
||||
}
|
||||
} catch (NoWindException e) {
|
||||
e.printStackTrace();
|
||||
logger.log(Level.INFO, "", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
+36
-33
@@ -51,42 +51,45 @@ public class StartlineAdvantagesCalculator extends AbstracPreCalculationDataRet
|
||||
// Calculate duration from two new distances for normal upwind starts
|
||||
// Put all durations in one set
|
||||
// Get the smallest of the durations and subtract number from every other number
|
||||
public StartlineAdvantagesWithMaxAndAverageDTO getStartLineAdvantagesAccrossLineAtTimePoint(TimePoint timepoint){
|
||||
public StartlineAdvantagesWithMaxAndAverageDTO getStartLineAdvantagesAccrossLineAtTimePoint(TimePoint timepoint) {
|
||||
StartlineAdvantagesWithMaxAndAverageDTO result = new StartlineAdvantagesWithMaxAndAverageDTO();
|
||||
if (currentLiveTrackedRace != null) {
|
||||
retrieveDataForCalculation(currentLiveTrackedRace);
|
||||
if(isStartlineCompletelyUnderneathLaylines()) {
|
||||
logger.log(Level.INFO, "Startline is completely underneath laylines");
|
||||
Pair<Double, Double> advantagesRange = new Pair<Double, Double>(0.0, startlineLenghtInMeters);
|
||||
result.advantages = calculateStartlineAdvantagesUnderneathLaylinesInRange(advantagesRange);
|
||||
double maximum = getMaximumAdvantageOfStartlineAdvantageDTOs(result.advantages);
|
||||
result.maximum = maximum;
|
||||
advantageMaximumAverage.add(maximum);
|
||||
result.average = advantageMaximumAverage.getAverage();
|
||||
} else if (isStartlineCompletelyAboveLaylines()) {
|
||||
logger.log(Level.INFO, "Startline is completely above laylines");
|
||||
Pair<Double, Double> advantagesRange = new Pair<Double, Double>(0.0, startlineLenghtInMeters);
|
||||
result.advantages = calculatePolarBasedStartlineAdvantagesInRange(advantagesRange);
|
||||
subtractMinimumOfAllStartlineAdvantages(result.advantages);
|
||||
double maximum = getMaximumAdvantageOfStartlineAdvantageDTOs(result.advantages);
|
||||
result.maximum = maximum;
|
||||
advantageMaximumAverage.add(maximum);
|
||||
result.average = advantageMaximumAverage.getAverage();
|
||||
subtractAgainstMaximumOfAllStartlineAdvantages(result.advantages, maximum);
|
||||
} else {
|
||||
logger.log(Level.INFO, "Layline(s) cross startline");
|
||||
Position intersectionOfRightLaylineAndStartline = getIntersectionOfRightLaylineAndStartline();
|
||||
Position intersectionOfleftLaylineAndStartline = getIntersectionOfLeftLaylineAndStartline();
|
||||
Pair<Double, Double> polarBasedStartlineAdvatagesRange = getStartAndEndPointOfPolarBasedStartlineAdvatagesInDistancesToRCBoat(intersectionOfRightLaylineAndStartline, intersectionOfleftLaylineAndStartline);
|
||||
Pair<Double, Double> pinEndStartlineAdvatagesRange = getPinEndStartlineAdvantagesRangeFromPolarAdvantagesRange(polarBasedStartlineAdvatagesRange);
|
||||
result.advantages = calculatePolarBasedStartlineAdvantagesInRange(polarBasedStartlineAdvatagesRange);
|
||||
subtractMinimumOfAllStartlineAdvantages(result.advantages);
|
||||
double maximum = getMaximumAdvantageOfStartlineAdvantageDTOs(result.advantages);
|
||||
result.maximum = maximum;
|
||||
advantageMaximumAverage.add(maximum);
|
||||
result.average = advantageMaximumAverage.getAverage();
|
||||
subtractAgainstMaximumOfAllStartlineAdvantages(result.advantages, maximum);
|
||||
addClosingZeroPointToMixedAdvantages(result.advantages, pinEndStartlineAdvatagesRange);
|
||||
if (wind != null) {
|
||||
if (isStartlineCompletelyUnderneathLaylines()) {
|
||||
logger.log(Level.INFO, "Startline is completely underneath laylines");
|
||||
Pair<Double, Double> advantagesRange = new Pair<Double, Double>(0.0, startlineLenghtInMeters);
|
||||
result.advantages = calculateStartlineAdvantagesUnderneathLaylinesInRange(advantagesRange);
|
||||
double maximum = getMaximumAdvantageOfStartlineAdvantageDTOs(result.advantages);
|
||||
result.maximum = maximum;
|
||||
advantageMaximumAverage.add(maximum);
|
||||
result.average = advantageMaximumAverage.getAverage();
|
||||
} else if (isStartlineCompletelyAboveLaylines()) {
|
||||
logger.log(Level.INFO, "Startline is completely above laylines");
|
||||
Pair<Double, Double> advantagesRange = new Pair<Double, Double>(0.0, startlineLenghtInMeters);
|
||||
result.advantages = calculatePolarBasedStartlineAdvantagesInRange(advantagesRange);
|
||||
subtractMinimumOfAllStartlineAdvantages(result.advantages);
|
||||
double maximum = getMaximumAdvantageOfStartlineAdvantageDTOs(result.advantages);
|
||||
result.maximum = maximum;
|
||||
advantageMaximumAverage.add(maximum);
|
||||
result.average = advantageMaximumAverage.getAverage();
|
||||
subtractAgainstMaximumOfAllStartlineAdvantages(result.advantages, maximum);
|
||||
} else {
|
||||
logger.log(Level.INFO, "Layline(s) cross startline");
|
||||
Position intersectionOfRightLaylineAndStartline = getIntersectionOfRightLaylineAndStartline();
|
||||
Position intersectionOfleftLaylineAndStartline = getIntersectionOfLeftLaylineAndStartline();
|
||||
Pair<Double, Double> polarBasedStartlineAdvatagesRange = getStartAndEndPointOfPolarBasedStartlineAdvatagesInDistancesToRCBoat(
|
||||
intersectionOfRightLaylineAndStartline, intersectionOfleftLaylineAndStartline);
|
||||
Pair<Double, Double> pinEndStartlineAdvatagesRange = getPinEndStartlineAdvantagesRangeFromPolarAdvantagesRange(polarBasedStartlineAdvatagesRange);
|
||||
result.advantages = calculatePolarBasedStartlineAdvantagesInRange(polarBasedStartlineAdvatagesRange);
|
||||
subtractMinimumOfAllStartlineAdvantages(result.advantages);
|
||||
double maximum = getMaximumAdvantageOfStartlineAdvantageDTOs(result.advantages);
|
||||
result.maximum = maximum;
|
||||
advantageMaximumAverage.add(maximum);
|
||||
result.average = advantageMaximumAverage.getAverage();
|
||||
subtractAgainstMaximumOfAllStartlineAdvantages(result.advantages, maximum);
|
||||
addClosingZeroPointToMixedAdvantages(result.advantages, pinEndStartlineAdvatagesRange);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.log(Level.INFO, "No live race available for startlineadvantages calculation");
|
||||
|
||||
-19
@@ -1,9 +1,5 @@
|
||||
package com.sap.sailing.dashboards.gwt.server.startlineadvantages.precalculation;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.sap.sailing.dashboards.gwt.server.startlineadvantages.StartlineAdvantagesCalculator;
|
||||
import com.sap.sailing.domain.base.impl.BoatClassImpl;
|
||||
import com.sap.sailing.domain.common.BoatClassMasterdata;
|
||||
import com.sap.sailing.domain.common.ManeuverType;
|
||||
@@ -24,26 +20,11 @@ public abstract class AbstracPreCalculationDataRetriever implements PreCalculati
|
||||
public Wind wind;
|
||||
public double meouvreAngle;
|
||||
|
||||
private static final Logger logger = Logger.getLogger(StartlineAdvantagesCalculator.class.getName());
|
||||
|
||||
protected void retrieveDataForCalculation(TrackedRace trackedRace) {
|
||||
startlineAndFirstMarkPositions = retrieveMarkPositions(trackedRace);
|
||||
startlineAdvantageAtPinEndInMeters = retrieveStartlineAdvantage(trackedRace);
|
||||
startlineLenghtInMeters = retrieveStartlineLenght(trackedRace);
|
||||
wind = retrieveWindAtPosition(startlineAndFirstMarkPositions.startBoatPosition, trackedRace);
|
||||
meouvreAngle = retrieveManouvreAngleAtWindSpeedAndBoatClass(new BoatClassImpl("Extreme40", BoatClassMasterdata.EXTREME_40), ManeuverType.TACK, wind);
|
||||
printData();
|
||||
}
|
||||
|
||||
private void printData() {
|
||||
logger.log(Level.INFO, "Retrieved pre calculation data for startline advantages calculation");
|
||||
logger.log(Level.INFO, "startlineAndFirstMarkPositions.startBoatPosition "+startlineAndFirstMarkPositions.startBoatPosition);
|
||||
logger.log(Level.INFO, "startlineAndFirstMarkPositions.pinEndPosition "+startlineAndFirstMarkPositions.pinEndPosition);
|
||||
logger.log(Level.INFO, "startlineAndFirstMarkPositions.firstMarkPosition "+startlineAndFirstMarkPositions.firstMarkPosition);
|
||||
logger.log(Level.INFO, "startlineAdvantageAtPinEndInMeters "+startlineAdvantageAtPinEndInMeters);
|
||||
logger.log(Level.INFO, "startlineLenghtInMeters "+startlineLenghtInMeters);
|
||||
logger.log(Level.INFO, "wind.getBeaufort() "+wind.getKnots());
|
||||
logger.log(Level.INFO, "wind.getBearing().getDegrees() "+wind.getBearing().getDegrees());
|
||||
logger.log(Level.INFO, "meouvreAngle.getDegrees() "+meouvreAngle);
|
||||
}
|
||||
}
|
||||
+7
-5
@@ -14,14 +14,16 @@ import com.sap.sailing.domain.polars.PolarDataService;
|
||||
*/
|
||||
public interface PreCalculationPolarDataRetriever {
|
||||
|
||||
default double retrieveManouvreAngleAtWindSpeedAndBoatClass(BoatClass boatClass, ManeuverType maneuverType,
|
||||
Speed windSpeed) {
|
||||
default double retrieveManouvreAngleAtWindSpeedAndBoatClass(BoatClass boatClass, ManeuverType maneuverType, Speed windSpeed) {
|
||||
double result = 0;
|
||||
try {
|
||||
BearingWithConfidence<Void> bearingWithConfidence = getPolarDataService().getManeuverAngle(boatClass, maneuverType, windSpeed);
|
||||
result = bearingWithConfidence.getObject().getDegrees();
|
||||
if (boatClass != null && maneuverType != null && windSpeed != null) {
|
||||
BearingWithConfidence<Void> bearingWithConfidence = getPolarDataService().getManeuverAngle(boatClass, maneuverType, windSpeed);
|
||||
result = bearingWithConfidence.getObject().getDegrees();
|
||||
} else {
|
||||
result = DefaultPolarValues.getManouvreAngle(ManeuverType.TACK);
|
||||
}
|
||||
} catch (NotEnoughDataHasBeenAddedException | NullPointerException e) {
|
||||
result = DefaultPolarValues.getManouvreAngle(ManeuverType.TACK);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
|
||||
+2
@@ -48,6 +48,8 @@
|
||||
|
||||
<set-property name="gwt.logging.enabled" value="TRUE" />
|
||||
<set-property name="gwt.logging.logLevel" value="FINE" />
|
||||
<set-property name="gwt.logging.simpleRemoteHandler" value="ENABLED" />
|
||||
<set-property name="gwt.logging.consoleHandler" value="ENABLED"/>
|
||||
|
||||
<set-property name="user.agent" value="safari" />
|
||||
|
||||
|
||||
@@ -9,5 +9,4 @@ Bundle-ActivationPolicy: lazy
|
||||
Bundle-ClassPath: .
|
||||
Require-Bundle: com.sap.sse.datamining.shared,
|
||||
com.sap.sailing.domain.common
|
||||
Export-Package: com.sap.sailing.datamining.shared,
|
||||
com.sap.sailing.datamining.shared.dto
|
||||
Export-Package: com.sap.sailing.datamining.shared
|
||||
+8
-2
@@ -1,7 +1,10 @@
|
||||
package com.sap.sailing.datamining.shared;
|
||||
|
||||
import com.sap.sailing.datamining.shared.dto.DistanceDTO;
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sailing.domain.common.LegType;
|
||||
import com.sap.sailing.domain.common.impl.CentralAngleDistance;
|
||||
import com.sap.sailing.domain.common.impl.MeterDistance;
|
||||
import com.sap.sailing.domain.common.impl.NauticalMileDistance;
|
||||
import com.sap.sse.datamining.shared.SerializationDummy;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@@ -9,7 +12,10 @@ public final class SailingDataMiningSerializationDummy implements SerializationD
|
||||
private static final long serialVersionUID = 2L;
|
||||
|
||||
private LegType legType;
|
||||
private DistanceDTO distance;
|
||||
private Distance distance;
|
||||
private CentralAngleDistance centralAngleDistance;
|
||||
private MeterDistance meterDistance;
|
||||
private NauticalMileDistance nauticalMileDistance;
|
||||
|
||||
private SailingDataMiningSerializationDummy() { }
|
||||
|
||||
|
||||
-63
@@ -1,63 +0,0 @@
|
||||
package com.sap.sailing.datamining.shared.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class DistanceDTO implements Serializable {
|
||||
private static final long serialVersionUID = -4949861628112888523L;
|
||||
|
||||
private double geographicalMiles;
|
||||
private double seaMiles;
|
||||
private double nauticalMiles;
|
||||
private double meters;
|
||||
private double kilometers;
|
||||
private double centralAngleDegree;
|
||||
private double centralAngleRadian;
|
||||
|
||||
/**
|
||||
* <b>Do NOT use!</b><br>
|
||||
* Constructor for GWT-Serialization.
|
||||
*/
|
||||
@Deprecated
|
||||
DistanceDTO() {
|
||||
}
|
||||
|
||||
public DistanceDTO(double geographicalMiles, double seaMiles, double nauticalMiles, double meters,
|
||||
double kilometers, double centralAngleDegree, double centralAngleRadian) {
|
||||
this.geographicalMiles = geographicalMiles;
|
||||
this.seaMiles = seaMiles;
|
||||
this.nauticalMiles = nauticalMiles;
|
||||
this.meters = meters;
|
||||
this.kilometers = kilometers;
|
||||
this.centralAngleDegree = centralAngleDegree;
|
||||
this.centralAngleRadian = centralAngleRadian;
|
||||
}
|
||||
|
||||
public double getGeographicalMiles() {
|
||||
return geographicalMiles;
|
||||
}
|
||||
|
||||
public double getSeaMiles() {
|
||||
return seaMiles;
|
||||
}
|
||||
|
||||
public double getNauticalMiles() {
|
||||
return nauticalMiles;
|
||||
}
|
||||
|
||||
public double getMeters() {
|
||||
return meters;
|
||||
}
|
||||
|
||||
public double getKilometers() {
|
||||
return kilometers;
|
||||
}
|
||||
|
||||
public double getCentralAngleDegree() {
|
||||
return centralAngleDegree;
|
||||
}
|
||||
|
||||
public double getCentralAngleRadian() {
|
||||
return centralAngleRadian;
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -3,7 +3,7 @@ package com.sap.sailing.datamining.test.util;
|
||||
import java.util.Collection;
|
||||
|
||||
import com.sap.sse.datamining.functions.Function;
|
||||
import com.sap.sse.datamining.impl.functions.FunctionManager;
|
||||
import com.sap.sse.datamining.impl.components.management.FunctionManager;
|
||||
|
||||
public class OpenFunctionManager extends FunctionManager {
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ Require-Bundle: com.sap.sailing.domain,
|
||||
com.sap.sailing.domain.common,
|
||||
com.sap.sailing.datamining.shared,
|
||||
com.sap.sse.datamining,
|
||||
com.sap.sse.datamining.annotations;bundle-version="1.0.0",
|
||||
com.sap.sse.datamining.shared,
|
||||
com.sap.sse,
|
||||
com.sap.sse.common,
|
||||
|
||||
+9
-9
@@ -14,13 +14,13 @@ CourseArea=Regattabahn
|
||||
BoatClass=Bootsklasse
|
||||
Fleet=Flotte
|
||||
Race=Rennen
|
||||
LeaderboardSailingDomainRetrieverChain=Segel-Domänen Ranglisten-Beschaffer
|
||||
RaceSailingDomainRetrieverChain=Segel-Domänen Rennen-Beschaffer
|
||||
LegSailingDomainRetrieverChain=Segel-Domänen Leg-Beschaffer
|
||||
GPSFixSailingDomainRetrieverChain=Segel-Domänen GPS-Fix-Beschaffer
|
||||
MarkPassingSailingDomainRetrieverChain=Segel-Domänen Tonnenrundungs-Beschaffer
|
||||
RaceResultSailingDomainRetrieverChain=Segel-Domänen Rennergebnis-Beschaffer
|
||||
RaceOfCompetitorSailingDomainRetrieverChain=Rennen eines Teilnehmers-Beschaffer
|
||||
LeaderboardSailingDomainRetrieverChain=Leaderboards
|
||||
RaceSailingDomainRetrieverChain=Rennen
|
||||
LegSailingDomainRetrieverChain=Schenkel
|
||||
GPSFixSailingDomainRetrieverChain=GPS-Fixes
|
||||
MarkPassingSailingDomainRetrieverChain=Tonnenrundungen
|
||||
RaceResultSailingDomainRetrieverChain=Rennergebnisse
|
||||
RaceOfCompetitorSailingDomainRetrieverChain=Rennen eines Teilnehmers
|
||||
LeaderboardGroup=Ranglisten Gruppe
|
||||
Leaderboard=Rangliste
|
||||
Leg=Schenkel
|
||||
@@ -30,7 +30,6 @@ GpsFix=GPS-Fix
|
||||
Speed=Geschwindigkeit
|
||||
SpeedTenSecondsBefore=Geschwindigkeit 10s vorher
|
||||
WindStrengthInBeaufort=Windstärke in Beaufort
|
||||
BftClusterGroup=Windstärke in Beaufort
|
||||
Bft0=Windstille
|
||||
Bft1=leiser Zug
|
||||
Bft2=leichte Brise
|
||||
@@ -47,9 +46,10 @@ Bft12=Orkan
|
||||
RelativeScoreInRace=Relative Wertung im Rennen (0 am besten; 1 am schlechtesten)
|
||||
WindSpeedInBeaufort=Windgeschwindigkeit in Bft.
|
||||
DistanceAtStart=Distanz zur Startlinie zum Startzeitpunkt
|
||||
SpeedAtStart=Geschwindigkeit zum Startzeitpunkt
|
||||
SpeedWhenStarting=Geschwindigkeit beim Überqueren der Startlinie
|
||||
SpeedTenSecondsBeforeStart=Geschwindigkeit 10s vor dem Startzeitpunkt
|
||||
RankAtFirstMark=Position beim ersten Wegpunkt
|
||||
NumberOfManeuvers=Anzahl der Manöver
|
||||
NumberOfTacks=Anzahl der Wenden
|
||||
NumberOfJibes=Anzahl der Halsen
|
||||
NumberOfPenaltyCircles=Anzahl der Straf-Kreise
|
||||
|
||||
+9
-9
@@ -16,13 +16,13 @@ Race=Race
|
||||
Competitor=Competitor
|
||||
Boat=Boat
|
||||
Team=Team
|
||||
LeaderboardSailingDomainRetrieverChain=Sailing Domain Leaderboard Retriever
|
||||
RaceSailingDomainRetrieverChain=Sailing Domain Race Retriever
|
||||
LegSailingDomainRetrieverChain=Sailing Domain Leg Retriever
|
||||
GPSFixSailingDomainRetrieverChain=Sailing Domain GPS Fix Retriever
|
||||
MarkPassingSailingDomainRetrieverChain=Sailing Domain Mark Passing Retriever
|
||||
RaceResultSailingDomainRetrieverChain=Sailing Domain Race Result Retriever
|
||||
RaceOfCompetitorSailingDomainRetrieverChain=Race of Competitor Retriever
|
||||
LeaderboardSailingDomainRetrieverChain=Leaderboards
|
||||
RaceSailingDomainRetrieverChain=Races
|
||||
LegSailingDomainRetrieverChain=Legs
|
||||
GPSFixSailingDomainRetrieverChain=GPS-Fixes
|
||||
MarkPassingSailingDomainRetrieverChain=Mark Passings
|
||||
RaceResultSailingDomainRetrieverChain=Race Results
|
||||
RaceOfCompetitorSailingDomainRetrieverChain=Races of Competitors
|
||||
LeaderboardGroup=Leaderboard Group
|
||||
Leaderboard=Leaderboard
|
||||
Leg=Leg
|
||||
@@ -30,7 +30,6 @@ MarkPassing=Mark Passing
|
||||
LegOfCompetitor=Leg of competitor
|
||||
GpsFix=GPS-Fix
|
||||
WindStrengthInBeaufort=Wind Strength in Beaufort
|
||||
BftClusterGroup=Wind Strength in Beaufort
|
||||
Bft0=Calm
|
||||
Bft1=Light air
|
||||
Bft2=Light breeze
|
||||
@@ -47,9 +46,10 @@ Bft12=Hurricane
|
||||
RelativeScoreInRace=Relative score in race (0 best; 1 worst)
|
||||
WindSpeedInBeaufort=Wind speed in Bft
|
||||
DistanceAtStart=Distance to start at start
|
||||
SpeedAtStart=Speed at start
|
||||
SpeedWhenStarting=Speed when starting
|
||||
SpeedTenSecondsBeforeStart=Speed 10s before start
|
||||
RankAtFirstMark=Rank at First Mark
|
||||
NumberOfManeuvers=Number of Maneuvers
|
||||
NumberOfTacks=Number of Tacks
|
||||
NumberOfJibes=Number of Jibes
|
||||
NumberOfPenaltyCircles=Number of Penalty Circles
|
||||
|
||||
@@ -2,11 +2,14 @@ package com.sap.sailing.datamining;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
import com.sap.sailing.datamining.data.HasGPSFixContext;
|
||||
import com.sap.sailing.datamining.data.HasLeaderboardContext;
|
||||
import com.sap.sailing.datamining.data.HasLeaderboardGroupContext;
|
||||
import com.sap.sailing.datamining.data.HasMarkPassingContext;
|
||||
import com.sap.sailing.datamining.data.HasRaceOfCompetitorContext;
|
||||
import com.sap.sailing.datamining.data.HasRaceResultOfCompetitorContext;
|
||||
@@ -14,18 +17,23 @@ import com.sap.sailing.datamining.data.HasTrackedLegContext;
|
||||
import com.sap.sailing.datamining.data.HasTrackedLegOfCompetitorContext;
|
||||
import com.sap.sailing.datamining.data.HasTrackedRaceContext;
|
||||
import com.sap.sailing.datamining.impl.components.aggregators.ParallelBoolSumAggregationProcessor;
|
||||
import com.sap.sailing.datamining.impl.components.aggregators.ParallelDistanceAverageAggregationProcessor;
|
||||
import com.sap.sailing.datamining.impl.components.aggregators.ParallelDistanceMaxAggregationProcessor;
|
||||
import com.sap.sailing.datamining.impl.components.aggregators.ParallelDistanceMedianAggregationProcessor;
|
||||
import com.sap.sailing.datamining.impl.components.aggregators.ParallelDistanceMinAggregationProcessor;
|
||||
import com.sap.sailing.datamining.impl.components.aggregators.ParallelDistanceSumAggregationProcessor;
|
||||
import com.sap.sailing.domain.common.Speed;
|
||||
import com.sap.sse.datamining.DataMiningBundleService;
|
||||
import com.sap.sse.datamining.DataSourceProvider;
|
||||
import com.sap.sse.datamining.components.AggregationProcessorDefinition;
|
||||
import com.sap.sse.datamining.components.DataRetrieverChainDefinition;
|
||||
import com.sap.sse.datamining.data.ClusterGroup;
|
||||
import com.sap.sse.datamining.impl.AbstractDataMiningActivator;
|
||||
import com.sap.sse.datamining.impl.AbstractDataMiningActivatorWithPredefinedQueries;
|
||||
import com.sap.sse.datamining.shared.dto.StatisticQueryDefinitionDTO;
|
||||
import com.sap.sse.datamining.shared.impl.PredefinedQueryIdentifier;
|
||||
import com.sap.sse.i18n.ResourceBundleStringMessages;
|
||||
import com.sap.sse.i18n.impl.ResourceBundleStringMessagesImpl;
|
||||
|
||||
public class Activator extends AbstractDataMiningActivator implements DataMiningBundleService {
|
||||
public class Activator extends AbstractDataMiningActivatorWithPredefinedQueries {
|
||||
|
||||
private static final String STRING_MESSAGES_BASE_NAME = "stringmessages/Sailing_StringMessages";
|
||||
private static final SailingClusterGroups clusterGroups = new SailingClusterGroups();
|
||||
@@ -36,12 +44,14 @@ public class Activator extends AbstractDataMiningActivator implements DataMining
|
||||
|
||||
private final ResourceBundleStringMessages sailingServerStringMessages;
|
||||
private final SailingDataRetrievalChainDefinitions dataRetrieverChainDefinitions;
|
||||
private final SailingPredefinedQueries predefinedQueries;
|
||||
private Collection<DataSourceProvider<?>> dataSourceProviders;
|
||||
private boolean dataSourceProvidersHaveBeenInitialized;
|
||||
|
||||
public Activator() {
|
||||
sailingServerStringMessages = new ResourceBundleStringMessagesImpl(STRING_MESSAGES_BASE_NAME, getClassLoader());
|
||||
dataRetrieverChainDefinitions = new SailingDataRetrievalChainDefinitions();
|
||||
sailingServerStringMessages = new ResourceBundleStringMessagesImpl(STRING_MESSAGES_BASE_NAME, getClass().getClassLoader());
|
||||
predefinedQueries = new SailingPredefinedQueries();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -59,11 +69,6 @@ public class Activator extends AbstractDataMiningActivator implements DataMining
|
||||
super.stop(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DataMiningBundleService getDataMiningBundleService() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceBundleStringMessages getStringMessages() {
|
||||
return sailingServerStringMessages;
|
||||
@@ -79,12 +84,14 @@ public class Activator extends AbstractDataMiningActivator implements DataMining
|
||||
internalClasses.add(HasGPSFixContext.class);
|
||||
internalClasses.add(HasMarkPassingContext.class);
|
||||
internalClasses.add(HasRaceOfCompetitorContext.class);
|
||||
internalClasses.add(HasLeaderboardGroupContext.class);
|
||||
internalClasses.add(HasLeaderboardContext.class);
|
||||
return internalClasses;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<DataRetrieverChainDefinition<?, ?>> getDataRetrieverChainDefinitions() {
|
||||
return dataRetrieverChainDefinitions.getDataRetrieverChainDefinitions();
|
||||
return dataRetrieverChainDefinitions.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -101,9 +108,18 @@ public class Activator extends AbstractDataMiningActivator implements DataMining
|
||||
HashSet<AggregationProcessorDefinition<?, ?>> aggregators = new HashSet<>();
|
||||
aggregators.add(ParallelBoolSumAggregationProcessor.getDefinition());
|
||||
aggregators.add(ParallelDistanceSumAggregationProcessor.getDefinition());
|
||||
aggregators.add(ParallelDistanceAverageAggregationProcessor.getDefinition());
|
||||
aggregators.add(ParallelDistanceMaxAggregationProcessor.getDefinition());
|
||||
aggregators.add(ParallelDistanceMinAggregationProcessor.getDefinition());
|
||||
aggregators.add(ParallelDistanceMedianAggregationProcessor.getDefinition());
|
||||
return aggregators;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<PredefinedQueryIdentifier, StatisticQueryDefinitionDTO> getPredefinedQueries() {
|
||||
return predefinedQueries.get();
|
||||
}
|
||||
|
||||
private void initializeDataSourceProviders() {
|
||||
dataSourceProviders = new HashSet<>();
|
||||
dataSourceProviders.add(new RacingEventServiceProvider(context));
|
||||
|
||||
+15
-14
@@ -13,6 +13,7 @@ import com.sap.sse.datamining.impl.data.ClusterWithSingleBoundary;
|
||||
import com.sap.sse.datamining.impl.data.ComparableClusterBoundary;
|
||||
import com.sap.sse.datamining.impl.data.ComparisonStrategy;
|
||||
import com.sap.sse.datamining.impl.data.FixClusterGroup;
|
||||
import com.sap.sse.datamining.impl.data.LocalizedCluster;
|
||||
|
||||
public class SailingClusterGroups {
|
||||
|
||||
@@ -25,79 +26,79 @@ public class SailingClusterGroups {
|
||||
ClusterBoundary<Speed> lowerBound = new ComparableClusterBoundary<Speed>(lowerBoundWindSpeed, ComparisonStrategy.GREATER_EQUALS_THAN);
|
||||
Speed upperBoundWindSpeed = new KnotSpeedImpl(1.0);
|
||||
ClusterBoundary<Speed> upperBound = new ComparableClusterBoundary<Speed>(upperBoundWindSpeed, ComparisonStrategy.LOWER_THAN);
|
||||
clusters.add(new ClusterWithLowerAndUpperBoundaries<Speed>("Bft0", lowerBound, upperBound));
|
||||
clusters.add(new LocalizedCluster<Speed>("Bft0", new ClusterWithLowerAndUpperBoundaries<Speed>(lowerBound, upperBound)));
|
||||
|
||||
lowerBoundWindSpeed = new KnotSpeedImpl(1.0);
|
||||
lowerBound = new ComparableClusterBoundary<Speed>(lowerBoundWindSpeed, ComparisonStrategy.GREATER_EQUALS_THAN);
|
||||
upperBoundWindSpeed = new KnotSpeedImpl(4.0);
|
||||
upperBound = new ComparableClusterBoundary<Speed>(upperBoundWindSpeed, ComparisonStrategy.LOWER_THAN);
|
||||
clusters.add(new ClusterWithLowerAndUpperBoundaries<Speed>("Bft1", lowerBound, upperBound));
|
||||
clusters.add(new LocalizedCluster<Speed>("Bft1", new ClusterWithLowerAndUpperBoundaries<Speed>(lowerBound, upperBound)));
|
||||
|
||||
lowerBoundWindSpeed = new KnotSpeedImpl(4.0);
|
||||
lowerBound = new ComparableClusterBoundary<Speed>(lowerBoundWindSpeed, ComparisonStrategy.GREATER_EQUALS_THAN);
|
||||
upperBoundWindSpeed = new KnotSpeedImpl(7.0);
|
||||
upperBound = new ComparableClusterBoundary<Speed>(upperBoundWindSpeed, ComparisonStrategy.LOWER_THAN);
|
||||
clusters.add(new ClusterWithLowerAndUpperBoundaries<Speed>("Bft2", lowerBound, upperBound));
|
||||
clusters.add(new LocalizedCluster<Speed>("Bft2", new ClusterWithLowerAndUpperBoundaries<Speed>(lowerBound, upperBound)));
|
||||
|
||||
lowerBoundWindSpeed = new KnotSpeedImpl(7.0);
|
||||
lowerBound = new ComparableClusterBoundary<Speed>(lowerBoundWindSpeed, ComparisonStrategy.GREATER_EQUALS_THAN);
|
||||
upperBoundWindSpeed = new KnotSpeedImpl(11.0);
|
||||
upperBound = new ComparableClusterBoundary<Speed>(upperBoundWindSpeed, ComparisonStrategy.LOWER_THAN);
|
||||
clusters.add(new ClusterWithLowerAndUpperBoundaries<Speed>("Bft3", lowerBound, upperBound));
|
||||
clusters.add(new LocalizedCluster<Speed>("Bft3", new ClusterWithLowerAndUpperBoundaries<Speed>(lowerBound, upperBound)));
|
||||
|
||||
lowerBoundWindSpeed = new KnotSpeedImpl(11.0);
|
||||
lowerBound = new ComparableClusterBoundary<Speed>(lowerBoundWindSpeed, ComparisonStrategy.GREATER_EQUALS_THAN);
|
||||
upperBoundWindSpeed = new KnotSpeedImpl(16.0);
|
||||
upperBound = new ComparableClusterBoundary<Speed>(upperBoundWindSpeed, ComparisonStrategy.LOWER_THAN);
|
||||
clusters.add(new ClusterWithLowerAndUpperBoundaries<Speed>("Bft4", lowerBound, upperBound));
|
||||
clusters.add(new LocalizedCluster<Speed>("Bft4", new ClusterWithLowerAndUpperBoundaries<Speed>(lowerBound, upperBound)));
|
||||
|
||||
lowerBoundWindSpeed = new KnotSpeedImpl(16.0);
|
||||
lowerBound = new ComparableClusterBoundary<Speed>(lowerBoundWindSpeed, ComparisonStrategy.GREATER_EQUALS_THAN);
|
||||
upperBoundWindSpeed = new KnotSpeedImpl(22.0);
|
||||
upperBound = new ComparableClusterBoundary<Speed>(upperBoundWindSpeed, ComparisonStrategy.LOWER_THAN);
|
||||
clusters.add(new ClusterWithLowerAndUpperBoundaries<Speed>("Bft5", lowerBound, upperBound));
|
||||
clusters.add(new LocalizedCluster<Speed>("Bft5", new ClusterWithLowerAndUpperBoundaries<Speed>(lowerBound, upperBound)));
|
||||
|
||||
lowerBoundWindSpeed = new KnotSpeedImpl(22.0);
|
||||
lowerBound = new ComparableClusterBoundary<Speed>(lowerBoundWindSpeed, ComparisonStrategy.GREATER_EQUALS_THAN);
|
||||
upperBoundWindSpeed = new KnotSpeedImpl(28.0);
|
||||
upperBound = new ComparableClusterBoundary<Speed>(upperBoundWindSpeed, ComparisonStrategy.LOWER_THAN);
|
||||
clusters.add(new ClusterWithLowerAndUpperBoundaries<Speed>("Bft6", lowerBound, upperBound));
|
||||
clusters.add(new LocalizedCluster<Speed>("Bft6", new ClusterWithLowerAndUpperBoundaries<Speed>(lowerBound, upperBound)));
|
||||
|
||||
lowerBoundWindSpeed = new KnotSpeedImpl(28.0);
|
||||
lowerBound = new ComparableClusterBoundary<Speed>(lowerBoundWindSpeed, ComparisonStrategy.GREATER_EQUALS_THAN);
|
||||
upperBoundWindSpeed = new KnotSpeedImpl(34.0);
|
||||
upperBound = new ComparableClusterBoundary<Speed>(upperBoundWindSpeed, ComparisonStrategy.LOWER_THAN);
|
||||
clusters.add(new ClusterWithLowerAndUpperBoundaries<Speed>("Bft7", lowerBound, upperBound));
|
||||
clusters.add(new LocalizedCluster<Speed>("Bft7", new ClusterWithLowerAndUpperBoundaries<Speed>(lowerBound, upperBound)));
|
||||
|
||||
lowerBoundWindSpeed = new KnotSpeedImpl(34.0);
|
||||
lowerBound = new ComparableClusterBoundary<Speed>(lowerBoundWindSpeed, ComparisonStrategy.GREATER_EQUALS_THAN);
|
||||
upperBoundWindSpeed = new KnotSpeedImpl(41.0);
|
||||
upperBound = new ComparableClusterBoundary<Speed>(upperBoundWindSpeed, ComparisonStrategy.LOWER_THAN);
|
||||
clusters.add(new ClusterWithLowerAndUpperBoundaries<Speed>("Bft8", lowerBound, upperBound));
|
||||
clusters.add(new LocalizedCluster<Speed>("Bft8", new ClusterWithLowerAndUpperBoundaries<Speed>(lowerBound, upperBound)));
|
||||
|
||||
lowerBoundWindSpeed = new KnotSpeedImpl(41.0);
|
||||
lowerBound = new ComparableClusterBoundary<Speed>(lowerBoundWindSpeed, ComparisonStrategy.GREATER_EQUALS_THAN);
|
||||
upperBoundWindSpeed = new KnotSpeedImpl(48.0);
|
||||
upperBound = new ComparableClusterBoundary<Speed>(upperBoundWindSpeed, ComparisonStrategy.LOWER_THAN);
|
||||
clusters.add(new ClusterWithLowerAndUpperBoundaries<Speed>("Bft9", lowerBound, upperBound));
|
||||
clusters.add(new LocalizedCluster<Speed>("Bft9", new ClusterWithLowerAndUpperBoundaries<Speed>(lowerBound, upperBound)));
|
||||
|
||||
lowerBoundWindSpeed = new KnotSpeedImpl(48.0);
|
||||
lowerBound = new ComparableClusterBoundary<Speed>(lowerBoundWindSpeed, ComparisonStrategy.GREATER_EQUALS_THAN);
|
||||
upperBoundWindSpeed = new KnotSpeedImpl(56.0);
|
||||
upperBound = new ComparableClusterBoundary<Speed>(upperBoundWindSpeed, ComparisonStrategy.LOWER_THAN);
|
||||
clusters.add(new ClusterWithLowerAndUpperBoundaries<Speed>("Bft10", lowerBound, upperBound));
|
||||
clusters.add(new LocalizedCluster<Speed>("Bft10", new ClusterWithLowerAndUpperBoundaries<Speed>(lowerBound, upperBound)));
|
||||
|
||||
lowerBoundWindSpeed = new KnotSpeedImpl(56.0);
|
||||
lowerBound = new ComparableClusterBoundary<Speed>(lowerBoundWindSpeed, ComparisonStrategy.GREATER_EQUALS_THAN);
|
||||
upperBoundWindSpeed = new KnotSpeedImpl(64.0);
|
||||
upperBound = new ComparableClusterBoundary<Speed>(upperBoundWindSpeed, ComparisonStrategy.LOWER_THAN);
|
||||
clusters.add(new ClusterWithLowerAndUpperBoundaries<Speed>("Bft11", lowerBound, upperBound));
|
||||
clusters.add(new LocalizedCluster<Speed>("Bft11", new ClusterWithLowerAndUpperBoundaries<Speed>(lowerBound, upperBound)));
|
||||
|
||||
lowerBoundWindSpeed = new KnotSpeedImpl(64.0);
|
||||
lowerBound = new ComparableClusterBoundary<Speed>(lowerBoundWindSpeed, ComparisonStrategy.GREATER_EQUALS_THAN);
|
||||
clusters.add(new ClusterWithSingleBoundary<Speed>("Bft12", lowerBound));
|
||||
clusters.add(new LocalizedCluster<Speed>("Bft12", new ClusterWithSingleBoundary<Speed>(lowerBound)));
|
||||
|
||||
windStrengthInBeaufortCluster = new FixClusterGroup<Speed>("BftClusterGroup", clusters);
|
||||
windStrengthInBeaufortCluster = new FixClusterGroup<Speed>(clusters);
|
||||
}
|
||||
|
||||
public ClusterGroup<Speed> getWindStrengthInBeaufortCluster() {
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ public class SailingDataRetrievalChainDefinitions {
|
||||
dataRetrieverChainDefinitions.add(gpsFixRetrieverChainDefinition);
|
||||
}
|
||||
|
||||
public Iterable<DataRetrieverChainDefinition<?, ?>> getDataRetrieverChainDefinitions() {
|
||||
public Iterable<DataRetrieverChainDefinition<?, ?>> get() {
|
||||
return dataRetrieverChainDefinitions;
|
||||
}
|
||||
|
||||
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
package com.sap.sailing.datamining;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.sap.sailing.datamining.data.HasGPSFixContext;
|
||||
import com.sap.sailing.datamining.data.HasLeaderboardContext;
|
||||
import com.sap.sailing.datamining.data.HasRaceOfCompetitorContext;
|
||||
import com.sap.sailing.datamining.data.HasTrackedLegContext;
|
||||
import com.sap.sailing.datamining.data.HasTrackedLegOfCompetitorContext;
|
||||
import com.sap.sailing.datamining.data.HasTrackedRaceContext;
|
||||
import com.sap.sailing.datamining.impl.components.GPSFixRetrievalProcessor;
|
||||
import com.sap.sailing.datamining.impl.components.LeaderboardGroupRetrievalProcessor;
|
||||
import com.sap.sailing.datamining.impl.components.LeaderboardRetrievalProcessor;
|
||||
import com.sap.sailing.datamining.impl.components.RaceOfCompetitorRetrievalProcessor;
|
||||
import com.sap.sailing.datamining.impl.components.TrackedLegOfCompetitorRetrievalProcessor;
|
||||
import com.sap.sailing.datamining.impl.components.TrackedLegRetrievalProcessor;
|
||||
import com.sap.sailing.datamining.impl.components.TrackedRaceRetrievalProcessor;
|
||||
import com.sap.sailing.datamining.impl.data.LeaderboardGroupWithContext;
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sailing.domain.common.LegType;
|
||||
import com.sap.sailing.server.RacingEventService;
|
||||
import com.sap.sse.datamining.shared.dto.StatisticQueryDefinitionDTO;
|
||||
import com.sap.sse.datamining.shared.impl.PredefinedQueryIdentifier;
|
||||
import com.sap.sse.datamining.shared.impl.dto.AggregationProcessorDefinitionDTO;
|
||||
import com.sap.sse.datamining.shared.impl.dto.DataRetrieverChainDefinitionDTO;
|
||||
import com.sap.sse.datamining.shared.impl.dto.DataRetrieverLevelDTO;
|
||||
import com.sap.sse.datamining.shared.impl.dto.FunctionDTO;
|
||||
import com.sap.sse.datamining.shared.impl.dto.LocalizedTypeDTO;
|
||||
import com.sap.sse.datamining.shared.impl.dto.ModifiableStatisticQueryDefinitionDTO;
|
||||
|
||||
public class SailingPredefinedQueries {
|
||||
|
||||
private final Map<PredefinedQueryIdentifier, StatisticQueryDefinitionDTO> predefinedQueries;
|
||||
|
||||
public SailingPredefinedQueries() {
|
||||
predefinedQueries = new HashMap<>();
|
||||
predefinedQueries.put(new PredefinedQueryIdentifier("AvgSpeed_Per_Regatta-Race", "Average Speed grouped by Regatta Name and Race Name"),
|
||||
create_AvgSpeed_Per_Regatta_Race());
|
||||
predefinedQueries.put(new PredefinedQueryIdentifier("AvgSpeed_Per_Competitor-LegType", "Average Speed grouped by Competitor Team Name and Leg Type"),
|
||||
create_AvgSpeed_Per_Competitor_LegType());
|
||||
predefinedQueries.put(new PredefinedQueryIdentifier("SumDistance_Per_Competitor-LegType", "Sum of the traveled Distance grouped by Competitor Team Name and Leg Type"),
|
||||
create_SumDistance_Per_Competitor_LegType());
|
||||
predefinedQueries.put(new PredefinedQueryIdentifier("SumManeuvers_Per_Competitor", "Sum of the performed Maneuvers grouped by Competitor Team Name"),
|
||||
create_SumManeuvers_Per_Competitor());
|
||||
}
|
||||
|
||||
private StatisticQueryDefinitionDTO create_AvgSpeed_Per_Regatta_Race() {
|
||||
FunctionDTO statistic = new FunctionDTO(false, "getGPSFix().getSpeed().getKnots()", HasGPSFixContext.class.getName(), double.class.getName(), new ArrayList<String>(), "", 0);
|
||||
AggregationProcessorDefinitionDTO aggregator = new AggregationProcessorDefinitionDTO("Average", Number.class.getName(), Number.class.getName(), "");
|
||||
|
||||
ArrayList<DataRetrieverLevelDTO> retrieverLevels = new ArrayList<>();
|
||||
retrieverLevels.add(new DataRetrieverLevelDTO(0, LeaderboardGroupRetrievalProcessor.class.getName(), new LocalizedTypeDTO(LeaderboardGroupWithContext.class.getName(), "Leaderboard Group"), null));
|
||||
retrieverLevels.add(new DataRetrieverLevelDTO(1, LeaderboardRetrievalProcessor.class.getName(), new LocalizedTypeDTO(HasLeaderboardContext.class.getName(), "Leaderboard"), null));
|
||||
retrieverLevels.add(new DataRetrieverLevelDTO(2, TrackedRaceRetrievalProcessor.class.getName(), new LocalizedTypeDTO(HasTrackedRaceContext.class.getName(), "Race"), null));
|
||||
retrieverLevels.add(new DataRetrieverLevelDTO(3, TrackedLegRetrievalProcessor.class.getName(), new LocalizedTypeDTO(HasTrackedLegContext.class.getName(), "Leg"), null));
|
||||
retrieverLevels.add(new DataRetrieverLevelDTO(4, TrackedLegOfCompetitorRetrievalProcessor.class.getName(), new LocalizedTypeDTO(HasTrackedLegOfCompetitorContext.class.getName(), "Leg of competitor"), null));
|
||||
retrieverLevels.add(new DataRetrieverLevelDTO(5, GPSFixRetrievalProcessor.class.getName(), new LocalizedTypeDTO(HasGPSFixContext.class.getName(), "GPS-Fix"), null));
|
||||
DataRetrieverChainDefinitionDTO retrieverChain = new DataRetrieverChainDefinitionDTO("", RacingEventService.class.getName(), retrieverLevels);
|
||||
|
||||
ModifiableStatisticQueryDefinitionDTO queryDefinition = new ModifiableStatisticQueryDefinitionDTO("default", statistic, aggregator, retrieverChain);
|
||||
|
||||
FunctionDTO dimensionToGroupBy0 = new FunctionDTO(true, "getTrackedLegOfCompetitorContext().getTrackedLegContext().getTrackedRaceContext().getRegatta().getName()", HasGPSFixContext.class.getName(), String.class.getName(), new ArrayList<String>(), "", 0);
|
||||
queryDefinition.appendDimensionToGroupBy(dimensionToGroupBy0);
|
||||
|
||||
FunctionDTO dimensionToGroupBy1 = new FunctionDTO(true, "getTrackedLegOfCompetitorContext().getTrackedLegContext().getTrackedRaceContext().getRace().getName()", HasGPSFixContext.class.getName(), String.class.getName(), new ArrayList<String>(), "", 0);
|
||||
queryDefinition.appendDimensionToGroupBy(dimensionToGroupBy1);
|
||||
|
||||
return queryDefinition;
|
||||
}
|
||||
|
||||
private StatisticQueryDefinitionDTO create_AvgSpeed_Per_Competitor_LegType() {
|
||||
FunctionDTO statistic = new FunctionDTO(false, "getGPSFix().getSpeed().getKnots()", HasGPSFixContext.class.getName(), double.class.getName(), new ArrayList<String>(), "", 0);
|
||||
AggregationProcessorDefinitionDTO aggregator = new AggregationProcessorDefinitionDTO("Average", Number.class.getName(), Number.class.getName(), "");
|
||||
|
||||
ArrayList<DataRetrieverLevelDTO> retrieverLevels = new ArrayList<>();
|
||||
retrieverLevels.add(new DataRetrieverLevelDTO(0, LeaderboardGroupRetrievalProcessor.class.getName(), new LocalizedTypeDTO(LeaderboardGroupWithContext.class.getName(), "Leaderboard Group"), null));
|
||||
retrieverLevels.add(new DataRetrieverLevelDTO(1, LeaderboardRetrievalProcessor.class.getName(), new LocalizedTypeDTO(HasLeaderboardContext.class.getName(), "Leaderboard"), null));
|
||||
retrieverLevels.add(new DataRetrieverLevelDTO(2, TrackedRaceRetrievalProcessor.class.getName(), new LocalizedTypeDTO(HasTrackedRaceContext.class.getName(), "Race"), null));
|
||||
retrieverLevels.add(new DataRetrieverLevelDTO(3, TrackedLegRetrievalProcessor.class.getName(), new LocalizedTypeDTO(HasTrackedLegContext.class.getName(), "Leg"), null));
|
||||
retrieverLevels.add(new DataRetrieverLevelDTO(4, TrackedLegOfCompetitorRetrievalProcessor.class.getName(), new LocalizedTypeDTO(HasTrackedLegOfCompetitorContext.class.getName(), "Leg of competitor"), null));
|
||||
retrieverLevels.add(new DataRetrieverLevelDTO(5, GPSFixRetrievalProcessor.class.getName(), new LocalizedTypeDTO(HasGPSFixContext.class.getName(), "GPS-Fix"), null));
|
||||
DataRetrieverChainDefinitionDTO retrieverChain = new DataRetrieverChainDefinitionDTO("", RacingEventService.class.getName(), retrieverLevels);
|
||||
|
||||
ModifiableStatisticQueryDefinitionDTO queryDefinition = new ModifiableStatisticQueryDefinitionDTO("default", statistic, aggregator, retrieverChain);
|
||||
|
||||
FunctionDTO dimensionToGroupBy0 = new FunctionDTO(true, "getTrackedLegOfCompetitorContext().getCompetitor().getTeam().getName()", HasGPSFixContext.class.getName(), String.class.getName(), new ArrayList<String>(), "", 0);
|
||||
queryDefinition.appendDimensionToGroupBy(dimensionToGroupBy0);
|
||||
|
||||
FunctionDTO dimensionToGroupBy1 = new FunctionDTO(true, "getTrackedLegOfCompetitorContext().getTrackedLegContext().getLegType()", HasGPSFixContext.class.getName(), LegType.class.getName(), new ArrayList<String>(), "", 0);
|
||||
queryDefinition.appendDimensionToGroupBy(dimensionToGroupBy1);
|
||||
|
||||
return queryDefinition;
|
||||
}
|
||||
|
||||
private StatisticQueryDefinitionDTO create_SumDistance_Per_Competitor_LegType() {
|
||||
FunctionDTO statistic = new FunctionDTO(false, "getDistanceTraveled()", HasTrackedLegOfCompetitorContext.class.getName(), Distance.class.getName(), new ArrayList<String>(), "", 0);
|
||||
AggregationProcessorDefinitionDTO aggregator = new AggregationProcessorDefinitionDTO("Sum", Distance.class.getName(), Distance.class.getName(), "");
|
||||
|
||||
ArrayList<DataRetrieverLevelDTO> retrieverLevels = new ArrayList<>();
|
||||
retrieverLevels.add(new DataRetrieverLevelDTO(0, LeaderboardGroupRetrievalProcessor.class.getName(), new LocalizedTypeDTO(LeaderboardGroupWithContext.class.getName(), "Leaderboard Group"), null));
|
||||
retrieverLevels.add(new DataRetrieverLevelDTO(1, LeaderboardRetrievalProcessor.class.getName(), new LocalizedTypeDTO(HasLeaderboardContext.class.getName(), "Leaderboard"), null));
|
||||
retrieverLevels.add(new DataRetrieverLevelDTO(2, TrackedRaceRetrievalProcessor.class.getName(), new LocalizedTypeDTO(HasTrackedRaceContext.class.getName(), "Race"), null));
|
||||
retrieverLevels.add(new DataRetrieverLevelDTO(3, TrackedLegRetrievalProcessor.class.getName(), new LocalizedTypeDTO(HasTrackedLegContext.class.getName(), "Leg"), null));
|
||||
retrieverLevels.add(new DataRetrieverLevelDTO(4, TrackedLegOfCompetitorRetrievalProcessor.class.getName(), new LocalizedTypeDTO(HasTrackedLegOfCompetitorContext.class.getName(), "Leg of competitor"), null));
|
||||
DataRetrieverChainDefinitionDTO retrieverChain = new DataRetrieverChainDefinitionDTO("", RacingEventService.class.getName(), retrieverLevels);
|
||||
|
||||
ModifiableStatisticQueryDefinitionDTO queryDefinition = new ModifiableStatisticQueryDefinitionDTO("default", statistic, aggregator, retrieverChain);
|
||||
|
||||
FunctionDTO dimensionToGroupBy0 = new FunctionDTO(true, "getCompetitor().getTeam().getName()", HasTrackedLegOfCompetitorContext.class.getName(), String.class.getName(), new ArrayList<String>(), "", 0);
|
||||
queryDefinition.appendDimensionToGroupBy(dimensionToGroupBy0);
|
||||
|
||||
FunctionDTO dimensionToGroupBy1 = new FunctionDTO(true, "getTrackedLegContext().getLegType()", HasTrackedLegOfCompetitorContext.class.getName(), LegType.class.getName(), new ArrayList<String>(), "", 0);
|
||||
queryDefinition.appendDimensionToGroupBy(dimensionToGroupBy1);
|
||||
|
||||
return queryDefinition;
|
||||
}
|
||||
|
||||
private StatisticQueryDefinitionDTO create_SumManeuvers_Per_Competitor() {
|
||||
FunctionDTO statistic = new FunctionDTO(false, "getNumberOfManeuvers()", HasRaceOfCompetitorContext.class.getName(), int.class.getName(), new ArrayList<String>(), "", 0);
|
||||
AggregationProcessorDefinitionDTO aggregator = new AggregationProcessorDefinitionDTO("Sum", Number.class.getName(), Number.class.getName(), "");
|
||||
|
||||
ArrayList<DataRetrieverLevelDTO> retrieverLevels = new ArrayList<>();
|
||||
retrieverLevels.add(new DataRetrieverLevelDTO(0, LeaderboardGroupRetrievalProcessor.class.getName(), new LocalizedTypeDTO(LeaderboardGroupWithContext.class.getName(), "Leaderboard Group"), null));
|
||||
retrieverLevels.add(new DataRetrieverLevelDTO(1, LeaderboardRetrievalProcessor.class.getName(), new LocalizedTypeDTO(HasLeaderboardContext.class.getName(), "Leaderboard"), null));
|
||||
retrieverLevels.add(new DataRetrieverLevelDTO(2, TrackedRaceRetrievalProcessor.class.getName(), new LocalizedTypeDTO(HasTrackedRaceContext.class.getName(), "Race"), null));
|
||||
retrieverLevels.add(new DataRetrieverLevelDTO(3, RaceOfCompetitorRetrievalProcessor.class.getName(), new LocalizedTypeDTO(HasRaceOfCompetitorContext.class.getName(), "Competitor"), null));
|
||||
DataRetrieverChainDefinitionDTO retrieverChain = new DataRetrieverChainDefinitionDTO("", RacingEventService.class.getName(), retrieverLevels);
|
||||
|
||||
ModifiableStatisticQueryDefinitionDTO queryDefinition = new ModifiableStatisticQueryDefinitionDTO("default", statistic, aggregator, retrieverChain);
|
||||
|
||||
FunctionDTO dimensionToGroupBy0 = new FunctionDTO(true, "getCompetitor().getTeam().getName()", HasRaceOfCompetitorContext.class.getName(), String.class.getName(), new ArrayList<String>(), "", 0);
|
||||
queryDefinition.appendDimensionToGroupBy(dimensionToGroupBy0);
|
||||
|
||||
return queryDefinition;
|
||||
}
|
||||
|
||||
public Map<PredefinedQueryIdentifier, StatisticQueryDefinitionDTO> get() {
|
||||
return predefinedQueries;
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -3,8 +3,8 @@ package com.sap.sailing.datamining.data;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.sap.sailing.domain.common.tracking.GPSFixMoving;
|
||||
import com.sap.sse.datamining.shared.annotations.Connector;
|
||||
import com.sap.sse.datamining.shared.annotations.Dimension;
|
||||
import com.sap.sse.datamining.annotations.Connector;
|
||||
import com.sap.sse.datamining.annotations.Dimension;
|
||||
import com.sap.sse.datamining.shared.impl.dto.ClusterDTO;
|
||||
import com.sap.sse.i18n.ResourceBundleStringMessages;
|
||||
|
||||
|
||||
+2
-2
@@ -4,9 +4,9 @@ import com.sap.sailing.domain.leaderboard.Leaderboard;
|
||||
import com.sap.sailing.domain.polars.PolarDataService;
|
||||
|
||||
public interface HasLeaderboardContext {
|
||||
|
||||
|
||||
Leaderboard getLeaderboard();
|
||||
|
||||
PolarDataService getPolarDataService();
|
||||
PolarDataService getPolarDataService();
|
||||
|
||||
}
|
||||
+3
-1
@@ -2,11 +2,13 @@ package com.sap.sailing.datamining.data;
|
||||
|
||||
import com.sap.sailing.domain.leaderboard.LeaderboardGroup;
|
||||
import com.sap.sailing.domain.polars.PolarDataService;
|
||||
import com.sap.sse.datamining.annotations.Connector;
|
||||
|
||||
public interface HasLeaderboardGroupContext {
|
||||
|
||||
@Connector(messageKey="LeaderboardGroup", ordinal=0)
|
||||
LeaderboardGroup getLeaderboardGroup();
|
||||
|
||||
PolarDataService getPolarDataService();
|
||||
PolarDataService getPolarDataService();
|
||||
|
||||
}
|
||||
+2
-2
@@ -4,8 +4,8 @@ import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.NoWindException;
|
||||
import com.sap.sailing.domain.common.Speed;
|
||||
import com.sap.sailing.domain.tracking.MarkPassing;
|
||||
import com.sap.sse.datamining.shared.annotations.Connector;
|
||||
import com.sap.sse.datamining.shared.annotations.Dimension;
|
||||
import com.sap.sse.datamining.annotations.Connector;
|
||||
import com.sap.sse.datamining.annotations.Dimension;
|
||||
|
||||
public interface HasMarkPassingContext {
|
||||
|
||||
|
||||
+20
-18
@@ -1,11 +1,10 @@
|
||||
package com.sap.sailing.datamining.data;
|
||||
|
||||
import com.sap.sailing.datamining.shared.dto.DistanceDTO;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sailing.domain.common.Speed;
|
||||
import com.sap.sse.datamining.shared.annotations.Connector;
|
||||
import com.sap.sse.datamining.shared.annotations.Statistic;
|
||||
import com.sap.sse.datamining.shared.data.Unit;
|
||||
import com.sap.sse.datamining.annotations.Connector;
|
||||
import com.sap.sse.datamining.annotations.Statistic;
|
||||
|
||||
public interface HasRaceOfCompetitorContext {
|
||||
|
||||
@@ -15,31 +14,34 @@ public interface HasRaceOfCompetitorContext {
|
||||
@Connector(messageKey="Competitor")
|
||||
public Competitor getCompetitor();
|
||||
|
||||
@Statistic(messageKey="DistanceAtStart", resultUnit=Unit.None, resultDecimals=2, ordinal=0)
|
||||
public DistanceDTO getDistanceToStartLineAtStart();
|
||||
@Statistic(messageKey="DistanceAtStart", resultDecimals=2, ordinal=0)
|
||||
public Distance getDistanceToStartLineAtStart();
|
||||
|
||||
@Statistic(messageKey="DistanceToStarboardSideAtStart", resultDecimals=2, ordinal=1)
|
||||
public Double getNormalizedDistanceToStarboardSideAtStart();
|
||||
|
||||
@Connector(messageKey="SpeedAtStart", ordinal=2)
|
||||
public Speed getSpeedAtStart();
|
||||
@Connector(messageKey="SpeedWhenStarting", ordinal=2)
|
||||
public Speed getSpeedWhenStarting();
|
||||
|
||||
@Connector(messageKey="SpeedTenSecondsBeforeStart", ordinal=3)
|
||||
public Speed getSpeedTenSecondsBeforeStart();
|
||||
|
||||
@Statistic(messageKey="RankAtFirstMark", resultDecimals=2, ordinal=4)
|
||||
public Double getRankAtFirstMark();
|
||||
|
||||
@Statistic(messageKey="NumberOfTacks", resultDecimals=2, ordinal=5)
|
||||
public Double getNumberOfTacks();
|
||||
|
||||
@Statistic(messageKey="NumberOfJibes", resultDecimals=2, ordinal=6)
|
||||
public Double getNumberOfJibes();
|
||||
|
||||
@Statistic(messageKey="NumberOfPenaltyCircles", resultDecimals=2, ordinal=7)
|
||||
public Double getNumberOfPenaltyCircles();
|
||||
|
||||
@Statistic(messageKey="RankGainsOrLossesBetweenFirstMarkAndFinish", resultDecimals=2, ordinal=8)
|
||||
@Statistic(messageKey="NumberOfManeuvers", resultDecimals=0, ordinal=5)
|
||||
public int getNumberOfManeuvers();
|
||||
|
||||
@Statistic(messageKey="NumberOfTacks", resultDecimals=2, ordinal=6)
|
||||
public int getNumberOfTacks();
|
||||
|
||||
@Statistic(messageKey="NumberOfJibes", resultDecimals=2, ordinal=7)
|
||||
public int getNumberOfJibes();
|
||||
|
||||
@Statistic(messageKey="NumberOfPenaltyCircles", resultDecimals=2, ordinal=8)
|
||||
public int getNumberOfPenaltyCircles();
|
||||
|
||||
@Statistic(messageKey="RankGainsOrLossesBetweenFirstMarkAndFinish", resultDecimals=2, ordinal=9)
|
||||
public Double getRankGainsOrLossesBetweenFirstMarkAndFinish();
|
||||
|
||||
}
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
package com.sap.sailing.datamining.data;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sse.datamining.shared.annotations.Connector;
|
||||
import com.sap.sse.datamining.shared.annotations.Dimension;
|
||||
import com.sap.sse.datamining.shared.annotations.Statistic;
|
||||
import com.sap.sse.datamining.annotations.Connector;
|
||||
import com.sap.sse.datamining.annotations.Dimension;
|
||||
import com.sap.sse.datamining.annotations.Statistic;
|
||||
|
||||
public interface HasRaceResultOfCompetitorContext {
|
||||
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@ package com.sap.sailing.datamining.data;
|
||||
|
||||
import com.sap.sailing.domain.common.LegType;
|
||||
import com.sap.sailing.domain.tracking.TrackedLeg;
|
||||
import com.sap.sse.datamining.shared.annotations.Connector;
|
||||
import com.sap.sse.datamining.shared.annotations.Dimension;
|
||||
import com.sap.sse.datamining.annotations.Connector;
|
||||
import com.sap.sse.datamining.annotations.Dimension;
|
||||
|
||||
public interface HasTrackedLegContext {
|
||||
|
||||
|
||||
+5
-5
@@ -1,10 +1,10 @@
|
||||
package com.sap.sailing.datamining.data;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sailing.domain.tracking.TrackedLegOfCompetitor;
|
||||
import com.sap.sse.datamining.shared.annotations.Connector;
|
||||
import com.sap.sse.datamining.shared.annotations.Statistic;
|
||||
import com.sap.sse.datamining.shared.data.Unit;
|
||||
import com.sap.sse.datamining.annotations.Connector;
|
||||
import com.sap.sse.datamining.annotations.Statistic;
|
||||
|
||||
public interface HasTrackedLegOfCompetitorContext {
|
||||
|
||||
@@ -16,8 +16,8 @@ public interface HasTrackedLegOfCompetitorContext {
|
||||
@Connector(messageKey="Competitor")
|
||||
public Competitor getCompetitor();
|
||||
|
||||
@Statistic(messageKey="DistanceTraveled", resultUnit=Unit.Meters, resultDecimals=0, ordinal=0)
|
||||
public Double getDistanceTraveled();
|
||||
@Statistic(messageKey="DistanceTraveled", resultDecimals=0, ordinal=0)
|
||||
public Distance getDistanceTraveled();
|
||||
|
||||
@Statistic(messageKey="RankGainsOrLosses", resultDecimals=2, ordinal=1)
|
||||
public Double getRankGainsOrLosses();
|
||||
|
||||
+2
-2
@@ -6,8 +6,8 @@ import com.sap.sailing.domain.base.Fleet;
|
||||
import com.sap.sailing.domain.base.RaceDefinition;
|
||||
import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.tracking.TrackedRace;
|
||||
import com.sap.sse.datamining.shared.annotations.Connector;
|
||||
import com.sap.sse.datamining.shared.annotations.Dimension;
|
||||
import com.sap.sse.datamining.annotations.Connector;
|
||||
import com.sap.sse.datamining.annotations.Dimension;
|
||||
|
||||
public interface HasTrackedRaceContext {
|
||||
|
||||
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
package com.sap.sailing.datamining.impl.components.aggregators;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sailing.domain.common.impl.MeterDistance;
|
||||
import com.sap.sse.datamining.components.AggregationProcessorDefinition;
|
||||
import com.sap.sse.datamining.components.Processor;
|
||||
import com.sap.sse.datamining.impl.components.GroupedDataEntry;
|
||||
import com.sap.sse.datamining.impl.components.SimpleAggregationProcessorDefinition;
|
||||
import com.sap.sse.datamining.impl.components.aggregators.AbstractParallelGroupedDataStoringAggregationProcessor;
|
||||
import com.sap.sse.datamining.shared.GroupKey;
|
||||
|
||||
public class ParallelDistanceAverageAggregationProcessor
|
||||
extends AbstractParallelGroupedDataStoringAggregationProcessor<Distance, Distance> {
|
||||
|
||||
private static final AggregationProcessorDefinition<Distance, Distance> DEFINITION =
|
||||
new SimpleAggregationProcessorDefinition<>(Distance.class, Distance.class, "Average", ParallelDistanceAverageAggregationProcessor.class);
|
||||
|
||||
public static AggregationProcessorDefinition<Distance, Distance> getDefinition() {
|
||||
return DEFINITION;
|
||||
}
|
||||
|
||||
private final ParallelDistanceSumAggregationProcessor sumAggregationProcessor;
|
||||
private final Map<GroupKey, Integer> elementAmountPerKey;
|
||||
|
||||
public ParallelDistanceAverageAggregationProcessor(ExecutorService executor,
|
||||
Collection<Processor<Map<GroupKey, Distance>, ?>> resultReceivers) {
|
||||
super(executor, resultReceivers, "Average");
|
||||
elementAmountPerKey = new HashMap<>();
|
||||
sumAggregationProcessor = new ParallelDistanceSumAggregationProcessor(executor, resultReceivers);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void storeElement(GroupedDataEntry<Distance> element) {
|
||||
incrementElementAmount(element);
|
||||
sumAggregationProcessor.handleElement(element);
|
||||
}
|
||||
|
||||
private void incrementElementAmount(GroupedDataEntry<Distance> element) {
|
||||
GroupKey key = element.getKey();
|
||||
if (!elementAmountPerKey.containsKey(key)) {
|
||||
elementAmountPerKey.put(key, 0);
|
||||
}
|
||||
Integer currentAmount = elementAmountPerKey.get(key);
|
||||
elementAmountPerKey.put(key, currentAmount + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<GroupKey, Distance> aggregateResult() {
|
||||
Map<GroupKey, Distance> result = new HashMap<>();
|
||||
Map<GroupKey, Distance> sumAggregation = sumAggregationProcessor.getResult();
|
||||
for (Entry<GroupKey, Distance> sumAggregationEntry : sumAggregation.entrySet()) {
|
||||
GroupKey key = sumAggregationEntry.getKey();
|
||||
result.put(key, new MeterDistance(sumAggregationEntry.getValue().getMeters() / elementAmountPerKey.get(key).doubleValue()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.sap.sailing.datamining.impl.components.aggregators;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sse.datamining.components.AggregationProcessorDefinition;
|
||||
import com.sap.sse.datamining.components.Processor;
|
||||
import com.sap.sse.datamining.impl.components.SimpleAggregationProcessorDefinition;
|
||||
import com.sap.sse.datamining.impl.components.aggregators.AbstractParallelSingleGroupedValueAggregationProcessor;
|
||||
import com.sap.sse.datamining.shared.GroupKey;
|
||||
|
||||
public class ParallelDistanceMaxAggregationProcessor extends
|
||||
AbstractParallelSingleGroupedValueAggregationProcessor<Distance> {
|
||||
|
||||
private static final AggregationProcessorDefinition<Distance, Distance> DEFINITION =
|
||||
new SimpleAggregationProcessorDefinition<>(Distance.class, Distance.class, "Minimum", ParallelDistanceMaxAggregationProcessor.class);
|
||||
|
||||
public static AggregationProcessorDefinition<Distance, Distance> getDefinition() {
|
||||
return DEFINITION;
|
||||
}
|
||||
|
||||
|
||||
public ParallelDistanceMaxAggregationProcessor(ExecutorService executor,
|
||||
Collection<Processor<Map<GroupKey, Distance>, ?>> resultReceivers) {
|
||||
super(executor, resultReceivers, "Minimum");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Distance compareValuesAndReturnNewResult(Distance currentResult, Distance newValue) {
|
||||
return currentResult.getMeters() >= newValue.getMeters() ? currentResult : newValue;
|
||||
}
|
||||
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
package com.sap.sailing.datamining.impl.components.aggregators;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sailing.domain.common.impl.MeterDistance;
|
||||
import com.sap.sse.datamining.components.AggregationProcessorDefinition;
|
||||
import com.sap.sse.datamining.components.Processor;
|
||||
import com.sap.sse.datamining.impl.components.GroupedDataEntry;
|
||||
import com.sap.sse.datamining.impl.components.SimpleAggregationProcessorDefinition;
|
||||
import com.sap.sse.datamining.impl.components.aggregators.AbstractParallelGroupedDataStoringAggregationProcessor;
|
||||
import com.sap.sse.datamining.shared.GroupKey;
|
||||
|
||||
public class ParallelDistanceMedianAggregationProcessor
|
||||
extends AbstractParallelGroupedDataStoringAggregationProcessor<Distance, Distance> {
|
||||
|
||||
private static final AggregationProcessorDefinition<Distance, Distance> DEFINITION =
|
||||
new SimpleAggregationProcessorDefinition<>(Distance.class, Distance.class, "Median", ParallelDistanceMedianAggregationProcessor.class);
|
||||
|
||||
public static AggregationProcessorDefinition<Distance, Distance> getDefinition() {
|
||||
return DEFINITION;
|
||||
}
|
||||
|
||||
private Map<GroupKey, List<Distance>> groupedValues;
|
||||
|
||||
public ParallelDistanceMedianAggregationProcessor(ExecutorService executor,
|
||||
Collection<Processor<Map<GroupKey, Distance>, ?>> resultReceivers) {
|
||||
super(executor, resultReceivers, "Median");
|
||||
groupedValues = new HashMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void storeElement(GroupedDataEntry<Distance> element) {
|
||||
GroupKey key = element.getKey();
|
||||
if (!groupedValues.containsKey(key)) {
|
||||
groupedValues.put(key, new ArrayList<Distance>());
|
||||
}
|
||||
groupedValues.get(key).add(element.getDataEntry());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<GroupKey, Distance> aggregateResult() {
|
||||
Map<GroupKey, Distance> result = new HashMap<>();
|
||||
for (Entry<GroupKey, List<Distance>> groupedValuesEntry : groupedValues.entrySet()) {
|
||||
result.put(groupedValuesEntry.getKey(), getMedianOf(groupedValuesEntry.getValue()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Distance getMedianOf(List<Distance> values) {
|
||||
Collections.sort(values, new Comparator<Distance>() {
|
||||
@Override
|
||||
public int compare(Distance d1, Distance d2) {
|
||||
return d1.compareTo(d2);
|
||||
}
|
||||
});
|
||||
if (listSizeIsEven(values)) {
|
||||
int index1 = (values.size() / 2) - 1;
|
||||
int index2 = index1 + 1;
|
||||
return new MeterDistance((values.get(index1).getMeters() + values.get(index2).getMeters()) / 2);
|
||||
} else {
|
||||
int index = ((values.size() + 1) / 2) - 1;
|
||||
return values.get(index);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean listSizeIsEven(List<?> values) {
|
||||
return values.size() % 2 == 0;
|
||||
}
|
||||
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.sap.sailing.datamining.impl.components.aggregators;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sse.datamining.components.AggregationProcessorDefinition;
|
||||
import com.sap.sse.datamining.components.Processor;
|
||||
import com.sap.sse.datamining.impl.components.SimpleAggregationProcessorDefinition;
|
||||
import com.sap.sse.datamining.impl.components.aggregators.AbstractParallelSingleGroupedValueAggregationProcessor;
|
||||
import com.sap.sse.datamining.shared.GroupKey;
|
||||
|
||||
public class ParallelDistanceMinAggregationProcessor extends
|
||||
AbstractParallelSingleGroupedValueAggregationProcessor<Distance> {
|
||||
|
||||
private static final AggregationProcessorDefinition<Distance, Distance> DEFINITION =
|
||||
new SimpleAggregationProcessorDefinition<>(Distance.class, Distance.class, "Minimum", ParallelDistanceMinAggregationProcessor.class);
|
||||
|
||||
public static AggregationProcessorDefinition<Distance, Distance> getDefinition() {
|
||||
return DEFINITION;
|
||||
}
|
||||
|
||||
|
||||
public ParallelDistanceMinAggregationProcessor(ExecutorService executor,
|
||||
Collection<Processor<Map<GroupKey, Distance>, ?>> resultReceivers) {
|
||||
super(executor, resultReceivers, "Minimum");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Distance compareValuesAndReturnNewResult(Distance currentResult, Distance newValue) {
|
||||
return currentResult.getMeters() <= newValue.getMeters() ? currentResult : newValue;
|
||||
}
|
||||
|
||||
}
|
||||
+10
-21
@@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import com.sap.sailing.datamining.shared.dto.DistanceDTO;
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sse.datamining.components.AggregationProcessorDefinition;
|
||||
import com.sap.sse.datamining.components.Processor;
|
||||
import com.sap.sse.datamining.impl.components.GroupedDataEntry;
|
||||
@@ -14,45 +14,34 @@ import com.sap.sse.datamining.impl.components.aggregators.AbstractParallelGroupe
|
||||
import com.sap.sse.datamining.shared.GroupKey;
|
||||
|
||||
public class ParallelDistanceSumAggregationProcessor extends
|
||||
AbstractParallelGroupedDataAggregationProcessor<DistanceDTO, DistanceDTO> {
|
||||
AbstractParallelGroupedDataAggregationProcessor<Distance, Distance> {
|
||||
|
||||
private static final AggregationProcessorDefinition<DistanceDTO, DistanceDTO> DEFINITION =
|
||||
new SimpleAggregationProcessorDefinition<>(DistanceDTO.class, DistanceDTO.class, "Sum", ParallelDistanceSumAggregationProcessor.class);
|
||||
private static final AggregationProcessorDefinition<Distance, Distance> DEFINITION =
|
||||
new SimpleAggregationProcessorDefinition<>(Distance.class, Distance.class, "Sum", ParallelDistanceSumAggregationProcessor.class);
|
||||
|
||||
public static AggregationProcessorDefinition<DistanceDTO, DistanceDTO> getDefinition() {
|
||||
public static AggregationProcessorDefinition<Distance, Distance> getDefinition() {
|
||||
return DEFINITION;
|
||||
}
|
||||
|
||||
private final Map<GroupKey, DistanceDTO> results;
|
||||
private final Map<GroupKey, Distance> results;
|
||||
|
||||
public ParallelDistanceSumAggregationProcessor(ExecutorService executor, Collection<Processor<Map<GroupKey, DistanceDTO>, ?>> resultReceivers) {
|
||||
public ParallelDistanceSumAggregationProcessor(ExecutorService executor, Collection<Processor<Map<GroupKey, Distance>, ?>> resultReceivers) {
|
||||
super(executor, resultReceivers, "Sum");
|
||||
results = new HashMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleElement(GroupedDataEntry<DistanceDTO> element) {
|
||||
protected void handleElement(GroupedDataEntry<Distance> element) {
|
||||
GroupKey key = element.getKey();
|
||||
if (!results.containsKey(key)) {
|
||||
results.put(key, element.getDataEntry());
|
||||
} else {
|
||||
results.put(key, add(results.get(key), element.getDataEntry()));
|
||||
results.put(key, results.get(key).add(element.getDataEntry()));
|
||||
}
|
||||
}
|
||||
|
||||
private DistanceDTO add(DistanceDTO distance1, DistanceDTO distance2) {
|
||||
double geographicalMiles = distance1.getGeographicalMiles() + distance2.getGeographicalMiles();
|
||||
double seaMiles = distance1.getSeaMiles() + distance2.getSeaMiles();
|
||||
double nauticalMiles = distance1.getNauticalMiles() + distance2.getNauticalMiles();
|
||||
double meters = distance1.getMeters() + distance2.getMeters();
|
||||
double kilometers = distance1.getKilometers() + distance2.getKilometers();
|
||||
double centralAngleDegree = distance1.getCentralAngleDegree() + distance2.getCentralAngleDegree();
|
||||
double centralAngleRadian = distance1.getCentralAngleRadian() + distance2.getCentralAngleRadian();
|
||||
return new DistanceDTO(geographicalMiles, seaMiles, nauticalMiles, meters, kilometers, centralAngleDegree, centralAngleRadian);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<GroupKey, DistanceDTO> getResult() {
|
||||
protected Map<GroupKey, Distance> getResult() {
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ public class GPSFixWithContext implements HasGPSFixContext {
|
||||
public ClusterDTO getWindStrengthAsBeaufortCluster(Locale locale, ResourceBundleStringMessages stringMessages) {
|
||||
Wind wind = getWind();
|
||||
Cluster<?> cluster = Activator.getWindStrengthInBeaufortClusterGroup().getClusterFor(wind);
|
||||
return new ClusterDTO(cluster.getAsLocalizedString(locale, stringMessages));
|
||||
return new ClusterDTO(cluster.asLocalizedString(locale, stringMessages));
|
||||
}
|
||||
|
||||
private Wind getWind() {
|
||||
|
||||
+14
-14
@@ -4,7 +4,6 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.sap.sailing.datamining.data.HasRaceOfCompetitorContext;
|
||||
import com.sap.sailing.datamining.data.HasTrackedRaceContext;
|
||||
import com.sap.sailing.datamining.shared.dto.DistanceDTO;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.Course;
|
||||
import com.sap.sailing.domain.base.Waypoint;
|
||||
@@ -41,17 +40,13 @@ public class RaceOfCompetitorWithContext implements HasRaceOfCompetitorContext {
|
||||
}
|
||||
|
||||
@Override
|
||||
public DistanceDTO getDistanceToStartLineAtStart() {
|
||||
Distance distance = getTrackedRace().getDistanceToStartLine(getCompetitor(), 0);
|
||||
return new DistanceDTO(distance.getGeographicalMiles(), distance.getSeaMiles(),
|
||||
distance.getNauticalMiles(), distance.getMeters(),
|
||||
distance.getKilometers(), distance.getCentralAngleDeg(),
|
||||
distance.getCentralAngleRad());
|
||||
public Distance getDistanceToStartLineAtStart() {
|
||||
return getTrackedRace().getDistanceToStartLine(getCompetitor(), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Speed getSpeedAtStart() {
|
||||
return getTrackedRace().getSpeed(getCompetitor(), 0);
|
||||
public Speed getSpeedWhenStarting() {
|
||||
return getTrackedRace().getSpeedWhenCrossingStartLine(getCompetitor());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -66,25 +61,30 @@ public class RaceOfCompetitorWithContext implements HasRaceOfCompetitorContext {
|
||||
Competitor competitor = getCompetitor();
|
||||
return Double.valueOf(getTrackedRace().getRank(competitor, getTrackedRace().getMarkPassing(competitor, firstMark).getTimePoint()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumberOfManeuvers() {
|
||||
return getNumberOfTacks() + getNumberOfJibes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getNumberOfTacks() {
|
||||
public int getNumberOfTacks() {
|
||||
return getNumberOf(ManeuverType.TACK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getNumberOfJibes() {
|
||||
public int getNumberOfJibes() {
|
||||
return getNumberOf(ManeuverType.JIBE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getNumberOfPenaltyCircles() {
|
||||
public int getNumberOfPenaltyCircles() {
|
||||
return getNumberOf(ManeuverType.PENALTY_CIRCLE);
|
||||
}
|
||||
|
||||
private Double getNumberOf(ManeuverType maneuverType) {
|
||||
private int getNumberOf(ManeuverType maneuverType) {
|
||||
TrackedRace trackedRace = getTrackedRace();
|
||||
double number = 0;
|
||||
int number = 0;
|
||||
for (Maneuver maneuver : trackedRace.getManeuvers(getCompetitor(), trackedRace.getStartOfRace(), trackedRace.getEndOfTracking(), false)) {
|
||||
if (maneuver.getType() == maneuverType) {
|
||||
number++;
|
||||
|
||||
+3
-2
@@ -3,6 +3,7 @@ package com.sap.sailing.datamining.impl.data;
|
||||
import com.sap.sailing.datamining.data.HasTrackedLegContext;
|
||||
import com.sap.sailing.datamining.data.HasTrackedLegOfCompetitorContext;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sailing.domain.tracking.TrackedLegOfCompetitor;
|
||||
import com.sap.sailing.domain.tracking.TrackedRace;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
@@ -36,9 +37,9 @@ public class TrackedLegOfCompetitorWithContext implements HasTrackedLegOfCompeti
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getDistanceTraveled() {
|
||||
public Distance getDistanceTraveled() {
|
||||
TimePoint timePoint = getTrackedLegContext().getTrackedRaceContext().getTrackedRace().getEndOfTracking();
|
||||
return getTrackedLegOfCompetitor().getDistanceTraveled(timePoint).getMeters();
|
||||
return getTrackedLegOfCompetitor().getDistanceTraveled(timePoint);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
-3
@@ -35,11 +35,11 @@ public class DeclinationServiceTest extends AbstractDeclinationTest {
|
||||
|
||||
@Test
|
||||
public void testDeclinationQueryNotMatchedInStore() throws IOException, ClassNotFoundException, ParseException {
|
||||
Declination result = service.getDeclination(new MillisecondsTimePoint(simpleDateFormat.parse("2016-02-03").getTime()),
|
||||
Declination result = service.getDeclination(new MillisecondsTimePoint(simpleDateFormat.parse("2019-02-03").getTime()),
|
||||
new DegreePosition(51, -5), /* timeoutForOnlineFetchInMilliseconds */ 30000);
|
||||
assertNotNull(result);
|
||||
assertEquals(-2.41498, result.getBearing().getDegrees(), 0.0001);
|
||||
assertEquals(0.15318, result.getAnnualChange().getDegrees(), 0.0001);
|
||||
assertEquals(-1.9565, result.getBearing().getDegrees(), 0.0001);
|
||||
assertEquals(0.15244, result.getAnnualChange().getDegrees(), 0.0001);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
+9
-3
@@ -101,9 +101,15 @@ public class DeclinationServiceImpl implements DeclinationService {
|
||||
private QuadTree<Declination> getYearStore(int year) throws IOException, ParseException {
|
||||
QuadTree<Declination> result = yearStore.get(year);
|
||||
if (result == null) {
|
||||
result = persistentStore.getStoredDeclinations(year);
|
||||
if (result != null) {
|
||||
yearStore.put(year, result);
|
||||
synchronized (this) {
|
||||
// make sure we only trigger one invocation of persistentStore.getStoredDeclinations(year) even for multiple threads
|
||||
result = yearStore.get(year);
|
||||
if (result == null) {
|
||||
result = persistentStore.getStoredDeclinations(year);
|
||||
if (result != null) {
|
||||
yearStore.put(year, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
+7
-2
@@ -89,7 +89,9 @@ public class DeclinationStore {
|
||||
}
|
||||
|
||||
public void writeExternal(Declination record, Writer out) throws IOException {
|
||||
out.write(dateFormatter.format(record.getTimePoint().asDate()));
|
||||
synchronized (dateFormatter) {
|
||||
out.write(dateFormatter.format(record.getTimePoint().asDate()));
|
||||
}
|
||||
out.write("|"+record.getPosition().getLatDeg());
|
||||
out.write("|"+record.getPosition().getLngDeg());
|
||||
out.write("|"+record.getBearing().getDegrees());
|
||||
@@ -103,7 +105,10 @@ public class DeclinationStore {
|
||||
String line = in.readLine();
|
||||
if (line != null && line.length() > 0) {
|
||||
String[] fields = line.split("\\|");
|
||||
TimePoint timePoint = new MillisecondsTimePoint(dateFormatter.parse(fields[0]).getTime());
|
||||
final TimePoint timePoint;
|
||||
synchronized (dateFormatter) {
|
||||
timePoint = new MillisecondsTimePoint(dateFormatter.parse(fields[0]).getTime());
|
||||
}
|
||||
double lat = Double.valueOf(fields[1]);
|
||||
double lng = Double.valueOf(fields[2]);
|
||||
Position position = new DegreePosition(lat, lng);
|
||||
|
||||
@@ -24,6 +24,6 @@ Export-Package: com.sap.sailing.domain.common,
|
||||
com.sap.sailing.domain.common.trackfiles,
|
||||
com.sap.sailing.domain.common.tracking,
|
||||
com.sap.sailing.domain.common.tracking.impl
|
||||
Require-Bundle: com.sap.sse.datamining.shared,
|
||||
com.sap.sse.common,
|
||||
com.sap.sse.security.common
|
||||
Require-Bundle: com.sap.sse.common,
|
||||
com.sap.sse.security.common,
|
||||
com.sap.sse.datamining.annotations;bundle-version="1.0.0"
|
||||
@@ -10,5 +10,5 @@ dependencies {
|
||||
/* local dependencies */
|
||||
compile project(":java:com.sap.sse.common")
|
||||
compile project(":java:com.sap.sse.security.common")
|
||||
compile project(":java:com.sap.sse.datamining.shared")
|
||||
compile project(":java:com.sap.sse.datamining.annotations")
|
||||
}
|
||||
+5
@@ -33,6 +33,11 @@ public abstract class AbstractSpeedImpl implements Speed {
|
||||
public double getKilometersPerHour() {
|
||||
return getKnots() * Mile.METERS_PER_SEA_MILE / 1000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getStatuteMilesPerHour() {
|
||||
return getMetersPerSecond() * 2.2369;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Speed speed) {
|
||||
|
||||
+9
-7
@@ -20,11 +20,13 @@ public enum BoatClassMasterdata {
|
||||
A_CAT ("A-Catamaran", true, 5.49, 2.30, BoatHullType.CATAMARAN, false, "A-Cat", "ACat", "A-Class Catamaran"),
|
||||
ALBIN_EXPRESS ("Albin Express", true, 7.77, 2.50, BoatHullType.MONOHULL, false),
|
||||
ALBIN_BALLAD ("Albin Ballad", true, 9.12, 2.95, BoatHullType.MONOHULL, false),
|
||||
B_ONE ("B/ONE", true, 7.80, 2.49, BoatHullType.MONOHULL, true, "B-ONE"),
|
||||
CANOE_IC ("International Canoe", true, 5.20, 1.01, BoatHullType.MONOHULL, true, "Canoe IC", "Canoe-IC", "IC", "Kanu IC", "International Canoe", "International 10 Sq.m. Sailing Canoe"),
|
||||
CANOE_TAIFUN ("Canoe Taifun", true, 5.20, 1.32, BoatHullType.MONOHULL, false, "Taifun", "Taifun Kanu", "Kanu Taifun"),
|
||||
B_ONE ("B/ONE", true, 7.80, 2.49, BoatHullType.MONOHULL, true, "B-ONE"),
|
||||
CONTENDER ("Contender", true, 4.88, 1.42, BoatHullType.MONOHULL, false),
|
||||
D_ONE ("D-One", true, 4.23, 2.31, BoatHullType.MONOHULL, true, "Devoti D-One", "DOne", "D_One"),
|
||||
DRAGON_INT ("Dragon Int.", true, 8.89, 1.96, BoatHullType.MONOHULL, true, "Drachen", "Dragon"),
|
||||
DYAS("Dyas", true, 7.15, 1.95, BoatHullType.MONOHULL, true),
|
||||
EXTREME_40 ("Extreme 40", false, 12.2, 6.60, BoatHullType.CATAMARAN, true, "Extreme-40", "Extreme40", "ESS40"),
|
||||
D_35 ("D35", false, 10.81, 6.89, BoatHullType.CATAMARAN, false),
|
||||
ELLIOTT_6M ("Elliott 6m", true, 6.0, 2.35, BoatHullType.MONOHULL, true, "Elliott6m"),
|
||||
@@ -32,6 +34,7 @@ public enum BoatClassMasterdata {
|
||||
F_18 ("Formula 18", true, 6.85, 2.25, BoatHullType.CATAMARAN, true, "F18", "F-18"),
|
||||
FARR_30 ("Farr 30", true, 9.42, 3.08, BoatHullType.MONOHULL, true, "F30", "F-30", "Farr-30"),
|
||||
FINN ("Finn", true, 4.50, 1.51, BoatHullType.MONOHULL, false),
|
||||
FLYING_DUTCHMAN ("Flying Dutchman", true, 6.10, 1.80, BoatHullType.MONOHULL, true),
|
||||
FLYING_PHANTOM ("Flying Phantom", true, 5.52, 3.00, BoatHullType.CATAMARAN, true),
|
||||
FOLKBOAT ("Folkboat", true, 7.68, 2.20, BoatHullType.MONOHULL, false, "Folke", "Folkeboot"),
|
||||
FUN ("FUN", true, 7.20, 2.45, BoatHullType.MONOHULL, true, "FUN O.D.", "FUN OD", "Open FUN"),
|
||||
@@ -40,6 +43,7 @@ public enum BoatClassMasterdata {
|
||||
H_BOAT ("H-Boat", true, 8.28, 2.18, BoatHullType.MONOHULL, true, "HB"),
|
||||
HOBIE_TIGER ("Hobie Tiger", true, 5.51, 2.60, BoatHullType.CATAMARAN, true),
|
||||
HOBIE_WILD_CAT ("Hobie Wild Cat", true, 5.49, 2.59, BoatHullType.CATAMARAN, true, "Hobie Wild Cat F18"),
|
||||
INTERNATIONAL_14("International 14", true, 4.27, 1.83, BoatHullType.MONOHULL, true, "I14", "Int.14", "Int14"),
|
||||
J22 ("J/22", true, 6.86, 2.44, BoatHullType.MONOHULL, true, "J22", "J-22"),
|
||||
J24 ("J/24", true, 7.32, 2.67, BoatHullType.MONOHULL, true, "J24", "J-24"),
|
||||
J70 ("J/70", true, 6.93, 2.25, BoatHullType.MONOHULL, true, "J70", "J-70"),
|
||||
@@ -58,24 +62,22 @@ public enum BoatClassMasterdata {
|
||||
NACRA_17 ("Nacra 17", true, 5.25, 2.59, BoatHullType.CATAMARAN, true, "N17", "Nacra-17"),
|
||||
O_JOLLE ("O-Jolle", true, 5.00, 1.66, BoatHullType.MONOHULL, false, "O Jolle", "OJolle", "Olympiajolle"),
|
||||
OK ("OK Dinghy", true, 5.25, 2.59, BoatHullType.MONOHULL, false, "OK-Dinghy", "OK-Jolle", "OK"),
|
||||
OPEN_BIC("O'pen BIC", true, 2.75, 1.14, BoatHullType.MONOHULL, false, "OpenBIC"),
|
||||
OPTIMIST ("Optimist", true, 2.34, 1.07, BoatHullType.MONOHULL, false, "Opti", "Optimist Dinghy"),
|
||||
PIRATE ("Pirate", true, 5.00, 1.61, BoatHullType.MONOHULL, false, "Pirat", "Piraten"),
|
||||
PLATU_25 ("Platu 25", true, 7.53, 2.62, BoatHullType.MONOHULL, true, "Platu", "Platu-25", "PLA", "B25"),
|
||||
PWA ("PWA", true, 5.0, 0.6, BoatHullType.MONOHULL, true, "Professional Windsurfers Association", "PWA World Tour"),
|
||||
RC44 ("RC44", true, 13.35, 2.75, BoatHullType.MONOHULL, true),
|
||||
RS_X ("RS:X", true, 2.86, 0.93, BoatHullType.SURFERBOARD, false, "RS-X", "RSX", "RS:X"),
|
||||
RS_FEVA ("RS Feva", true, 3.64, 1.42, BoatHullType.MONOHULL, true, "RSFeva"),
|
||||
SONAR ("Sonar", true, 7.01, 2.39, BoatHullType.MONOHULL, true),
|
||||
SOLING ("Soling", true, 8.15, 1.91, BoatHullType.MONOHULL, true),
|
||||
STAR ("Star", true, 6.92, 1.74, BoatHullType.MONOHULL, false, "STR"),
|
||||
STREAMLINE ("Streamline", true, 7.15, 2.55, BoatHullType.MONOHULL, true),
|
||||
SWAN_45 ("Swan 45", true, 13.83, 3.91, BoatHullType.MONOHULL, true, "Swan", "Swan-45"),
|
||||
TORNADO ("Tornado Catamaran", true, 6.10, 3.02, BoatHullType.CATAMARAN, true, "Tornado", "Tornado Cat"),
|
||||
TRIAS ("Trias", true, 9.20, 2.12, BoatHullType.MONOHULL, true),
|
||||
X_99 ("X-99", true, 9.96, 2.95, BoatHullType.MONOHULL, true, "X99"),
|
||||
CONTENDER ("Contender", true, 4.88, 1.42, BoatHullType.MONOHULL, false),
|
||||
RC44 ("RC44", true, 13.35, 2.75, BoatHullType.MONOHULL, true),
|
||||
FLYING_DUTCHMAN ("Flying Dutchman", true, 6.10, 1.80, BoatHullType.MONOHULL, true),
|
||||
DYAS("Dyas", true, 7.15, 1.95, BoatHullType.MONOHULL, true),
|
||||
INTERNATIONAL_14("International 14", true, 4.27, 1.83, BoatHullType.MONOHULL, true, "I14", "Int.14", "Int14"),
|
||||
OPEN_BIC("O'pen BIC", true, 2.75, 1.14, BoatHullType.MONOHULL, false, "OpenBIC"),
|
||||
|
||||
// multi-class "boat classes"; to be replaced at some later point in time by something like a RegattaClass
|
||||
ORC ("ORC", true, 13.83, 3.91, BoatHullType.MONOHULL, true),
|
||||
|
||||
@@ -4,4 +4,5 @@ public interface Mile {
|
||||
static double METERS_PER_SEA_MILE = 1852.3;
|
||||
static double METERS_PER_NAUTICAL_MILE = 1852;
|
||||
static double METERS_PER_GEOGRAPHICAL_MILE = 400080. / 216. /* = 40008000/360/60 */;
|
||||
static double METERS_PER_STATUTE_MILE = 1609.344;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.sap.sailing.domain.common;
|
||||
|
||||
import com.sap.sse.datamining.shared.annotations.Connector;
|
||||
import com.sap.sse.datamining.annotations.Connector;
|
||||
|
||||
public interface Moving {
|
||||
@Connector(messageKey="Speed")
|
||||
|
||||
+18
-18
@@ -1,38 +1,38 @@
|
||||
package com.sap.sailing.domain.common;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.common.impl.WindSpeedSteppingWithMaxDistance;
|
||||
import com.sap.sse.common.settings.Settings;
|
||||
import com.sap.sse.common.settings.SerializableSettings;
|
||||
|
||||
public interface PolarSheetGenerationSettings extends Serializable, Settings {
|
||||
public abstract class PolarSheetGenerationSettings extends SerializableSettings {
|
||||
|
||||
Integer getMinimumDataCountPerGraph();
|
||||
private static final long serialVersionUID = 2018523638816898236L;
|
||||
|
||||
double getMinimumWindConfidence();
|
||||
public abstract Integer getMinimumDataCountPerGraph();
|
||||
|
||||
Integer getMinimumDataCountPerAngle();
|
||||
public abstract double getMinimumWindConfidence();
|
||||
|
||||
int getNumberOfHistogramColumns();
|
||||
public abstract Integer getMinimumDataCountPerAngle();
|
||||
|
||||
double getMinimumConfidenceMeasure();
|
||||
public abstract int getNumberOfHistogramColumns();
|
||||
|
||||
boolean useOnlyWindGaugesForWindSpeed();
|
||||
public abstract double getMinimumConfidenceMeasure();
|
||||
|
||||
boolean shouldRemoveOutliers();
|
||||
public abstract boolean useOnlyWindGaugesForWindSpeed();
|
||||
|
||||
double getOutlierDetectionNeighborhoodRadius();
|
||||
public abstract boolean shouldRemoveOutliers();
|
||||
|
||||
double getOutlierMinimumNeighborhoodPct();
|
||||
public abstract double getOutlierDetectionNeighborhoodRadius();
|
||||
|
||||
boolean useOnlyEstimatedForWindDirection();
|
||||
public abstract double getOutlierMinimumNeighborhoodPct();
|
||||
|
||||
WindSpeedSteppingWithMaxDistance getWindSpeedStepping();
|
||||
public abstract boolean useOnlyEstimatedForWindDirection();
|
||||
|
||||
boolean splitByWindgauges();
|
||||
public abstract WindSpeedSteppingWithMaxDistance getWindSpeedStepping();
|
||||
|
||||
boolean areDefault();
|
||||
public abstract boolean splitByWindgauges();
|
||||
|
||||
double getPctOfLeadingCompetitorsToInclude();
|
||||
public abstract boolean areDefault();
|
||||
|
||||
public abstract double getPctOfLeadingCompetitorsToInclude();
|
||||
|
||||
}
|
||||
+1
-1
@@ -3,5 +3,5 @@ package com.sap.sailing.domain.common;
|
||||
public enum ScoringSchemeType {
|
||||
LOW_POINT, HIGH_POINT, HIGH_POINT_ESS_OVERALL, HIGH_POINT_LAST_BREAKS_TIE, HIGH_POINT_FIRST_GETS_TEN,
|
||||
HIGH_POINT_FIRST_GETS_ONE, LOW_POINT_WINNER_GETS_ZERO, HIGH_POINT_WINNER_GETS_SIX, HIGH_POINT_WINNER_GETS_FIVE, HIGH_POINT_WINNER_GETS_EIGHT,
|
||||
HIGH_POINT_WINNER_GETS_EIGHT_AND_INTERPOLATION, HIGH_POINT_FIRST_GETS_TEN_OR_EIGHT
|
||||
HIGH_POINT_WINNER_GETS_EIGHT_AND_INTERPOLATION, HIGH_POINT_FIRST_GETS_TEN_OR_EIGHT, LOW_POINT_WITH_ELIMINATIONS_AND_ROUNDS_WINNER_GETS_07
|
||||
}
|
||||
@@ -4,8 +4,7 @@ import java.io.Serializable;
|
||||
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.datamining.shared.annotations.Statistic;
|
||||
import com.sap.sse.datamining.shared.data.Unit;
|
||||
import com.sap.sse.datamining.annotations.Statistic;
|
||||
|
||||
/**
|
||||
* A speed, convertible in various units of measure. Can be negative.
|
||||
@@ -56,9 +55,14 @@ public interface Speed extends Comparable<Speed>, Serializable {
|
||||
public String toString() {
|
||||
return "0kn";
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getStatuteMilesPerHour() {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
@Statistic(messageKey="", resultDecimals=2, resultUnit=Unit.Knots)
|
||||
@Statistic(messageKey="", resultDecimals=2)
|
||||
double getKnots();
|
||||
|
||||
double getMetersPerSecond();
|
||||
@@ -66,6 +70,8 @@ public interface Speed extends Comparable<Speed>, Serializable {
|
||||
double getKilometersPerHour();
|
||||
|
||||
double getBeaufort();
|
||||
|
||||
double getStatuteMilesPerHour();
|
||||
|
||||
/**
|
||||
* Traveling at this speed starting at time <code>from</code> until time </code>to</code>, how far have we traveled?
|
||||
|
||||
+2
-3
@@ -4,14 +4,13 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.common.PolarSheetGenerationSettings;
|
||||
import com.sap.sse.common.settings.AbstractSettings;
|
||||
|
||||
public class PolarSheetGenerationSettingsImpl extends AbstractSettings implements PolarSheetGenerationSettings {
|
||||
public class PolarSheetGenerationSettingsImpl extends PolarSheetGenerationSettings {
|
||||
|
||||
public static PolarSheetGenerationSettings createStandardPolarSettings() {
|
||||
double[] levels = { 4., 6., 8., 10., 12., 14., 16., 20., 25., 30. };
|
||||
WindSpeedSteppingWithMaxDistance windStepping = new WindSpeedSteppingWithMaxDistance(levels, 2.5);
|
||||
return new PolarSheetGenerationSettingsImpl(50, 0.1, 20, 20, 0.1, true, true, 2, 0.05, true, windStepping,
|
||||
return new PolarSheetGenerationSettingsImpl(50, 0.01, 20, 20, 0.1, true, true, 2, 0.05, true, windStepping,
|
||||
false, 1);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import com.sap.sailing.domain.common.WindSourceType;
|
||||
public class WindSourceWithAdditionalID extends WindSourceImpl {
|
||||
private static final long serialVersionUID = -142955860536561690L;
|
||||
|
||||
private String id;
|
||||
private final String id;
|
||||
|
||||
public WindSourceWithAdditionalID(WindSourceType type, String id) {
|
||||
super(type);
|
||||
|
||||
+46
@@ -39,6 +39,52 @@ public class WindSpeedSteppingWithMaxDistance extends WindSpeedSteppingImpl {
|
||||
public double getMaxDistance() {
|
||||
return maxDistance;
|
||||
}
|
||||
|
||||
public double getHistogramXValue(int numberOfHistogramColumns, double knots) {
|
||||
double minInKnots = getMinValueForIndex(getLevelIndexForValue(knots));
|
||||
double maxInKnots = getMaxValueForIndex(getLevelIndexForValue(knots));
|
||||
double cutMax = maxInKnots - minInKnots;
|
||||
double cutValue = knots - minInKnots;
|
||||
int columnIndex = (int) ((cutValue / cutMax) * numberOfHistogramColumns);
|
||||
return minInKnots + columnIndex * (cutMax / numberOfHistogramColumns) + 0.5 * (cutMax / numberOfHistogramColumns);
|
||||
}
|
||||
|
||||
private double getMinValueForIndex(int levelIndexForValue) {
|
||||
double result;
|
||||
if (levelIndexForValue == 0) {
|
||||
double levelMinusMaxDistance = levels[0] - maxDistance;
|
||||
if (levelMinusMaxDistance > 0) {
|
||||
result = levelMinusMaxDistance;
|
||||
} else {
|
||||
result = 0;
|
||||
}
|
||||
} else {
|
||||
double levelMinusMaxDistance = levels[levelIndexForValue] - maxDistance;
|
||||
double betweenLevels = levels[levelIndexForValue - 1] + ((levels[levelIndexForValue] - levels[levelIndexForValue - 1]) / 2.);
|
||||
if (levelMinusMaxDistance > betweenLevels) {
|
||||
result = levelMinusMaxDistance;
|
||||
} else {
|
||||
result = betweenLevels;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private double getMaxValueForIndex(int levelIndexForValue) {
|
||||
double result;
|
||||
if (levelIndexForValue == levels.length - 1) {
|
||||
result = levels[levelIndexForValue] + maxDistance;
|
||||
} else {
|
||||
double levelPlusMaxDistance = levels[levelIndexForValue] + maxDistance;
|
||||
double betweenLevels = levels[levelIndexForValue] + ((levels[levelIndexForValue + 1] - levels[levelIndexForValue]) / 2.);
|
||||
if (levelPlusMaxDistance < betweenLevels) {
|
||||
result = levelPlusMaxDistance;
|
||||
} else {
|
||||
result = betweenLevels;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
||||
-14
@@ -1258,20 +1258,6 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory {
|
||||
BasicDBObject query = new BasicDBObject();
|
||||
query.put(FieldNames.RACE_LOG_IDENTIFIER.name(), TripleSerializer.serialize(identifier.getIdentifier()));
|
||||
loadRaceLogEvents(result, query);
|
||||
|
||||
// query for events with deprecated identifier format...
|
||||
query.put(FieldNames.RACE_LOG_IDENTIFIER.name(), MongoUtils.escapeDollarAndDot(identifier.getDeprecatedIdentifier()));
|
||||
|
||||
List<RaceLogEvent> eventsToMigrate = loadRaceLogEvents(result, query);
|
||||
if (!eventsToMigrate.isEmpty()) {
|
||||
// ... migrate them...
|
||||
MongoRaceLogStoreVisitor storeVisitor = new MongoRaceLogStoreVisitor(identifier, new MongoObjectFactoryImpl(database, serviceFinderFactory));
|
||||
for (RaceLogEvent event : eventsToMigrate) {
|
||||
event.accept(storeVisitor);
|
||||
}
|
||||
// ... and delete the old ones...
|
||||
database.getCollection(CollectionNames.RACE_LOGS.name()).remove(query);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
// something went wrong during DB access; report, then use empty new race log
|
||||
logger.log(Level.SEVERE, "Error connecting to MongoDB, unable to load recorded race log data. Check MongoDB settings.");
|
||||
|
||||
+19
-11
@@ -79,20 +79,12 @@ public interface RaceLogTrackingAdapter {
|
||||
* @see #pingMark(RaceLog, Mark, GPSFix, RacingEventService) using a random {@link PingDeviceIdentifier}
|
||||
*/
|
||||
void pingMark(RaceLog raceLogToAddTo, Mark mark, GPSFix gpsFix, RacingEventService service);
|
||||
|
||||
|
||||
/**
|
||||
* @see #pingMark(RaceLog, Mark, GPSFix, RacingEventService)
|
||||
*/
|
||||
void pingMark(RegattaLog regattaLogToAddTo, Mark mark, GPSFix gpsFix, RacingEventService service);
|
||||
|
||||
/**
|
||||
* Duplicate the course and competitor registrations in the newest {@link RaceLogCourseDesignChangedEvent} in
|
||||
* {@code from} race log to the {@code to} race logs. The {@link Mark}s and {@link ControlPoint}s are duplicated and
|
||||
* not reused. This also inserts the necessary {@link RaceLogDefineMarkEvent}s into the {@code to} race logs.
|
||||
*/
|
||||
void copyCourseAndCompetitors(RaceLog from, Set<RaceLog> to, SharedDomainFactory baseDomainFactory,
|
||||
RacingEventService service);
|
||||
|
||||
/**
|
||||
* If not yet registered, register the competitors in {@code competitors}, and unregister all already registered
|
||||
* competitors not in {@code competitors}.
|
||||
@@ -107,15 +99,31 @@ public interface RaceLogTrackingAdapter {
|
||||
|
||||
/**
|
||||
* Invite competitors for tracking via the Tracking App by sending out emails.
|
||||
* @throws MailException
|
||||
*
|
||||
* @throws MailException
|
||||
*/
|
||||
void inviteCompetitorsForTrackingViaEmail(Event event, Leaderboard leaderboard,
|
||||
String serverUrlWithoutTrailingSlash, Set<Competitor> competitors, Locale locale) throws MailException;
|
||||
|
||||
/**
|
||||
* Invite buoy tenders for buoy pinging via the Buoy Tender App by sending out emails.
|
||||
* @throws MailException
|
||||
*
|
||||
* @throws MailException
|
||||
*/
|
||||
void inviteBuoyTenderViaEmail(Event event, Leaderboard leaderboard, String serverUrlWithoutTrailingSlash,
|
||||
String emails, Locale locale) throws MailException;
|
||||
|
||||
/**
|
||||
* Duplicate the course in the newest {@link RaceLogCourseDesignChangedEvent} in {@code from} race log to the
|
||||
* {@code to} race logs. The {@link Mark}s and {@link ControlPoint}s are duplicated and not reused. This also
|
||||
* inserts the necessary {@link RaceLogDefineMarkEvent}s into the {@code to} race logs.
|
||||
*/
|
||||
void copyCourse(RaceLog fromRaceLog, Set<RaceLog> toRaceLogs, SharedDomainFactory baseDomainFactory,
|
||||
RacingEventService service);
|
||||
|
||||
/**
|
||||
* Duplicate the competitor registrations from the {@code from} race log to the {@code to} race logs.
|
||||
*/
|
||||
void copyCompetitors(RaceLog from, Set<RaceLog> to,
|
||||
RacingEventService service);
|
||||
}
|
||||
+52
-39
@@ -92,8 +92,8 @@ public class RaceLogTrackingAdapterImpl implements RaceLogTrackingAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceHandle startTracking(RacingEventService service, Leaderboard leaderboard, RaceColumn raceColumn, Fleet fleet)
|
||||
throws NotDenotedForRaceLogTrackingException, Exception {
|
||||
public RaceHandle startTracking(RacingEventService service, Leaderboard leaderboard, RaceColumn raceColumn,
|
||||
Fleet fleet) throws NotDenotedForRaceLogTrackingException, Exception {
|
||||
RaceLog raceLog = raceColumn.getRaceLog(fleet);
|
||||
RaceLogTrackingState raceLogTrackingState = new RaceLogTrackingStateAnalyzer(raceLog).analyze();
|
||||
if (!raceLogTrackingState.isForTracking()) {
|
||||
@@ -189,8 +189,8 @@ public class RaceLogTrackingAdapterImpl implements RaceLogTrackingAdapter {
|
||||
}
|
||||
|
||||
private void revokeAlreadyDefinedMarks(RaceLog raceLog, AbstractLogEventAuthor author) {
|
||||
List<RaceLogEvent> markEvents = new AllEventsOfTypeFinder<>(raceLog, /* only unrevoked */ true, RaceLogDefineMarkEvent.class)
|
||||
.analyze();
|
||||
List<RaceLogEvent> markEvents = new AllEventsOfTypeFinder<>(raceLog, /* only unrevoked */true,
|
||||
RaceLogDefineMarkEvent.class).analyze();
|
||||
for (RaceLogEvent event : markEvents) {
|
||||
try {
|
||||
raceLog.revokeEvent(author, event, "removing mark that was already defined");
|
||||
@@ -201,36 +201,52 @@ public class RaceLogTrackingAdapterImpl implements RaceLogTrackingAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyCourseAndCompetitors(RaceLog fromRaceLog, Set<RaceLog> toRaceLogs,
|
||||
SharedDomainFactory baseDomainFactory, RacingEventService service) {
|
||||
public void copyCourse(RaceLog fromRaceLog, Set<RaceLog> toRaceLogs, SharedDomainFactory baseDomainFactory,
|
||||
RacingEventService service) {
|
||||
CourseBase course = new LastPublishedCourseDesignFinder(fromRaceLog).analyze();
|
||||
final Set<Mark> marks = new HashSet<>();
|
||||
course.getWaypoints().forEach(wp->Util.addAll(wp.getMarks(), marks));
|
||||
final Set<Competitor> competitors = new RegisteredCompetitorsAnalyzer<>(fromRaceLog).analyze();
|
||||
final List<RaceLogEvent> raceLogDeviceMarkMappingEvents = new AllEventsOfTypeFinder<>(fromRaceLog, /* only unrevoked */ true, RaceLogDeviceMarkMappingEvent.class).analyze();
|
||||
if (course != null) {
|
||||
course.getWaypoints().forEach(wp -> Util.addAll(wp.getMarks(), marks));
|
||||
}
|
||||
|
||||
final List<RaceLogEvent> raceLogDeviceMarkMappingEvents = new AllEventsOfTypeFinder<>(fromRaceLog, /*
|
||||
* only
|
||||
* unrevoked
|
||||
*/true,
|
||||
RaceLogDeviceMarkMappingEvent.class).analyze();
|
||||
for (RaceLog toRaceLog : toRaceLogs) {
|
||||
if (course == null || !new RaceLogTrackingStateAnalyzer(toRaceLog).analyze().isForTracking()) {
|
||||
continue;
|
||||
if (new RaceLogTrackingStateAnalyzer(toRaceLog).analyze().isForTracking()) {
|
||||
if (course != null) {
|
||||
CourseBase newCourse = new CourseDataImpl("Copy of \"" + course.getName() + "\"");
|
||||
TimePoint now = MillisecondsTimePoint.now();
|
||||
int i = 0;
|
||||
revokeAlreadyDefinedMarks(toRaceLog, service.getServerAuthor());
|
||||
for (Waypoint oldWaypoint : course.getWaypoints()) {
|
||||
newCourse.addWaypoint(i++, oldWaypoint);
|
||||
}
|
||||
for (Mark mark : marks) {
|
||||
RaceLogEvent event = RaceLogEventFactory.INSTANCE.createDefineMarkEvent(now,
|
||||
service.getServerAuthor(), toRaceLog.getCurrentPassId(), mark);
|
||||
toRaceLog.add(event);
|
||||
}
|
||||
for (RaceLogEvent raceLogDeviceMarkMappingEvent : raceLogDeviceMarkMappingEvents) {
|
||||
toRaceLog.add(raceLogDeviceMarkMappingEvent);
|
||||
}
|
||||
int passId = toRaceLog.getCurrentPassId();
|
||||
RaceLogEvent newCourseEvent = RaceLogEventFactory.INSTANCE.createCourseDesignChangedEvent(now,
|
||||
service.getServerAuthor(), passId, newCourse);
|
||||
toRaceLog.add(newCourseEvent);
|
||||
}
|
||||
|
||||
}
|
||||
CourseBase newCourse = new CourseDataImpl("Copy of \"" + course.getName() + "\"");
|
||||
TimePoint now = MillisecondsTimePoint.now();
|
||||
int i = 0;
|
||||
revokeAlreadyDefinedMarks(toRaceLog, service.getServerAuthor());
|
||||
for (Waypoint oldWaypoint : course.getWaypoints()) {
|
||||
newCourse.addWaypoint(i++, oldWaypoint);
|
||||
}
|
||||
for (Mark mark : marks) {
|
||||
RaceLogEvent event = RaceLogEventFactory.INSTANCE.createDefineMarkEvent(now,
|
||||
service.getServerAuthor(), toRaceLog.getCurrentPassId(), mark);
|
||||
toRaceLog.add(event);
|
||||
}
|
||||
for (RaceLogEvent raceLogDeviceMarkMappingEvent : raceLogDeviceMarkMappingEvents) {
|
||||
toRaceLog.add(raceLogDeviceMarkMappingEvent);
|
||||
}
|
||||
int passId = toRaceLog.getCurrentPassId();
|
||||
RaceLogEvent newCourseEvent = RaceLogEventFactory.INSTANCE.createCourseDesignChangedEvent(now,
|
||||
service.getServerAuthor(), passId, newCourse);
|
||||
toRaceLog.add(newCourseEvent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyCompetitors(RaceLog fromRaceLog, Set<RaceLog> toRaceLogs,
|
||||
RacingEventService service) {
|
||||
final Set<Competitor> competitors = new RegisteredCompetitorsAnalyzer<>(fromRaceLog).analyze();
|
||||
for (RaceLog toRaceLog : toRaceLogs) {
|
||||
registerCompetitors(service, toRaceLog, competitors);
|
||||
}
|
||||
}
|
||||
@@ -263,13 +279,10 @@ public class RaceLogTrackingAdapterImpl implements RaceLogTrackingAdapter {
|
||||
|
||||
@Override
|
||||
public void pingMark(RegattaLog regattaLog, Mark mark, GPSFix gpsFix, RacingEventService service) {
|
||||
pingMark(
|
||||
regattaLog,
|
||||
mark,
|
||||
gpsFix,
|
||||
service,
|
||||
(DeviceIdentifier dev, TimePoint timePoint) -> new RegattaLogDeviceMarkMappingEventImpl(timePoint, service
|
||||
.getServerAuthor(), timePoint, UUID.randomUUID(), mark, dev, timePoint, timePoint), new PingDeviceIdentifierImpl());
|
||||
pingMark(regattaLog, mark, gpsFix, service,
|
||||
(DeviceIdentifier dev, TimePoint timePoint) -> new RegattaLogDeviceMarkMappingEventImpl(timePoint,
|
||||
service.getServerAuthor(), timePoint, UUID.randomUUID(), mark, dev, timePoint, timePoint),
|
||||
new PingDeviceIdentifierImpl());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -415,9 +428,9 @@ public class RaceLogTrackingAdapterImpl implements RaceLogTrackingAdapter {
|
||||
|
||||
String[] emailArray = emails.split(",");
|
||||
String leaderboardName = leaderboard.getName();
|
||||
|
||||
|
||||
String eventId = event.getId().toString();
|
||||
|
||||
|
||||
// http://<host>/buoy-tender/checkin?event_id=<event-id>&leaderboard_name=<leaderboard-name>
|
||||
String url = DeviceMappingConstants.getBuoyTenderInvitationUrl(serverUrlWithoutTrailingSlash, leaderboardName,
|
||||
eventId, NonGwtUrlHelper.INSTANCE);
|
||||
|
||||
@@ -6,9 +6,9 @@ Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Vendor: SAP
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||
Require-Bundle: com.sap.sailing.domain.common,
|
||||
com.sap.sse.datamining.shared,
|
||||
com.sap.sse.common,
|
||||
com.sap.sse.shared.android
|
||||
com.sap.sse.shared.android,
|
||||
com.sap.sse.datamining.annotations;bundle-version="1.0.0"
|
||||
Export-Package: com.sap.sailing.domain.abstractlog,
|
||||
com.sap.sailing.domain.abstractlog.impl,
|
||||
com.sap.sailing.domain.abstractlog.race,
|
||||
|
||||
@@ -10,6 +10,6 @@ dependencies {
|
||||
/* local dependencies */
|
||||
compile project(":java:com.sap.sailing.domain.common")
|
||||
compile project(":java:com.sap.sse.common")
|
||||
compile project(":java:com.sap.sse.datamining.shared")
|
||||
compile project(":java:com.sap.sse.datamining.annotations")
|
||||
compile project(":java:com.sap.sse.shared.android")
|
||||
}
|
||||
+1
-1
@@ -11,7 +11,7 @@ import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
* the event-iterators of the {@code RaceLog} ({@link RaceLog#getUnrevokedEvents()},
|
||||
* {@link RaceLog#getUnrevokedEventsDescending()}).
|
||||
* <p>
|
||||
* The event {@code r} can only successufully revoke {@code e}, if {@code r}'s priority is higher
|
||||
* The event {@code r} can only successfully revoke {@code e}, if {@code r}'s priority is higher
|
||||
* (author prio, timepoint), and if {@code e} is of an event type that implements {@code Revokable}.
|
||||
* @author Fredrik Teschke
|
||||
*
|
||||
|
||||
+11
-5
@@ -123,8 +123,11 @@ extends TrackImpl<EventT> implements AbstractLog<EventT, VisitorT> {
|
||||
try {
|
||||
checkIfSuccessfullyRevokes(revokeEvent);
|
||||
lockForWrite();
|
||||
revokedEventIds.add(revokeEvent.getRevokedEventId());
|
||||
unlockAfterWrite();
|
||||
try {
|
||||
revokedEventIds.add(revokeEvent.getRevokedEventId());
|
||||
} finally {
|
||||
unlockAfterWrite();
|
||||
}
|
||||
} catch (NotRevokableException e) {
|
||||
logger.log(Level.WARNING, e.getMessage());
|
||||
}
|
||||
@@ -133,9 +136,12 @@ extends TrackImpl<EventT> implements AbstractLog<EventT, VisitorT> {
|
||||
|
||||
private void checkIfSuccessfullyRevokes(RevokeEvent<?> revokeEvent) throws NotRevokableException {
|
||||
lockForRead();
|
||||
EventT revokedEvent = getEventById(revokeEvent.getRevokedEventId());
|
||||
unlockAfterRead();
|
||||
|
||||
EventT revokedEvent;
|
||||
try {
|
||||
revokedEvent = getEventById(revokeEvent.getRevokedEventId());
|
||||
} finally {
|
||||
unlockAfterRead();
|
||||
}
|
||||
if (revokedEvent == null) {
|
||||
// it can happen that the event that has been revoked is not yet loaded - as we assume
|
||||
// that race log events never get removed we can safely continue and assume that
|
||||
|
||||
+2
-1
@@ -8,6 +8,7 @@ import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.tracking.impl.TimedComparator;
|
||||
import com.sap.sse.common.Timed;
|
||||
import com.sap.sse.common.Util;
|
||||
|
||||
/**
|
||||
* Comparator sorting by pass, then by {@link AbstractLogEventAuthor}, then by {@link RaceLogEvent#getCreatedAt()}
|
||||
@@ -43,7 +44,7 @@ public class LogEventComparator implements Comparator<Timed>, Serializable {
|
||||
if (result != 0) return result;
|
||||
|
||||
//compare logical timepoints
|
||||
result = e1.getLogicalTimePoint().compareTo(e2.getLogicalTimePoint());
|
||||
result = Util.compareToWithNull(e1.getLogicalTimePoint(), e2.getLogicalTimePoint(), /* nullIsLess */ false);
|
||||
if (result != 0) return result;
|
||||
|
||||
//compare ids
|
||||
|
||||
-2
@@ -12,6 +12,4 @@ public interface SimpleRaceLogIdentifier extends Serializable {
|
||||
String getFleetName();
|
||||
|
||||
Triple<String, String, String> getIdentifier();
|
||||
|
||||
String getDeprecatedIdentifier();
|
||||
}
|
||||
Loaded 100 of 1457 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user