add TrafficSearch provider
This commit is contained in:
@@ -21,6 +21,7 @@ import com.mogo.module.main.service.MogoMainService;
|
||||
import com.mogo.module.media.MediaConstants;
|
||||
import com.mogo.module.push.base.PushUIConstants;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.share.constant.ShareConstants;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
@@ -59,7 +60,7 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
crashSystem.init();
|
||||
//设置debug模式,日志不上传
|
||||
crashSystem.setDebug( BuildConfig.DEBUG );
|
||||
Logger.init( BuildConfig.DEBUG ? LogLevel.DEBUG : LogLevel.OFF );
|
||||
Logger.init( BuildConfig.DEBUG ? LogLevel.VERBOSE : LogLevel.VERBOSE );
|
||||
|
||||
MogoModulePaths.addModule( new MogoModule( PATH_GUIDE_FRAGMENT, PATH_GUIDE_MODULE_NAME ) );
|
||||
MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_AGREEMENT, AuthorizeConstant.PATH_AGREEMENT_MODULE_NAME ) );
|
||||
@@ -74,9 +75,10 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
MogoModulePaths.addModule( new MogoModule( CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME ) );
|
||||
}
|
||||
|
||||
// MogoModulePaths.addBaseModule( new MogoModule( TanluConstants.TAG, TanluConstants.MODEL_NAME ) );
|
||||
MogoModulePaths.addBaseModule( new MogoModule( ShareConstants.TAG, ShareConstants.MODEL_NAME ) );
|
||||
MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_TANLU_API, "TanluApi" ) );
|
||||
MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_SHARE, "ShareControl" ) );
|
||||
MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_TRAFFIC_UPLOAD, "TrafficUpload" ) );
|
||||
|
||||
MogoModulePaths.addModule( new MogoModule( LeftPanelConst.PATH_NAME, LeftPanelConst.MODULE_NAME ) );
|
||||
|
||||
|
||||
501
foudations/mogo-utils/src/main/java/com/mogo/utils/Dispatch.java
Normal file
501
foudations/mogo-utils/src/main/java/com/mogo/utils/Dispatch.java
Normal file
@@ -0,0 +1,501 @@
|
||||
package com.mogo.utils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
public final class Dispatch<T> {
|
||||
|
||||
private static final Dispatch<?> EMPTY = new Dispatch<>();
|
||||
|
||||
private final T value;
|
||||
|
||||
public Dispatch() {
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
private Dispatch(T value) {
|
||||
this.value = requireNonNull(value);
|
||||
}
|
||||
|
||||
private static <T> T requireNonNull(T obj) {
|
||||
if (obj == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
private static <T> Dispatch<T> empty() {
|
||||
Dispatch<T> t = (Dispatch<T>) EMPTY;
|
||||
return t;
|
||||
}
|
||||
|
||||
public static <R> Dispatch<R> of(R value) {
|
||||
return new Dispatch<>(value);
|
||||
}
|
||||
|
||||
public static <T> Dispatch<T> ofNullable(T value) {
|
||||
return value == null ? (Dispatch<T>) empty() : of(value);
|
||||
}
|
||||
|
||||
public static <R> DispatchImpl<R> stream(Collection<R> collection) {
|
||||
return new DispatchImpl<>(new ArrayList<>(collection));
|
||||
}
|
||||
|
||||
public static <R> DispatchImpl<R> stream(R... values) {
|
||||
List<R> list = new ArrayList<>();
|
||||
for (R r : values) {
|
||||
list.add(r);
|
||||
}
|
||||
return new DispatchImpl<>(list);
|
||||
}
|
||||
|
||||
public static <T> DispatchImpl<T> iterate(T seed, final Function<T, T> mapper, int maxSize) {
|
||||
List<T> list = new ArrayList<>();
|
||||
list.add(seed);
|
||||
if (maxSize - 1 > 0) {
|
||||
for (int i = 0, len = maxSize - 1; i < len; i++) {
|
||||
list.add(seed = mapper.apply(seed));
|
||||
}
|
||||
}
|
||||
return new DispatchImpl<>(list);
|
||||
}
|
||||
|
||||
public final T get() {
|
||||
if (value == null) {
|
||||
throw new NoSuchElementException("No value present");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public final boolean isPresent() {
|
||||
return value != null;
|
||||
}
|
||||
|
||||
public final void ifPresent(Consumer<? super T> consumer) {
|
||||
if (value != null) {
|
||||
consumer.accept(value);
|
||||
}
|
||||
}
|
||||
|
||||
public final Dispatch<T> filter(Predicate<? super T> predicate) {
|
||||
requireNonNull(predicate);
|
||||
if (!isPresent()) {
|
||||
return this;
|
||||
} else {
|
||||
return predicate.test(value) ? this : (Dispatch<T>) empty();
|
||||
}
|
||||
}
|
||||
|
||||
public final <U> Dispatch<U> map(Function<? super T, ? extends U> mapper) {
|
||||
requireNonNull(mapper);
|
||||
if (!isPresent()) {
|
||||
return empty();
|
||||
} else {
|
||||
return Dispatch.ofNullable(mapper.apply(value));
|
||||
}
|
||||
}
|
||||
|
||||
public final <U> Dispatch<U> flatMap(Function<? super T, Dispatch<U>> mapper) {
|
||||
requireNonNull(mapper);
|
||||
if (!isPresent()) {
|
||||
return empty();
|
||||
} else {
|
||||
return requireNonNull(mapper.apply(value));
|
||||
}
|
||||
}
|
||||
|
||||
public final T orElse(T other) {
|
||||
return value != null ? value : other;
|
||||
}
|
||||
|
||||
public final T orElseGet(Supplier<? extends T> other) {
|
||||
return value != null ? value : other.get();
|
||||
}
|
||||
|
||||
public final <X extends Throwable> T orElseThrow(Supplier<? extends X> exceptionSupplier) throws X {
|
||||
if (value != null) {
|
||||
return value;
|
||||
} else {
|
||||
throw exceptionSupplier.get();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof Dispatch)) {
|
||||
return false;
|
||||
}
|
||||
Dispatch<?> other = (Dispatch<?>) obj;
|
||||
|
||||
return Objects.equals(value, other.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int hashCode() {
|
||||
return value != null ? value.hashCode() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String toString() {
|
||||
return value != null
|
||||
? String.format("Dispatch[%s]", value)
|
||||
: "Dispatch.empty";
|
||||
}
|
||||
|
||||
|
||||
public final static class DispatchImpl<E> {
|
||||
|
||||
private final List<E> value;
|
||||
|
||||
private DispatchImpl() {
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
private DispatchImpl(List<E> value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public final boolean isPresent() {
|
||||
return value != null;
|
||||
}
|
||||
|
||||
public final DispatchImpl<E> filter(Predicate<? super E> predicate) {
|
||||
requireNonNull(predicate);
|
||||
if (isPresent()) {
|
||||
forEach(e -> {
|
||||
if (!predicate.test(e)) {
|
||||
this.value.remove(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public final <R> DispatchImpl<R> map(Function<? super E, ? extends R> mapper) {
|
||||
requireNonNull(mapper);
|
||||
|
||||
List<R> target = new ArrayList<>();
|
||||
if (isPresent()) {
|
||||
for (E e : value) {
|
||||
target.add(mapper.apply(e));
|
||||
}
|
||||
}
|
||||
return new DispatchImpl<>(target);
|
||||
}
|
||||
|
||||
/**
|
||||
* 多个数组数据源转换成一个数组数据源
|
||||
*
|
||||
* @param mapper
|
||||
* @param <R>
|
||||
* @return
|
||||
*/
|
||||
public final <R> DispatchImpl<R> flatMap(Function<? super E, ? extends DispatchImpl<? extends R>> mapper) {
|
||||
requireNonNull(mapper);
|
||||
|
||||
List<R> dispatchStream = new ArrayList<>();
|
||||
if (isPresent()) {
|
||||
this.forEach(e -> {
|
||||
dispatchStream.addAll(((DispatchImpl<R>) mapper.apply(e)).value);
|
||||
});
|
||||
}
|
||||
return new DispatchImpl<>(dispatchStream);
|
||||
}
|
||||
|
||||
public final DispatchImpl<E> distinct() {
|
||||
List<E> target = new ArrayList<>();
|
||||
if (isPresent()) {
|
||||
for (E e : value) {
|
||||
if (!target.contains(e)) {
|
||||
target.add(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public final DispatchImpl<E> forEach(Consumer<? super E> action) {
|
||||
requireNonNull(action);
|
||||
if (isPresent()) {
|
||||
for (E e : value) {
|
||||
action.accept(e);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public final DispatchImpl<E> forEach(BiConsumer<Integer, E> action) {
|
||||
requireNonNull(action);
|
||||
if (isPresent()) {
|
||||
for (int i = 0, len = value.size(); i < len; i++) {
|
||||
action.accept(i, value.get(i));
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public final DispatchImpl<E> limit(int maxSize) {
|
||||
if (this.isPresent() && maxSize > 0) {
|
||||
return new DispatchImpl<>(this.value.subList(0, maxSize > this.count() ? this.count() : maxSize));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public final DispatchImpl<E> skip(int n) {
|
||||
if (this.isPresent() && n > 0 && n < count()) {
|
||||
return new DispatchImpl<>(this.value.subList(n, this.count()));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public final DispatchImpl<E> peek(Consumer<? super E> action) {
|
||||
if (this.isPresent()) {
|
||||
forEach(action);
|
||||
}
|
||||
forEach(action);
|
||||
return this;
|
||||
}
|
||||
|
||||
public final DispatchImpl<E> sorted() {
|
||||
return sorted(Object::hashCode);
|
||||
}
|
||||
|
||||
public final <R extends Comparable<? super R>> DispatchImpl<E> sorted(Function<E, R> function) {
|
||||
requireNonNull(function);
|
||||
return sorted((Comparator<E> & Serializable) (c1, c2) -> function.apply(c1).compareTo(function.apply(c2)));
|
||||
}
|
||||
|
||||
public final DispatchImpl<E> sorted(Comparator<? super E> comparator) {
|
||||
requireNonNull(comparator);
|
||||
if (isPresent()) {
|
||||
Collections.sort(value, comparator);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public final int count() {
|
||||
if (isPresent()) {
|
||||
return value.size();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public final Dispatch<E> findFirst() {
|
||||
if (isPresent() && value.size() > 0) {
|
||||
return Dispatch.ofNullable(value.get(0));
|
||||
}
|
||||
return Dispatch.empty();
|
||||
}
|
||||
|
||||
public final Dispatch<E> findAny() {
|
||||
if (isPresent() && value.size() > 0) {
|
||||
return Dispatch.ofNullable(value.get(new Random().nextInt(value.size())));
|
||||
}
|
||||
return Dispatch.empty();
|
||||
}
|
||||
|
||||
public final Dispatch<E> findAny(Predicate<E> predicate) {
|
||||
if (isPresent() && value.size() > 0) {
|
||||
for (E e : value) {
|
||||
if (predicate.test(e)) {
|
||||
return Dispatch.ofNullable(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Dispatch.empty();
|
||||
}
|
||||
|
||||
public final E[] toArray() {
|
||||
if (isPresent()) {
|
||||
return (E[]) this.value.toArray();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 输出需要的数据类型
|
||||
*
|
||||
* @param supplier
|
||||
* @param accumulator
|
||||
* @return
|
||||
*/
|
||||
public final <R> R toCollect(Supplier<R> supplier, BiConsumer<R, ? super E> accumulator) {
|
||||
requireNonNull(supplier);
|
||||
requireNonNull(accumulator);
|
||||
R r = supplier.get();
|
||||
forEach(t -> {
|
||||
accumulator.accept(r, t);
|
||||
});
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
public final <R extends Collection> R toCollection(Supplier<R> supplier) {
|
||||
return toCollect(supplier, Collection::add);
|
||||
}
|
||||
|
||||
public final List<E> toList() {
|
||||
return toCollection((Supplier<List<E>>) ArrayList::new);
|
||||
}
|
||||
|
||||
public final Set<E> toSet() {
|
||||
return toCollection((Supplier<Set<E>>) HashSet::new);
|
||||
}
|
||||
|
||||
|
||||
public final <K, U> Map<K, U> toMap(Function<? super E, ? extends K> keyMapper, Function<? super E, ? extends U> valueMapper, BiFunction<U, U, U> mergeFunction, Supplier<Map<K, U>> mapSupplier) {
|
||||
BiConsumer<Map<K, U>, E> accumulator = (map, element) -> {
|
||||
K key = keyMapper.apply(element);
|
||||
U value = valueMapper.apply(element);
|
||||
|
||||
U oldValue = map.get(key);
|
||||
U newValue = (oldValue == null) ? value : mergeFunction.apply(oldValue, value);
|
||||
if (newValue == null) {
|
||||
map.remove(key);
|
||||
} else {
|
||||
map.put(key, newValue);
|
||||
}
|
||||
};
|
||||
return this.toCollect(HashMap::new, accumulator);
|
||||
}
|
||||
|
||||
public final <K, U> Map<K, U> toMap(Function<? super E, ? extends K> keyMapper, Function<? super E, ? extends U> valueMapper, BiFunction<U, U, U> mergeFunction) {
|
||||
return this.toMap(keyMapper, valueMapper, (u, v) -> mergeFunction.apply(u, v), (Supplier<Map<K, U>>) HashMap::new);
|
||||
}
|
||||
|
||||
public final <K, U> Map<K, U> toMap(Function<? super E, ? extends K> keyMapper, Function<? super E, ? extends U> valueMapper) {
|
||||
return this.toMap(keyMapper, valueMapper, (u, v) -> {
|
||||
throw new IllegalStateException(String.format("Duplicate key %s", u));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public final <K> Map<K, List<E>> toGroupingBy(Function<? super E, ? extends K> classifier) {
|
||||
return toGroupingBy(classifier, (Supplier<Map<K, List<E>>>) HashMap::new);
|
||||
}
|
||||
|
||||
public final <K> Map<K, List<E>> toGroupingBy(Function<? super E, ? extends K> classifier, Supplier<Map<K, List<E>>> mapFactory) {
|
||||
|
||||
BiConsumer<Map<K, List<E>>, E> accumulator = (map, element) -> {
|
||||
K key = classifier.apply(element);
|
||||
if (map.containsKey(key)) {
|
||||
List<E> temp = map.get(key);
|
||||
temp.add(element);
|
||||
} else {
|
||||
List<E> list = new ArrayList<>();
|
||||
list.add(element);
|
||||
map.put(key, list);
|
||||
}
|
||||
};
|
||||
return toCollect(mapFactory, accumulator);
|
||||
}
|
||||
|
||||
|
||||
public final E toJoin(BiFunction<E, E, E> biFunction) {
|
||||
requireNonNull(biFunction);
|
||||
BiFunction<E, E, E> temp = (t, u) -> {
|
||||
if (t == null) {
|
||||
return u;
|
||||
} else {
|
||||
return biFunction.apply(t, u);
|
||||
}
|
||||
};
|
||||
E apply = null;
|
||||
if (isPresent()) {
|
||||
for (int i = 0, len = value.size() - 1; i <= len; i++) {
|
||||
apply = temp.apply(apply, value.get(i));
|
||||
}
|
||||
}
|
||||
return apply;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final String toString() {
|
||||
return isPresent() ? value.toString() : super.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public interface Supplier<T> {
|
||||
|
||||
/**
|
||||
* Gets a result.
|
||||
*
|
||||
* @return a result
|
||||
*/
|
||||
T get();
|
||||
}
|
||||
|
||||
public interface BiConsumer<T, U> {
|
||||
|
||||
/**
|
||||
* Performs this operation on the given arguments.
|
||||
*
|
||||
* @param t the first input argument
|
||||
* @param u the second input argument
|
||||
*/
|
||||
void accept(T t, U u);
|
||||
}
|
||||
|
||||
public interface BiFunction<T, U, R> {
|
||||
|
||||
/**
|
||||
* Applies this function to the given arguments.
|
||||
*
|
||||
* @param t the first function argument
|
||||
* @param u the second function argument
|
||||
* @return the function result
|
||||
*/
|
||||
R apply(T t, U u);
|
||||
}
|
||||
|
||||
public interface Consumer<T> {
|
||||
/**
|
||||
* Performs this operation on the given argument.
|
||||
*
|
||||
* @param t the input argument
|
||||
*/
|
||||
void accept(T t);
|
||||
}
|
||||
|
||||
public interface Predicate<T> {
|
||||
/**
|
||||
* Evaluates this predicate on the given argument.
|
||||
*
|
||||
* @param t the input argument
|
||||
* @return {@code true} if the input argument matches the predicate,
|
||||
* otherwise {@code false}
|
||||
*/
|
||||
boolean test(T t);
|
||||
|
||||
}
|
||||
|
||||
public interface Function<T, R> {
|
||||
|
||||
/**
|
||||
* Applies this function to the given argument.
|
||||
*
|
||||
* @param t the function argument
|
||||
* @return the function result
|
||||
*/
|
||||
R apply(T t);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.mogo.map.impl.amap.search;
|
||||
|
||||
import com.amap.api.services.core.LatLonPoint;
|
||||
import com.amap.api.services.traffic.CircleTrafficQuery;
|
||||
import com.amap.api.services.traffic.RoadTrafficQuery;
|
||||
import com.amap.api.services.traffic.TrafficSearch;
|
||||
import com.amap.api.services.traffic.TrafficStatusEvaluation;
|
||||
import com.amap.api.services.traffic.TrafficStatusInfo;
|
||||
import com.amap.api.services.traffic.TrafficStatusResult;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.search.traffic.IMogoTrafficSearch;
|
||||
import com.mogo.map.search.traffic.IMogoTrafficSearchListener;
|
||||
import com.mogo.map.search.traffic.MogoTrafficResult;
|
||||
import com.mogo.map.search.traffic.MogoTrafficStatusEvaluation;
|
||||
import com.mogo.map.search.traffic.MogoTrafficStatusInfo;
|
||||
import com.mogo.utils.Dispatch;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TrafficSearchClient implements IMogoTrafficSearch, TrafficSearch.OnTrafficSearchListener {
|
||||
|
||||
private static final String TAG = "TrafficSearchClient";
|
||||
private static final int DEFAULT_SEARCH_RADIUS = 500;
|
||||
|
||||
private IMogoTrafficSearchListener mListener;
|
||||
private TrafficSearch trafficSearch;
|
||||
|
||||
public TrafficSearchClient() {
|
||||
if (trafficSearch == null) {
|
||||
trafficSearch = new TrafficSearch(AbsMogoApplication.getApp().getApplicationContext());
|
||||
trafficSearch.setTrafficSearchListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void searchTrafficByRoad(String adCode, String roadName) {
|
||||
if (adCode == null || roadName == null) {
|
||||
if (mListener != null) {
|
||||
mListener.onTrafficSearchError("adCode or roadName can not be null");
|
||||
}
|
||||
return;
|
||||
}
|
||||
String formatRoadName = roadName.replace("/", "").replace(",", "");
|
||||
Logger.d(TAG, "searchTrafficByRoad formatRoad : " + formatRoadName);
|
||||
RoadTrafficQuery roadTrafficQuery = new RoadTrafficQuery(formatRoadName, adCode, TrafficSearch.ROAD_LEVEL_NONAME_WAY);
|
||||
try {
|
||||
trafficSearch.loadTrafficByRoadAsyn(roadTrafficQuery);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if (mListener != null) {
|
||||
mListener.onTrafficSearchError(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void searchTrafficByCircleArea(MogoLatLng mogoLatLng, int radius) {
|
||||
if (mogoLatLng == null) {
|
||||
if (mListener != null) {
|
||||
mListener.onTrafficSearchError("adCode or roadName can not be null");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (radius <= 0) {
|
||||
radius = DEFAULT_SEARCH_RADIUS;
|
||||
}
|
||||
CircleTrafficQuery circleTrafficQuery = new CircleTrafficQuery(new LatLonPoint(mogoLatLng.getLat(), mogoLatLng.lon), radius, TrafficSearch.ROAD_LEVEL_NONAME_WAY);
|
||||
Logger.d(TAG, "loadTrafficByCircle circleTrafficQuery : " + circleTrafficQuery.toString());
|
||||
try {
|
||||
trafficSearch.loadTrafficByCircleAsyn(circleTrafficQuery);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if (mListener != null) {
|
||||
mListener.onTrafficSearchError(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTrafficSearchListener(IMogoTrafficSearchListener listener) {
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRoadTrafficSearched(TrafficStatusResult trafficStatusResult, int i) {
|
||||
if (mListener == null) {
|
||||
return;
|
||||
}
|
||||
if (trafficStatusResult != null && i == 1000) {
|
||||
Logger.d(TAG, "onRoadTrafficSearched result : " + GsonUtil.jsonFromObject(trafficStatusResult));
|
||||
long startTime = System.currentTimeMillis();
|
||||
TrafficStatusEvaluation evaluation = trafficStatusResult.getEvaluation();
|
||||
MogoTrafficStatusEvaluation trafficEvaluation = new MogoTrafficStatusEvaluation();
|
||||
trafficEvaluation.setBlocked(evaluation.getBlocked());
|
||||
trafficEvaluation.setCongested(evaluation.getCongested());
|
||||
trafficEvaluation.setDescription(evaluation.getDescription());
|
||||
trafficEvaluation.setExpedite(evaluation.getExpedite());
|
||||
trafficEvaluation.setStatus(evaluation.getStatus());
|
||||
trafficEvaluation.setUnKnown(evaluation.getUnknown());
|
||||
|
||||
List<MogoTrafficStatusInfo> trafficStatusInfoList = new ArrayList<>();
|
||||
List<TrafficStatusInfo> statusInfo = trafficStatusResult.getRoads();
|
||||
Dispatch.stream(statusInfo).forEach(info -> {
|
||||
MogoTrafficStatusInfo mogoTrafficStatusInfo = new MogoTrafficStatusInfo();
|
||||
mogoTrafficStatusInfo.setAngle(info.getAngle());
|
||||
mogoTrafficStatusInfo.setDirection(info.getDirection());
|
||||
mogoTrafficStatusInfo.setLcodes(info.getLcodes());
|
||||
mogoTrafficStatusInfo.setName(info.getName());
|
||||
mogoTrafficStatusInfo.setStatus(info.getStatus());
|
||||
List<MogoLatLng> mogoLatLngs = new ArrayList<>();
|
||||
Dispatch.stream(info.getCoordinates()).forEach(latLonPoint -> mogoLatLngs.add(new MogoLatLng(latLonPoint.getLatitude(), latLonPoint.getLongitude())));
|
||||
mogoTrafficStatusInfo.setMogoLatLngs(mogoLatLngs);
|
||||
trafficStatusInfoList.add(mogoTrafficStatusInfo);
|
||||
});
|
||||
MogoTrafficResult mogoTrafficResult = new MogoTrafficResult();
|
||||
mogoTrafficResult.setDescription(trafficStatusResult.getDescription());
|
||||
mogoTrafficResult.setEvaluation(trafficEvaluation);
|
||||
mogoTrafficResult.setTrafficStatusInfos(trafficStatusInfoList);
|
||||
long endTime = System.currentTimeMillis();
|
||||
Logger.d(TAG, "onRoadTrafficSearched MogoTrafficResult : " + GsonUtil.jsonFromObject(mogoTrafficResult));
|
||||
Logger.d(TAG, "onRoadTrafficSearched countTime : " + (endTime - startTime));
|
||||
mListener.onTrafficSearchInfo(mogoTrafficResult);
|
||||
} else {
|
||||
mListener.onTrafficSearchError("交通态势查询返回 errorCode : " + i + " trafficStatusResult : " + trafficStatusResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,6 +164,7 @@ public class ObjectUtils {
|
||||
location.setAoiName( aLocation.getAoiName() );
|
||||
location.setErrCode( aLocation.getErrorCode() );
|
||||
location.setErrInfo( aLocation.getErrorInfo() );
|
||||
location.setStreet( aLocation.getStreet() );
|
||||
location.setStreetNum( aLocation.getStreetNum() );
|
||||
location.setDescription( aLocation.getDescription() );
|
||||
location.setBuildingId( aLocation.getBuildingId() );
|
||||
|
||||
@@ -24,6 +24,7 @@ public class MogoLocation implements Cloneable, Parcelable {
|
||||
private String aoiName = "";
|
||||
private int errCode = 0;
|
||||
private String errInfo = "";
|
||||
private String street = "";
|
||||
private String streetNum = "";
|
||||
private String description = "";
|
||||
private String buildingId = "";
|
||||
@@ -103,6 +104,14 @@ public class MogoLocation implements Cloneable, Parcelable {
|
||||
this.errInfo = errInfo;
|
||||
}
|
||||
|
||||
public String getStreet() {
|
||||
return street;
|
||||
}
|
||||
|
||||
public void setStreet(String street) {
|
||||
this.street = street;
|
||||
}
|
||||
|
||||
public String getStreetNum() {
|
||||
return streetNum;
|
||||
}
|
||||
@@ -177,6 +186,7 @@ public class MogoLocation implements Cloneable, Parcelable {
|
||||
", aoiName='" + aoiName + '\'' +
|
||||
", errCode=" + errCode +
|
||||
", errInfo='" + errInfo + '\'' +
|
||||
", street='" + street + '\'' +
|
||||
", streetNum='" + streetNum + '\'' +
|
||||
", description='" + description + '\'' +
|
||||
", buildingId='" + buildingId + '\'' +
|
||||
@@ -311,6 +321,7 @@ public class MogoLocation implements Cloneable, Parcelable {
|
||||
dest.writeString( this.aoiName );
|
||||
dest.writeInt( this.errCode );
|
||||
dest.writeString( this.errInfo );
|
||||
dest.writeString( this.street );
|
||||
dest.writeString( this.streetNum );
|
||||
dest.writeString( this.description );
|
||||
dest.writeString( this.buildingId );
|
||||
@@ -340,6 +351,7 @@ public class MogoLocation implements Cloneable, Parcelable {
|
||||
this.aoiName = in.readString();
|
||||
this.errCode = in.readInt();
|
||||
this.errInfo = in.readString();
|
||||
this.street = in.readString();
|
||||
this.streetNum = in.readString();
|
||||
this.description = in.readString();
|
||||
this.buildingId = in.readString();
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.mogo.map.search.traffic;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
|
||||
public interface IMogoTrafficSearch {
|
||||
|
||||
/**
|
||||
* 根据道路名称查询交通态势
|
||||
*
|
||||
* @param adCode 城市code
|
||||
* @param roadName 道路名称
|
||||
*/
|
||||
void searchTrafficByRoad(String adCode,String roadName);
|
||||
|
||||
/**
|
||||
* 根据圆形区域查询交通态势
|
||||
*
|
||||
* @param mogoLatLng 中心点坐标
|
||||
* @param radius 查询半径
|
||||
*/
|
||||
void searchTrafficByCircleArea(MogoLatLng mogoLatLng,int radius);
|
||||
|
||||
/**
|
||||
* 交通态势查询监听
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void registerTrafficSearchListener(IMogoTrafficSearchListener listener);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.mogo.map.search.traffic;
|
||||
|
||||
public interface IMogoTrafficSearchListener {
|
||||
|
||||
void onTrafficSearchInfo(MogoTrafficResult trafficResult);
|
||||
|
||||
void onTrafficSearchError(String errorMsg);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.mogo.map.search.traffic;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MogoTrafficResult {
|
||||
|
||||
//路况描述信息
|
||||
private String description;
|
||||
|
||||
//路况评价信息
|
||||
private MogoTrafficStatusEvaluation evaluation;
|
||||
|
||||
//道路列表
|
||||
private List<MogoTrafficStatusInfo> trafficStatusInfos;
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public MogoTrafficStatusEvaluation getEvaluation() {
|
||||
return evaluation;
|
||||
}
|
||||
|
||||
public void setEvaluation(MogoTrafficStatusEvaluation evaluation) {
|
||||
this.evaluation = evaluation;
|
||||
}
|
||||
|
||||
public List<MogoTrafficStatusInfo> getTrafficStatusInfos() {
|
||||
return trafficStatusInfos;
|
||||
}
|
||||
|
||||
public void setTrafficStatusInfos(List<MogoTrafficStatusInfo> trafficStatusInfos) {
|
||||
this.trafficStatusInfos = trafficStatusInfos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoTrafficResult{" +
|
||||
"description='" + description + '\'' +
|
||||
", evaluation=" + evaluation +
|
||||
", trafficStatusInfos=" + trafficStatusInfos +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.mogo.map.search.traffic;
|
||||
|
||||
//交通态势搜索返回的路况信息
|
||||
public class MogoTrafficStatusEvaluation {
|
||||
|
||||
//拥堵所占百分比
|
||||
private String blocked;
|
||||
|
||||
//缓行所占百分比
|
||||
private String congested;
|
||||
|
||||
//路况描述
|
||||
private String description;
|
||||
|
||||
//畅通所占百分比
|
||||
private String expedite;
|
||||
|
||||
//路况状态
|
||||
private String status;
|
||||
|
||||
//未知路段所占百分比
|
||||
private String unKnown;
|
||||
|
||||
public String getBlocked() {
|
||||
return blocked;
|
||||
}
|
||||
|
||||
public void setBlocked(String blocked) {
|
||||
this.blocked = blocked;
|
||||
}
|
||||
|
||||
public String getCongested() {
|
||||
return congested;
|
||||
}
|
||||
|
||||
public void setCongested(String congested) {
|
||||
this.congested = congested;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getExpedite() {
|
||||
return expedite;
|
||||
}
|
||||
|
||||
public void setExpedite(String expedite) {
|
||||
this.expedite = expedite;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getUnKnown() {
|
||||
return unKnown;
|
||||
}
|
||||
|
||||
public void setUnKnown(String unKnown) {
|
||||
this.unKnown = unKnown;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoTrafficStatusEvaluation{" +
|
||||
"blocked='" + blocked + '\'' +
|
||||
", congested='" + congested + '\'' +
|
||||
", description='" + description + '\'' +
|
||||
", expedite='" + expedite + '\'' +
|
||||
", status='" + status + '\'' +
|
||||
", unKnown='" + unKnown + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.mogo.map.search.traffic;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
//交通态势查询结果返回道路信息
|
||||
public class MogoTrafficStatusInfo {
|
||||
|
||||
//车行角度
|
||||
private int angle;
|
||||
|
||||
//坐标集合
|
||||
private List<MogoLatLng> mogoLatLngs;
|
||||
|
||||
//方向描述
|
||||
private String direction;
|
||||
|
||||
//方向
|
||||
private String lcodes;
|
||||
|
||||
//设置的道路名称
|
||||
private String name;
|
||||
|
||||
//路况状态
|
||||
private String status;
|
||||
|
||||
public int getAngle() {
|
||||
return angle;
|
||||
}
|
||||
|
||||
public void setAngle(int angle) {
|
||||
this.angle = angle;
|
||||
}
|
||||
|
||||
public List<MogoLatLng> getMogoLatLngs() {
|
||||
return mogoLatLngs;
|
||||
}
|
||||
|
||||
public void setMogoLatLngs(List<MogoLatLng> mogoLatLngs) {
|
||||
this.mogoLatLngs = mogoLatLngs;
|
||||
}
|
||||
|
||||
public String getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
public void setDirection(String direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
public String getLcodes() {
|
||||
return lcodes;
|
||||
}
|
||||
|
||||
public void setLcodes(String lcodes) {
|
||||
this.lcodes = lcodes;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoTrafficStatusInfo{" +
|
||||
"angle=" + angle +
|
||||
", mogoLatLngs=" + mogoLatLngs +
|
||||
", direction='" + direction + '\'' +
|
||||
", lcodes='" + lcodes + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
", status='" + status + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import com.mogo.map.impl.amap.search.TrafficSearchClient;
|
||||
import com.mogo.map.search.traffic.IMogoTrafficSearch;
|
||||
import com.mogo.map.search.traffic.IMogoTrafficSearchListener;
|
||||
|
||||
public class MogoTrafficSearch implements IMogoTrafficSearch {
|
||||
|
||||
private IMogoTrafficSearch mDelegate;
|
||||
|
||||
public MogoTrafficSearch() {
|
||||
mDelegate = new TrafficSearchClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void searchTrafficByRoad(String adCode, String roadName) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.searchTrafficByRoad(adCode, roadName);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void searchTrafficByCircleArea(MogoLatLng mogoLatLng, int radius) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.searchTrafficByCircleArea(mogoLatLng, radius);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTrafficSearchListener(IMogoTrafficSearchListener listener) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.registerTrafficSearchListener(listener);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 451 KiB After Width: | Height: | Size: 450 KiB |
@@ -0,0 +1,21 @@
|
||||
package com.mogo.module.share
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.alibaba.android.arouter.facade.template.IProvider
|
||||
import com.mogo.module.share.manager.TrafficUploadManager.Companion.trafficUpload
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.service.share.IMogoTrafficUploadProvider
|
||||
|
||||
@Route( path = MogoServicePaths.PATH_TRAFFIC_UPLOAD )
|
||||
class TrafficUploadProvider :IProvider , IMogoTrafficUploadProvider{
|
||||
|
||||
override fun init(context: Context?) {
|
||||
|
||||
}
|
||||
|
||||
override fun verifyCurrentTrafficStatus() {
|
||||
trafficUpload.verityTrafficStatus()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.mogo.module.share.manager
|
||||
|
||||
import com.mogo.map.MogoLatLng
|
||||
import com.mogo.map.search.traffic.IMogoTrafficSearchListener
|
||||
import com.mogo.map.search.traffic.MogoTrafficResult
|
||||
import com.mogo.module.share.TanluServiceManager
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
class TrafficUploadManager : IMogoTrafficSearchListener {
|
||||
|
||||
companion object {
|
||||
|
||||
const val TAG = "TrafficUploadManager"
|
||||
const val TRAFFIC_SEARCH_AREA = 500
|
||||
|
||||
val trafficUpload by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
TrafficUploadManager()
|
||||
}
|
||||
}
|
||||
|
||||
fun verityTrafficStatus() {
|
||||
val trafficSearchApi = TanluServiceManager.getMapService().trafficSearchApi
|
||||
val location = TanluServiceManager.getLocationClient().lastKnowLocation
|
||||
// val adCode = location.adCode
|
||||
// var street = location.address
|
||||
// if (!location.street.isNullOrEmpty()) {
|
||||
// Logger.d(TAG,"verityTrafficStatus street : $street")
|
||||
// street = location.street
|
||||
// }
|
||||
// Logger.d(TAG,"verityTrafficStatus adCode : $adCode , street : $street")
|
||||
trafficSearchApi.registerTrafficSearchListener(this)
|
||||
// if (!adCode.isNullOrEmpty() && !street.isNullOrEmpty()) {
|
||||
// Logger.d(TAG,"verityTrafficStatus searchTrafficByRoad")
|
||||
// trafficSearchApi.searchTrafficByRoad(adCode, street)
|
||||
// } else {
|
||||
Logger.d(TAG,"verityTrafficStatus searchTrafficByCircleArea")
|
||||
trafficSearchApi.searchTrafficByCircleArea(MogoLatLng(location.latitude, location.longitude), TRAFFIC_SEARCH_AREA)
|
||||
// }
|
||||
}
|
||||
|
||||
override fun onTrafficSearchError(errorMsg: String?) {
|
||||
errorMsg?.let {
|
||||
Logger.d(TAG, "onTrafficSearchError errorMsg : $errorMsg , So drop this verity and track")
|
||||
//todo 打点
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTrafficSearchInfo(trafficResult: MogoTrafficResult?) {
|
||||
//todo Upload 打点
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import com.mogo.service.module.IMogoMarkerService;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.module.IMogoSearchManager;
|
||||
import com.mogo.service.share.IMogoShareManager;
|
||||
import com.mogo.service.share.IMogoTrafficUploadProvider;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.strategy.IMogoOnlineCarListPanelProvider;
|
||||
import com.mogo.service.strategy.IMogoRefreshStrategyController;
|
||||
@@ -72,6 +73,7 @@ public class V2XServiceManager {
|
||||
private static IMogoMarkerService mIMogoMarkerService;
|
||||
private static IMogoShareManager mIMogoShareManager;
|
||||
private static IMogoTanluProvider mIMogoTanluProvider;
|
||||
private static IMogoTrafficUploadProvider mIMogoTrafficUploadProvider;
|
||||
//事件面板
|
||||
private static IEventPanelProvider mIEventPanelProvider;
|
||||
|
||||
@@ -120,6 +122,7 @@ public class V2XServiceManager {
|
||||
mIMogoMarkerService = mMogoServiceApis.getMarkerService();
|
||||
mIMogoShareManager = mMogoServiceApis.getShareManager();
|
||||
mIMogoTanluProvider = mMogoServiceApis.getTanluApi();
|
||||
mIMogoTrafficUploadProvider = mMogoServiceApis.getTrafficUploadApi();
|
||||
mMogoOnlineCarListPanelProvider = mMogoServiceApis.getOnlineCarPanelApi();
|
||||
//事件面板
|
||||
mIEventPanelProvider = mMogoServiceApis.getEventPanelManager();
|
||||
@@ -274,6 +277,9 @@ public class V2XServiceManager {
|
||||
return mIMogoTanluProvider;
|
||||
}
|
||||
|
||||
public static IMogoTrafficUploadProvider getIMogoTrafficUploadProvider(){
|
||||
return mIMogoTrafficUploadProvider;
|
||||
}
|
||||
|
||||
public static IMogoOnlineCarListPanelProvider getMogoOnlineCarListPanelProvider() {
|
||||
return mMogoOnlineCarListPanelProvider;
|
||||
|
||||
@@ -54,6 +54,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
private Button mBtnTriggerParkEvent;
|
||||
private Button mBtnTriggerCallUserInfo;
|
||||
private Button mBtnTriggerEventUgc;
|
||||
private Button mBtnTriggerTrafficSearch;
|
||||
|
||||
public static V2XTestConsoleWindow getInstance(Context context, int showType) {
|
||||
if (mV2XTestConsoleWindow == null) {
|
||||
@@ -101,6 +102,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
mBtnTriggerParkEvent = findViewById(R.id.btnTriggerParkEvent);
|
||||
mBtnTriggerEventUgc = findViewById(R.id.btnTriggerEventUgc);
|
||||
mBtnTriggerCallUserInfo = findViewById(R.id.btnTriggerCallUserInfo);
|
||||
mBtnTriggerTrafficSearch = findViewById(R.id.btnTriggerTrafficSearch);
|
||||
|
||||
switch (showType) {
|
||||
case 0:
|
||||
@@ -214,6 +216,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
||||
});
|
||||
|
||||
mBtnTriggerTrafficSearch.setOnClickListener(v-> V2XServiceManager.getIMogoTrafficUploadProvider().verifyCurrentTrafficStatus());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -165,6 +165,20 @@
|
||||
android:textSize="@dimen/dp_22"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnTriggerTrafficSearch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#3196E2"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="交通状况查询"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/dp_22"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
</com.google.android.flexbox.FlexboxLayout>
|
||||
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.service.obu.IMogoObuManager;
|
||||
import com.mogo.service.passport.IMogoPassportManager;
|
||||
import com.mogo.service.share.IMogoShareManager;
|
||||
import com.mogo.service.share.IMogoTrafficUploadProvider;
|
||||
import com.mogo.service.statusmanager.IMogoMsgCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.strategy.IMogoOnlineCarListPanelProvider;
|
||||
@@ -278,4 +279,10 @@ public interface IMogoServiceApis extends IProvider {
|
||||
* @return
|
||||
*/
|
||||
IMogoOnlineCarListPanelProvider getOnlineCarPanelApi();
|
||||
|
||||
/**
|
||||
* 获取交通状况服务
|
||||
* @return
|
||||
*/
|
||||
IMogoTrafficUploadProvider getTrafficUploadApi();
|
||||
}
|
||||
|
||||
@@ -245,6 +245,12 @@ public class MogoServicePaths {
|
||||
@Deprecated
|
||||
public static final String PATH_STRATEGY_SHARE = "/share/strategy";
|
||||
|
||||
/**
|
||||
* 分享模块中,交通状况服务上报
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String PATH_TRAFFIC_UPLOAD = "/share/traffic";
|
||||
|
||||
/**
|
||||
* 高德地图巡航上报
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.mogo.map.search.inputtips.IMogoInputtipsSearch;
|
||||
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.map.search.traffic.IMogoTrafficSearch;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
|
||||
/**
|
||||
@@ -128,4 +129,11 @@ public interface IMogoMapService extends IProvider {
|
||||
* @return
|
||||
*/
|
||||
IMogoMapViewInstanceHandler getMapViewInstanceHandler();
|
||||
|
||||
/**
|
||||
* 交通态势查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoTrafficSearch getTrafficSearchApi();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.mogo.service.share;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
|
||||
public interface IMogoTrafficUploadProvider extends IProvider {
|
||||
|
||||
/**
|
||||
* 验证当前交通状况并上报
|
||||
*/
|
||||
void verifyCurrentTrafficStatus();
|
||||
}
|
||||
@@ -36,6 +36,7 @@ import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.service.obu.IMogoObuManager;
|
||||
import com.mogo.service.passport.IMogoPassportManager;
|
||||
import com.mogo.service.share.IMogoShareManager;
|
||||
import com.mogo.service.share.IMogoTrafficUploadProvider;
|
||||
import com.mogo.service.statusmanager.IMogoMsgCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.strategy.IMogoOnlineCarListPanelProvider;
|
||||
@@ -238,6 +239,11 @@ public class MogoServiceApis implements IMogoServiceApis {
|
||||
return getApiInstance( IMogoOnlineCarListPanelProvider.class, MogoServicePaths.PATH_ONLINE_CAR_PANEL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoTrafficUploadProvider getTrafficUploadApi() {
|
||||
return getApiInstance(IMogoTrafficUploadProvider.class, MogoServicePaths.PATH_TRAFFIC_UPLOAD);
|
||||
}
|
||||
|
||||
private static < T extends IProvider > T getApiInstance( Class< T > clazz, String path ) {
|
||||
T inst = SingletonsHolder.get( clazz );
|
||||
if ( inst == null ) {
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.mogo.map.MogoNavi;
|
||||
import com.mogo.map.MogoOverlayManager;
|
||||
import com.mogo.map.MogoPoiSearch;
|
||||
import com.mogo.map.MogoRoadSearch;
|
||||
import com.mogo.map.MogoTrafficSearch;
|
||||
import com.mogo.map.listener.IMogoHosListenerRegister;
|
||||
import com.mogo.map.listener.MogoHosListenerRegister;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
@@ -28,6 +29,7 @@ import com.mogo.map.search.inputtips.IMogoInputtipsSearch;
|
||||
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.map.search.traffic.IMogoTrafficSearch;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
@@ -106,6 +108,11 @@ public class MogoMapService implements IMogoMapService {
|
||||
return MogoMapViewInstanceHandler.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoTrafficSearch getTrafficSearchApi() {
|
||||
return new MogoTrafficSearch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user