mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-23 12:33:53 +00:00
Moved map url generation into windhelper
This commit is contained in:
1 parent
785c5ca41e
commit
f677e493b6
2 files changed
+25
-28
No files matched your search
+2
-28
@@ -23,8 +23,6 @@ import com.google.android.gms.location.LocationListener;
|
||||
import com.google.android.gms.location.LocationRequest;
|
||||
import com.google.android.gms.location.LocationServices;
|
||||
import com.sap.sailing.android.shared.logging.ExLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.SimpleRaceLogIdentifier;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.SimpleRaceLogIdentifierImpl;
|
||||
import com.sap.sailing.domain.common.Bearing;
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
import com.sap.sailing.domain.common.SpeedWithBearing;
|
||||
@@ -34,19 +32,14 @@ import com.sap.sailing.domain.common.impl.DegreePosition;
|
||||
import com.sap.sailing.domain.common.impl.KnotSpeedWithBearingImpl;
|
||||
import com.sap.sailing.domain.common.impl.WindImpl;
|
||||
import com.sap.sailing.racecommittee.app.AppConstants;
|
||||
import com.sap.sailing.racecommittee.app.AppPreferences;
|
||||
import com.sap.sailing.racecommittee.app.R;
|
||||
import com.sap.sailing.racecommittee.app.data.DataManager;
|
||||
import com.sap.sailing.racecommittee.app.data.DataStore;
|
||||
import com.sap.sailing.racecommittee.app.domain.ManagedRace;
|
||||
import com.sap.sailing.racecommittee.app.domain.impl.FleetIdentifierImpl;
|
||||
import com.sap.sailing.racecommittee.app.services.polling.RacePositionsPoller;
|
||||
import com.sap.sailing.racecommittee.app.ui.utils.OnRaceUpdatedListener;
|
||||
import com.sap.sailing.racecommittee.app.ui.views.CompassView;
|
||||
import com.sap.sailing.racecommittee.app.ui.views.CompassView.CompassDirectionListener;
|
||||
import com.sap.sailing.racecommittee.app.utils.ThemeHelper;
|
||||
import com.sap.sailing.racecommittee.app.utils.WindHelper;
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
|
||||
import java.text.DateFormat;
|
||||
@@ -65,7 +58,6 @@ public class WindFragment extends BaseFragment
|
||||
|
||||
private final static String TAG = WindFragment.class.getName();
|
||||
private final static String START_MODE = "startMode";
|
||||
private final static String GWT_MAP_AND_WIND_CHART_HTML = "/gwt/EmbeddedMapAndWindChart.html";
|
||||
private final static long ONE_SEC = 1000;
|
||||
private final static long FIVE_SEC = 5000;
|
||||
private final static long EVERY_POSITION_CHANGE = 0;
|
||||
@@ -363,27 +355,9 @@ public class WindFragment extends BaseFragment
|
||||
private boolean loadRaceMap(boolean showWindCharts, boolean showStreamlets, boolean showSimulation, boolean showMapControls) {
|
||||
ManagedRace race = getRace();
|
||||
if (race != null) {
|
||||
|
||||
// get data store for event id
|
||||
DataStore dataStore = DataManager.create(getActivity()).getDataStore();
|
||||
|
||||
// get server base url
|
||||
String serverBaseURL = AppPreferences.on(getActivity()).getServerBaseURL();
|
||||
|
||||
// get simple race log identifier
|
||||
Util.Triple<String, String, String> triple = FleetIdentifierImpl.unescape(race.getId());
|
||||
SimpleRaceLogIdentifier identifier = new SimpleRaceLogIdentifierImpl(triple.getA(), triple.getB(), triple.getC());
|
||||
|
||||
// build complete race map url
|
||||
mMapWebView.loadUrl(serverBaseURL + GWT_MAP_AND_WIND_CHART_HTML +
|
||||
"?regattaLikeName=" + identifier.getRegattaLikeParentName() +
|
||||
"&raceColumnName=" + identifier.getRaceColumnName() +
|
||||
"&fleetName=" + identifier.getFleetName() +
|
||||
"&eventId=" + dataStore.getEventUUID() +
|
||||
"&viewShowWindChart=" + showWindCharts +
|
||||
"&viewShowStreamlets=" + showStreamlets +
|
||||
"&viewShowSimulation=" + showSimulation +
|
||||
"&viewShowMapControls=" + showMapControls);
|
||||
String mapUrl = WindHelper.generateMapURL(getActivity(), race, showWindCharts, showStreamlets, showSimulation, showMapControls);
|
||||
mMapWebView.loadUrl(mapUrl);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
+23
@@ -6,6 +6,8 @@ import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.util.Log;
|
||||
import com.sap.sailing.android.shared.data.http.HttpGetRequest;
|
||||
import com.sap.sailing.android.shared.util.NetworkHelper;
|
||||
import com.sap.sailing.domain.abstractlog.race.SimpleRaceLogIdentifier;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.SimpleRaceLogIdentifierImpl;
|
||||
import com.sap.sailing.racecommittee.app.AppConstants;
|
||||
import com.sap.sailing.racecommittee.app.AppPreferences;
|
||||
import com.sap.sailing.racecommittee.app.data.DataManager;
|
||||
@@ -22,6 +24,7 @@ import java.net.URL;
|
||||
|
||||
public class WindHelper {
|
||||
private static String TAG = WindHelper.class.getName();
|
||||
private final static String GWT_MAP_AND_WIND_CHART_HTML = "/gwt/EmbeddedMapAndWindChart.html";
|
||||
|
||||
public static void isTrackedRace(final Context context, final ManagedRace race){
|
||||
try {
|
||||
@@ -93,4 +96,24 @@ public class WindHelper {
|
||||
}
|
||||
return isTracked;
|
||||
}
|
||||
|
||||
public static String generateMapURL(Context context, ManagedRace race ,boolean showWindCharts, boolean showStreamlets, boolean showSimulation, boolean showMapControls){
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
// get simple race log identifier
|
||||
Util.Triple<String, String, String> triple = FleetIdentifierImpl.unescape(race.getId());
|
||||
SimpleRaceLogIdentifier identifier = new SimpleRaceLogIdentifierImpl(triple.getA(), triple.getB(), triple.getC());
|
||||
|
||||
builder.append(getBaseUrl(context));
|
||||
builder.append(GWT_MAP_AND_WIND_CHART_HTML);
|
||||
builder.append("?regattaLikeName=" + identifier.getRegattaLikeParentName());
|
||||
builder.append("&raceColumnName=" + identifier.getRaceColumnName());
|
||||
builder.append("&fleetName=" + identifier.getFleetName());
|
||||
builder.append("&eventId=" + getEventId(context));
|
||||
builder.append("&viewShowWindChart=" + showWindCharts);
|
||||
builder.append("&viewShowStreamlets=" + showStreamlets);
|
||||
builder.append("&viewShowSimulation=" + showSimulation);
|
||||
builder.append("&viewShowMapControls=" + showMapControls);
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user