[MAP] 高精地图Marker绘制逻辑重构
This commit is contained in:
@@ -1,17 +1,13 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.map.center.CenterLine;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.map.overlay.line.Polyline;
|
||||
import com.mogo.map.overlay.point.Point;
|
||||
import com.mogo.map.overlay.proxy.line.IMapPolylineOverlay;
|
||||
import com.mogo.map.overlay.proxy.point.IMapPointOverlay;
|
||||
import com.mogo.map.road.RoadNameInfo;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo.yycp.api.proto.SocketDownData;
|
||||
|
||||
@@ -37,19 +33,9 @@ public interface IMogoMap {
|
||||
*/
|
||||
IMogoMapUIController getUIController();
|
||||
|
||||
/**
|
||||
* 在地图上添一个图片标记(marker)对象。
|
||||
*
|
||||
* @param tag 标识服务
|
||||
* @param options
|
||||
* @return
|
||||
*/
|
||||
IMogoMarker addMarker(String tag, MogoMarkerOptions options);
|
||||
IMapPointOverlay addPoint(Point.Options options);
|
||||
|
||||
/**
|
||||
* 清除所有marker
|
||||
*/
|
||||
void clearAllMarkers();
|
||||
IMapPolylineOverlay addLine(Polyline.Options options);
|
||||
|
||||
/**
|
||||
* 批量更新锚点位置
|
||||
@@ -80,16 +66,6 @@ public interface IMogoMap {
|
||||
*/
|
||||
void removeMarker(String uuidString);
|
||||
|
||||
/**
|
||||
* 在地图上添一组图片标记(marker)对象,并设置是否改变地图状态以至于所有的marker对象都在当前地图可视区域范围内显示。
|
||||
*
|
||||
* @param tag 标识服务
|
||||
* @param options
|
||||
* @param moveToCenter
|
||||
* @return
|
||||
*/
|
||||
ArrayList<IMogoMarker> addMarkers(String tag, ArrayList<MogoMarkerOptions> options, boolean moveToCenter);
|
||||
|
||||
/**
|
||||
* 从地图上删除所有的overlay(marker,circle,polyline 等对象)。
|
||||
*/
|
||||
@@ -136,14 +112,6 @@ public interface IMogoMap {
|
||||
*/
|
||||
float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK);
|
||||
|
||||
/**
|
||||
* 添加线段
|
||||
*
|
||||
* @param options
|
||||
* @return
|
||||
*/
|
||||
IMogoPolyline addPolyline(MogoPolylineOptions options);
|
||||
|
||||
/**
|
||||
* 获取行驶方向一定长度的中心线
|
||||
*
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.mogo.map.identity;
|
||||
|
||||
import java.util.HashMap;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo.yycp.api.proto.SocketDownData;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-25
|
||||
* <p>
|
||||
* 地图 marker 管理
|
||||
*/
|
||||
public interface IMogoIdentifyManager {
|
||||
|
||||
|
||||
/**
|
||||
* 要移除的感知数据uuid
|
||||
*
|
||||
* @param uuidString
|
||||
*/
|
||||
void removeMarker(String uuidString);
|
||||
|
||||
/**
|
||||
* 批量更新锚点位置
|
||||
*
|
||||
* @param optionsArrayList 锚点集合
|
||||
*/
|
||||
void updateBatchMarkerPosition(HashMap<String, MessagePad.TrackedObject> optionsArrayList);
|
||||
|
||||
/**
|
||||
* 批量更新锚点位置
|
||||
*
|
||||
* @param optionsArrayList 锚点集合
|
||||
*/
|
||||
void updateBatchAiMarkerPosition(HashMap<String, SocketDownData.CloudRoadDataProto> optionsArrayList);
|
||||
|
||||
/**
|
||||
* 添加感知使用到的3d模型
|
||||
*
|
||||
* @param type
|
||||
* @param modelRes
|
||||
*/
|
||||
String addPreVehicleModel(int type, int modelRes);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.mogo.map.marker;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* 自定义 infowindow 适配器
|
||||
*/
|
||||
public interface IMogoInfoWindowAdapter {
|
||||
|
||||
/**
|
||||
* 获取infowindow的布局
|
||||
*
|
||||
* @param marker
|
||||
* @return
|
||||
*/
|
||||
View getInfoWindow( IMogoMarker marker );
|
||||
}
|
||||
@@ -1,218 +0,0 @@
|
||||
package com.mogo.map.marker;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-18
|
||||
* <p>
|
||||
* 地图 marker 抽象
|
||||
*/
|
||||
public interface IMogoMarker {
|
||||
|
||||
/**
|
||||
* 删除当前marker并销毁Marker的图片等资源
|
||||
*/
|
||||
void destroy();
|
||||
|
||||
/**
|
||||
* 删除当前marker。
|
||||
*/
|
||||
void remove();
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的透明度
|
||||
*
|
||||
* @param alpha
|
||||
*/
|
||||
void setAlpha( float alpha );
|
||||
|
||||
/**
|
||||
* 设置 Marker覆盖物的图标
|
||||
*
|
||||
* @param bitmap
|
||||
*/
|
||||
void setIcon( Bitmap bitmap );
|
||||
|
||||
/**
|
||||
* 设置 Marker 的图标集合,相同图案的 icon 的 marker 最好使用同一个 BitmapDescriptor 对象以节省内存空间。
|
||||
*
|
||||
* @param icons
|
||||
*/
|
||||
void setIcons( ArrayList< Bitmap > icons );
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的属性选项类 通过markerOption 给marker设置属性
|
||||
*
|
||||
* @param opt
|
||||
*/
|
||||
void setMarkerOptions( MogoMarkerOptions opt );
|
||||
|
||||
/**
|
||||
* 可以存储业务相关的数据
|
||||
*
|
||||
* @param object
|
||||
*/
|
||||
void setObject( Object object );
|
||||
|
||||
/**
|
||||
* @return 用户设置的 object 对象
|
||||
*/
|
||||
Object getObject();
|
||||
|
||||
/**
|
||||
* 设置位置
|
||||
*
|
||||
* @param lat
|
||||
* @param lng
|
||||
*/
|
||||
void setPosition( double lat, double lng );
|
||||
|
||||
/**
|
||||
* 获取坐标点
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
MogoLatLng getPosition();
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物图片旋转的角度,从正北开始,逆时针计算。
|
||||
*
|
||||
* @param rotate
|
||||
*/
|
||||
void setRotateAngle( float rotate );
|
||||
|
||||
/**
|
||||
* 设置Marker 覆盖物的标题。
|
||||
*
|
||||
* @param title
|
||||
*/
|
||||
void setTitle( String title );
|
||||
|
||||
/**
|
||||
* 设置当前marker在最上面。
|
||||
*/
|
||||
void setToTop();
|
||||
|
||||
/**
|
||||
* 设置 Marker 覆盖物的可见属性。
|
||||
*
|
||||
* @param visible
|
||||
*/
|
||||
void setVisible( boolean visible );
|
||||
|
||||
|
||||
/**
|
||||
* 设置点击事件
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void setOnMarkerClickListener( IMogoMarkerClickListener listener );
|
||||
|
||||
/**
|
||||
* 获取点击事件
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoMarkerClickListener getOnMarkerClickListener();
|
||||
|
||||
/**
|
||||
* 自定义 infowindow 样式接口
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoInfoWindowAdapter getInfoWindowAdapter();
|
||||
|
||||
/**
|
||||
* 是否被销毁
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isDestroyed();
|
||||
|
||||
/**
|
||||
* 设置marker的归属模块
|
||||
*
|
||||
* @param mOwner
|
||||
*/
|
||||
void setOwner( String mOwner );
|
||||
|
||||
/**
|
||||
* 获取marker的归属模块
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getOwner();
|
||||
|
||||
/**
|
||||
* Marker 配置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
MogoMarkerOptions getMogoMarkerOptions();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 缩放动画
|
||||
*
|
||||
* @param fromX
|
||||
* @param toX
|
||||
* @param fromY
|
||||
* @param toY
|
||||
* @param duration
|
||||
* @param interpolator
|
||||
* @param listener
|
||||
*/
|
||||
void startScaleAnimation( float fromX,
|
||||
float toX,
|
||||
float fromY,
|
||||
float toY,
|
||||
int duration,
|
||||
Interpolator interpolator,
|
||||
OnMarkerAnimationListener listener );
|
||||
|
||||
/**
|
||||
* 是否是否可点击
|
||||
*
|
||||
* @param clickable
|
||||
*/
|
||||
void setClickable( boolean clickable );
|
||||
|
||||
|
||||
/**
|
||||
* 设置是否是gps
|
||||
*
|
||||
* @param isGps
|
||||
*/
|
||||
void setGps( boolean isGps );
|
||||
|
||||
/**
|
||||
* 设置3D车模颜色
|
||||
*
|
||||
* @param anchorColor
|
||||
*/
|
||||
default void setAnchorColor( String anchorColor ) {
|
||||
|
||||
}
|
||||
|
||||
default void addDynamicAnchorPosition( MogoLatLng latLng, float angle, long duration ) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 marker 内部使用资源内容 md5
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
default String getMarkerResName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.mogo.map.marker;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
* <p>
|
||||
* marker 点击事件
|
||||
*/
|
||||
public interface IMogoMarkerClickListener {
|
||||
|
||||
/**
|
||||
* 事件是否继续往下传递
|
||||
*
|
||||
* @param marker
|
||||
* @return true - 事件已经处理完毕不继续往下传,否则继续往下传
|
||||
*/
|
||||
default boolean onMarkerClicked(IMogoMarker marker){
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* 地图上静态Marker点击事件传递
|
||||
* @param marker
|
||||
* @return true - 事件已经处理完毕不继续往下传,否则继续往下传
|
||||
*/
|
||||
default boolean onStaticMarkerClicked(IMogoMarker marker){
|
||||
return false;
|
||||
};
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.mogo.map.marker;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
* <p>
|
||||
* 地图操作回调
|
||||
*/
|
||||
public interface IMogoMarkerClickListenerRegister {
|
||||
|
||||
/**
|
||||
* 注册marker回调,各业务模块不用关注
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void registerMarkerClickListener(String tag, IMogoMarkerClickListener listener );
|
||||
|
||||
|
||||
/**
|
||||
* 注销marker回调,各业务模块不需要关注
|
||||
*/
|
||||
void unregisterMarkerClickListener(String tag);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.mogo.map.marker;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-29
|
||||
* <p>
|
||||
* 动态变换 marker 样式接口
|
||||
*/
|
||||
public interface IMogoMarkerIconViewCreator {
|
||||
|
||||
/**
|
||||
* 返回自定义marker样式
|
||||
*
|
||||
* @param marker marker 的数据
|
||||
* @return
|
||||
*/
|
||||
View createView( IMogoMarker marker );
|
||||
}
|
||||
@@ -1,140 +0,0 @@
|
||||
package com.mogo.map.marker;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo.yycp.api.proto.SocketDownData;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-25
|
||||
* <p>
|
||||
* 地图 marker 管理
|
||||
*/
|
||||
public interface IMogoMarkerManager {
|
||||
|
||||
/**
|
||||
* 添加marker
|
||||
*
|
||||
* @param tag 标识调用者
|
||||
* @param options
|
||||
* @return
|
||||
*/
|
||||
IMogoMarker addMarker(String tag, MogoMarkerOptions options);
|
||||
|
||||
/**
|
||||
* 添加多个marker
|
||||
*
|
||||
* @param tag 标识调用者
|
||||
* @param options
|
||||
* @return
|
||||
*/
|
||||
List<IMogoMarker> addMarkers(String tag, ArrayList<MogoMarkerOptions> options, boolean moveToCenter);
|
||||
|
||||
/**
|
||||
* 清除所有marker
|
||||
*/
|
||||
void clearAllMarker();
|
||||
|
||||
/**
|
||||
* 批量更新锚点位置
|
||||
*
|
||||
* @param optionsArrayList 锚点集合
|
||||
*/
|
||||
void updateBatchMarkerPosition(HashMap<String, MessagePad.TrackedObject> optionsArrayList);
|
||||
|
||||
/**
|
||||
* 批量更新锚点位置
|
||||
*
|
||||
* @param optionsArrayList 锚点集合
|
||||
*/
|
||||
void updateBatchAiMarkerPosition(HashMap<String, SocketDownData.CloudRoadDataProto> optionsArrayList);
|
||||
|
||||
/**
|
||||
* 添加感知使用到的3d模型
|
||||
*
|
||||
* @param type
|
||||
* @param modelRes
|
||||
*/
|
||||
String addPreVehicleModel(int type, int modelRes);
|
||||
|
||||
/**
|
||||
* 要移除的感知数据uuid
|
||||
*
|
||||
* @param uuidString
|
||||
*/
|
||||
void removeMarker(String uuidString);
|
||||
|
||||
/**
|
||||
* 移除某一个类型、某个模块的 markers
|
||||
*
|
||||
* @param tag
|
||||
*/
|
||||
void removeMarkers(String tag);
|
||||
|
||||
/**
|
||||
* 移除地图上添加的所有markers
|
||||
*/
|
||||
void removeMarkers();
|
||||
|
||||
/**
|
||||
* 显示地图上添加的所有markers
|
||||
*/
|
||||
void visibleAllMarkers();
|
||||
|
||||
/**
|
||||
* 隐藏地图上添加的所有markers
|
||||
*/
|
||||
void inVisibleAllMarkers();
|
||||
|
||||
/**
|
||||
* 隐藏除了某些类别的所有marker {@link MogoMarkerOptions Owner}
|
||||
*
|
||||
* @param owner
|
||||
*/
|
||||
void inVisibleWithoutMarkers(String... owner); //todo 后续需要把Owner类别统一起来,基类下沉,此接口为临时方案,应该设计为隐藏某一类元素
|
||||
|
||||
/**
|
||||
* 获取某种类型的全部marker。
|
||||
*
|
||||
* @param tag 业务类型
|
||||
* @return
|
||||
*/
|
||||
List<IMogoMarker> getMarkers(String tag);
|
||||
|
||||
/**
|
||||
* 获取所有类型的marker。
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Map<String, List<IMogoMarker>> getAllMarkers();
|
||||
|
||||
/**
|
||||
* 仅保留指定类型的tag
|
||||
*
|
||||
* @param tag 需要保留的类型
|
||||
*/
|
||||
void removeMarkersExcept(String tag);
|
||||
|
||||
/**
|
||||
* 添加搜索路线
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param startPoint 起点
|
||||
* @param endPoint 终点
|
||||
* @param wayPoints 途经点
|
||||
*/
|
||||
void addRouteWay(Context context, MogoLatLng startPoint, MogoLatLng endPoint, List<MogoLatLng> wayPoints);
|
||||
|
||||
/**
|
||||
* 移除添加的导航预测路线
|
||||
*/
|
||||
void removeRouteWayOverlay();
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.mogo.map.marker;
|
||||
|
||||
public class MarkerType {
|
||||
|
||||
public static final String MAP_STATIC = "mapStatic";
|
||||
public static final String MAP_STATIC_TRAFFIC = "trafficcamera";
|
||||
}
|
||||
@@ -1,460 +0,0 @@
|
||||
package com.mogo.map.marker;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.location.Location;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.RawRes;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Observable;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-18
|
||||
* <p>
|
||||
* 地图marker
|
||||
*/
|
||||
public class MogoMarkerOptions extends Observable {
|
||||
|
||||
// marker 唯一标记
|
||||
private String uuid;
|
||||
private int markerType;
|
||||
private double latitude;
|
||||
private double longitude;
|
||||
// 设置 Marker覆盖物 的标题
|
||||
private String title;
|
||||
// 设置 Marker覆盖物的 文字描述
|
||||
private String snippet;
|
||||
// 设置Marker覆盖物的图标。
|
||||
private Bitmap icon;
|
||||
// 设置Marker覆盖物的动画帧图标列表,多张图片模拟gif的效果。
|
||||
private ArrayList< Bitmap > icons;
|
||||
// 设置多少帧刷新一次图片资源,Marker动画的间隔时间,值越小动画越快。
|
||||
private int period = 20;
|
||||
// 设置Marker覆盖物的图片旋转角度,从正北开始,逆时针计算。
|
||||
private float rotate;
|
||||
// 设置Marker覆盖物是否平贴地图。
|
||||
private boolean flat = false;
|
||||
// 设置Marker覆盖物是否可见。
|
||||
private boolean visible = true;
|
||||
// 设置Marker覆盖物的InfoWindow是否允许显示
|
||||
private boolean inifoWindowEnable = true;
|
||||
// 设置Marker覆盖物的透明度
|
||||
private float alpha = 1.0f;
|
||||
|
||||
// 设置Marker覆盖物的缩放
|
||||
private float scale = 1.0f;
|
||||
|
||||
// Marker覆盖物的坐标是否是Gps
|
||||
private boolean isGps = false;
|
||||
|
||||
// Marker覆盖物锚点在水平范围的比例。
|
||||
private float u = 0.5f;
|
||||
// Marker覆盖物锚点垂直范围的比例。
|
||||
private float v = 1f;
|
||||
|
||||
// 设置Marker覆盖物是否可拖拽。
|
||||
private boolean draggable = false;
|
||||
|
||||
// Marker覆盖物的InfoWindow相对X 轴的Marker的偏移
|
||||
private int offsetX = 0;
|
||||
// Marker覆盖物的InfoWindow相对Y 轴的Marker的偏移
|
||||
private int offsetY = 0;
|
||||
|
||||
// 设置Marker覆盖物 zIndex。
|
||||
private int zIndex = 0;
|
||||
// 自定义样式
|
||||
private View mIconView;
|
||||
// marker 归属模块
|
||||
private String mOwner;
|
||||
|
||||
private Object mObject;
|
||||
|
||||
/**
|
||||
* 是否加入marker管理
|
||||
*/
|
||||
private boolean mAutoManager = true;
|
||||
|
||||
private @RawRes
|
||||
int mIcon3DRes = 0;
|
||||
private String mAnchorColor;
|
||||
|
||||
private boolean mIs3DMode = false;
|
||||
|
||||
private boolean mIsControlAngle = false;
|
||||
|
||||
/**
|
||||
* 资源名称,便于缓存重复使用,和mIcon3DRes、mIconView、icon等冲突,需要县设置
|
||||
*/
|
||||
private String mResName;
|
||||
|
||||
/**
|
||||
* 吸附在车道上
|
||||
*/
|
||||
private boolean mMatchOnRoadSide = true;
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public int getMarkerType() {
|
||||
return markerType;
|
||||
}
|
||||
|
||||
public void setMarkerType(int markerType) {
|
||||
this.markerType = markerType;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions matchOnRoadSide(boolean matchOnRoadSide ) {
|
||||
this.mMatchOnRoadSide = matchOnRoadSide;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isMatchOnRoadSide() {
|
||||
return mMatchOnRoadSide;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions resName( String resName ) {
|
||||
this.mResName = resName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getResName() {
|
||||
return mResName;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions controlAngle( boolean controlAngle ) {
|
||||
this.mIsControlAngle = controlAngle;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isControlAngle() {
|
||||
return mIsControlAngle;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions set3DMode( boolean is3DMode ) {
|
||||
mIs3DMode = is3DMode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean is3DMode() {
|
||||
return mIs3DMode;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions position( MogoLatLng latLng ) {
|
||||
if ( latLng != null ) {
|
||||
latitude( latLng.lat );
|
||||
longitude( latLng.lon );
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions position( MogoLocation location ) {
|
||||
if ( location != null ) {
|
||||
latitude( location.getLatitude() );
|
||||
longitude( location.getLongitude() );
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions position( Location location ) {
|
||||
if ( location != null ) {
|
||||
latitude( location.getLatitude() );
|
||||
longitude( location.getLongitude() );
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions latitude( double latitude ) {
|
||||
this.latitude = latitude;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions longitude( double longitude ) {
|
||||
this.longitude = longitude;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions title( String title ) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions snippet( String snippet ) {
|
||||
this.snippet = snippet;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 优先使用icon作为marker资源
|
||||
*
|
||||
* @param icon
|
||||
* @return
|
||||
*/
|
||||
public MogoMarkerOptions icon( Bitmap icon ) {
|
||||
this.icon = icon;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions icons( ArrayList< Bitmap > icons ) {
|
||||
this.icons = icons;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions period( int period ) {
|
||||
this.period = period;
|
||||
if ( this.period < 1 ) {
|
||||
this.period = 1;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions rotate( float rotate ) {
|
||||
this.rotate = rotate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions flat( boolean flat ) {
|
||||
this.flat = flat;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions visible( boolean visible ) {
|
||||
this.visible = visible;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions inifoWindowEnable( boolean inifoWindowEnable ) {
|
||||
this.inifoWindowEnable = inifoWindowEnable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions alpha( float alpha ) {
|
||||
this.alpha = alpha;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions scale( float scale ) {
|
||||
this.scale = scale;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public MogoMarkerOptions gps( boolean gps ) {
|
||||
isGps = gps;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions anchor( float u, float v ) {
|
||||
this.u = u;
|
||||
this.v = v;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions draggable( boolean draggable ) {
|
||||
this.draggable = draggable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions setInfoWindowOffset( int offsetX, int offsetY ) {
|
||||
this.offsetX = offsetX;
|
||||
this.offsetY = offsetY;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions zIndex( int zIndex ) {
|
||||
this.zIndex = zIndex;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions data(Object object ) {
|
||||
this.mObject = object;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义marker图层样式,优先使用 icon {@link #icon(Bitmap)}作为marker资源
|
||||
*
|
||||
* @param iconView
|
||||
* @return
|
||||
*/
|
||||
public MogoMarkerOptions icon( View iconView ) {
|
||||
this.mIconView = iconView;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions owner( String owner ) {
|
||||
this.mOwner = owner;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions icon3DRes( @RawRes int icon3DRes ) {
|
||||
this.mIcon3DRes = icon3DRes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions anchorColor( String anchorColor ) {
|
||||
this.mAnchorColor = anchorColor;
|
||||
return this;
|
||||
}
|
||||
|
||||
public double getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
||||
public double getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public String getSnippet() {
|
||||
return snippet;
|
||||
}
|
||||
|
||||
public Bitmap getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public ArrayList< Bitmap > getIcons() {
|
||||
return icons;
|
||||
}
|
||||
|
||||
public int getPeriod() {
|
||||
return period;
|
||||
}
|
||||
|
||||
public float getRotate() {
|
||||
return rotate;
|
||||
}
|
||||
|
||||
public boolean isFlat() {
|
||||
return flat;
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return visible;
|
||||
}
|
||||
|
||||
public boolean isInifoWindowEnable() {
|
||||
return inifoWindowEnable;
|
||||
}
|
||||
|
||||
public float getAlpha() {
|
||||
return alpha;
|
||||
}
|
||||
|
||||
public float getScale() {
|
||||
return scale;
|
||||
}
|
||||
|
||||
public boolean isGps() {
|
||||
return isGps;
|
||||
}
|
||||
|
||||
public float getU() {
|
||||
return u;
|
||||
}
|
||||
|
||||
public float getV() {
|
||||
return v;
|
||||
}
|
||||
|
||||
public boolean isDraggable() {
|
||||
return draggable;
|
||||
}
|
||||
|
||||
public int getOffsetX() {
|
||||
return offsetX;
|
||||
}
|
||||
|
||||
public int getOffsetY() {
|
||||
return offsetY;
|
||||
}
|
||||
|
||||
public int getzIndex() {
|
||||
return zIndex;
|
||||
}
|
||||
|
||||
public View getIconView() {
|
||||
return mIconView;
|
||||
}
|
||||
|
||||
public String getOwner() {
|
||||
return mOwner;
|
||||
}
|
||||
|
||||
public Object getObject() {
|
||||
return mObject;
|
||||
}
|
||||
|
||||
public boolean isAutoManager() {
|
||||
return mAutoManager;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions autoManager( boolean autoManager ) {
|
||||
this.mAutoManager = autoManager;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getIcon3DRes() {
|
||||
return mIcon3DRes;
|
||||
}
|
||||
|
||||
public String getAnchorColor() {
|
||||
return mAnchorColor;
|
||||
}
|
||||
|
||||
public MogoMarkerOptions setGps(boolean gps) {
|
||||
isGps = gps;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoMarkerOptions{" +
|
||||
"uuid='" + uuid + '\'' +
|
||||
", markerType=" + markerType +
|
||||
", latitude=" + latitude +
|
||||
", longitude=" + longitude +
|
||||
", title='" + title + '\'' +
|
||||
", snippet='" + snippet + '\'' +
|
||||
", icon=" + icon +
|
||||
", icons=" + icons +
|
||||
", period=" + period +
|
||||
", rotate=" + rotate +
|
||||
", flat=" + flat +
|
||||
", visible=" + visible +
|
||||
", inifoWindowEnable=" + inifoWindowEnable +
|
||||
", alpha=" + alpha +
|
||||
", scale=" + scale +
|
||||
", isGps=" + isGps +
|
||||
", u=" + u +
|
||||
", v=" + v +
|
||||
", draggable=" + draggable +
|
||||
", offsetX=" + offsetX +
|
||||
", offsetY=" + offsetY +
|
||||
", zIndex=" + zIndex +
|
||||
", mIconView=" + mIconView +
|
||||
", mOwner='" + mOwner + '\'' +
|
||||
", mObject=" + mObject +
|
||||
", mAutoManager=" + mAutoManager +
|
||||
", mIcon3DRes=" + mIcon3DRes +
|
||||
", mAnchorColor='" + mAnchorColor + '\'' +
|
||||
", mIs3DMode=" + mIs3DMode +
|
||||
", mIsControlAngle=" + mIsControlAngle +
|
||||
", mResName='" + mResName + '\'' +
|
||||
", mMatchOnRoadSide=" + mMatchOnRoadSide +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,176 +0,0 @@
|
||||
package com.mogo.map.marker
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.text.TextUtils
|
||||
import java.util.*
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.function.Consumer
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
*
|
||||
*
|
||||
* 管理地图上的所有marker
|
||||
*/
|
||||
class MogoMarkersHandler private constructor() : IMogoMarkerClickListener,
|
||||
IMogoMarkerClickListenerRegister {
|
||||
|
||||
companion object {
|
||||
val mogoMarkersHandler by lazy(LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
MogoMarkersHandler()
|
||||
}
|
||||
}
|
||||
|
||||
private val mMap: ConcurrentHashMap<String, IMogoMarkerClickListener> = ConcurrentHashMap()
|
||||
private val mServicesMarkers: MutableMap<String, MutableList<IMogoMarker>?> =
|
||||
ConcurrentHashMap()
|
||||
|
||||
override fun registerMarkerClickListener(tag: String, listener: IMogoMarkerClickListener) {
|
||||
if (mMap.containsKey(tag)) {
|
||||
return
|
||||
}
|
||||
mMap[tag] = listener
|
||||
}
|
||||
|
||||
override fun unregisterMarkerClickListener(tag: String) {
|
||||
if (!mMap.containsKey(tag)) {
|
||||
return
|
||||
}
|
||||
mMap.remove(tag)
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Synchronized
|
||||
fun visibleAll() {
|
||||
mServicesMarkers.values.stream()
|
||||
.filter { mogoMarkerList: List<IMogoMarker>? -> mogoMarkerList != null && !mogoMarkerList.isEmpty() }
|
||||
.forEach { mogoMarkerList: List<IMogoMarker>? ->
|
||||
mogoMarkerList!!.forEach(
|
||||
Consumer { mogoMarker: IMogoMarker -> mogoMarker.setVisible(true) })
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Synchronized
|
||||
fun inVisibleAll() {
|
||||
mServicesMarkers.values.stream()
|
||||
.filter { mogoMarkerList: List<IMogoMarker>? -> mogoMarkerList != null && !mogoMarkerList.isEmpty() }
|
||||
.forEach { mogoMarkerList: List<IMogoMarker>? ->
|
||||
mogoMarkerList!!.forEach(
|
||||
Consumer { mogoMarker: IMogoMarker -> mogoMarker.setVisible(false) })
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Synchronized
|
||||
fun inVisibleMarkers(vararg owner: String?) {
|
||||
mServicesMarkers.values.stream()
|
||||
.filter { mogoMarkerList: List<IMogoMarker>? -> mogoMarkerList != null && !mogoMarkerList.isEmpty() }
|
||||
.forEach { mogoMarkerList: List<IMogoMarker>? ->
|
||||
mogoMarkerList!!.forEach(
|
||||
Consumer { mogoMarker: IMogoMarker ->
|
||||
if (TextUtils.isEmpty(mogoMarker.owner)) {
|
||||
mogoMarker.setVisible(false)
|
||||
}
|
||||
if (!Arrays.asList(*owner).contains(mogoMarker.owner)) {
|
||||
mogoMarker.setVisible(false)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun removeAll() {
|
||||
val mogoMarkers: Collection<List<IMogoMarker>?> = mServicesMarkers.values
|
||||
for (mogoMarkerList in mogoMarkers) {
|
||||
if (mogoMarkerList != null && !mogoMarkerList.isEmpty()) {
|
||||
for (mogoMarker in mogoMarkerList) {
|
||||
try {
|
||||
mogoMarker.destroy()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mServicesMarkers.clear()
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun remove(tag: String) {
|
||||
val mogoMarkerList = mServicesMarkers.remove(tag)
|
||||
if (mogoMarkerList != null && !mogoMarkerList.isEmpty()) {
|
||||
for (mogoMarker in mogoMarkerList) {
|
||||
try {
|
||||
mogoMarker.destroy()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
mogoMarkerList.clear()
|
||||
}
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun getMarkers(tag: String): List<IMogoMarker>? {
|
||||
return mServicesMarkers[tag]
|
||||
}
|
||||
|
||||
@get:Synchronized
|
||||
val allMarkers: Map<String, MutableList<IMogoMarker>?>
|
||||
get() = mServicesMarkers
|
||||
|
||||
@Synchronized
|
||||
fun add(tag: String, marker: IMogoMarker?) {
|
||||
if (marker == null) {
|
||||
return
|
||||
}
|
||||
if (mServicesMarkers[tag] == null) {
|
||||
mServicesMarkers[tag] = ArrayList()
|
||||
}
|
||||
mServicesMarkers[tag]!!.add(marker)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun add(tag: String, markers: List<IMogoMarker>?) {
|
||||
if (markers == null || markers.isEmpty()) {
|
||||
return
|
||||
}
|
||||
if (mServicesMarkers[tag] == null) {
|
||||
mServicesMarkers[tag] = ArrayList()
|
||||
}
|
||||
mServicesMarkers[tag]!!.addAll(markers)
|
||||
}
|
||||
|
||||
override fun onMarkerClicked(marker: IMogoMarker): Boolean {
|
||||
val iMogoMarker = mMap[marker.owner]
|
||||
return iMogoMarker?.onMarkerClicked(marker) ?: false
|
||||
}
|
||||
|
||||
override fun onStaticMarkerClicked(marker: IMogoMarker): Boolean {
|
||||
val iMogoMarker = mMap[marker.owner]
|
||||
return iMogoMarker?.onStaticMarkerClicked(marker) ?: false
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tag 需要保留的类型
|
||||
*/
|
||||
fun deleteAllExcept(tag: String) {
|
||||
if (TextUtils.isEmpty(tag)) {
|
||||
return
|
||||
}
|
||||
val mogoMarkerList = mServicesMarkers.remove(tag)
|
||||
for (value in mServicesMarkers.values) {
|
||||
if (value != null && value.isNotEmpty()) {
|
||||
for (mogoMarker in value) {
|
||||
mogoMarker.destroy()
|
||||
}
|
||||
value.clear()
|
||||
}
|
||||
}
|
||||
mServicesMarkers[tag] = mogoMarkerList
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.mogo.map.marker.anim;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-22
|
||||
* <p>
|
||||
* marker 动画监听
|
||||
*/
|
||||
public interface OnMarkerAnimationListener {
|
||||
|
||||
default void onAnimStart() {
|
||||
}
|
||||
|
||||
default void onAnimEnd() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.mogo.map.overlay
|
||||
|
||||
import com.mogo.map.overlay.core.*
|
||||
import com.mogo.map.overlay.line.*
|
||||
import com.mogo.map.overlay.point.*
|
||||
import com.mogo.map.overlay.point.Point.Options as PointOptions
|
||||
import com.mogo.map.overlay.line.Polyline.Options as LineOptions
|
||||
|
||||
interface IMoGoOverlayManager {
|
||||
|
||||
fun showOrUpdatePoint(options: PointOptions): Point?
|
||||
|
||||
fun hidePoint(id: String)
|
||||
|
||||
fun hidePoint(p: Point)
|
||||
|
||||
fun hideAllPointsInOwner(owner: String)
|
||||
|
||||
fun hideAllPointsInLevel(level: Level)
|
||||
|
||||
fun hideAllPoints()
|
||||
|
||||
fun removePoint(id: String)
|
||||
|
||||
fun removePoint(p: Point)
|
||||
|
||||
fun removeAllPointsInOwner(owner: String)
|
||||
|
||||
fun removeAllPointsInLevel(level: Level)
|
||||
|
||||
fun removeAllPoints()
|
||||
|
||||
fun showAllPoints()
|
||||
|
||||
fun showAllPointsInOwner(owner: String)
|
||||
|
||||
fun showAllPointsInLevel(level: Level)
|
||||
|
||||
fun showPoint(id: String)
|
||||
|
||||
fun showOrUpdateLine(options: LineOptions): Polyline?
|
||||
|
||||
fun hideLine(id: String)
|
||||
|
||||
fun hideLine(p: Polyline)
|
||||
|
||||
fun hideAllLinesInOwner(owner: String)
|
||||
|
||||
fun hideAllLinesInLevel(level: Level)
|
||||
|
||||
fun hideAllLines()
|
||||
|
||||
fun removeLine(id: String)
|
||||
|
||||
fun removeLine(p: Polyline)
|
||||
|
||||
fun removeAllLinesInOwner(owner: String)
|
||||
|
||||
fun removeAllLinesInLevel(level: Level)
|
||||
|
||||
fun removeAllLines()
|
||||
|
||||
fun showAllLines()
|
||||
|
||||
fun showAllLinesInOwner(owner: String)
|
||||
|
||||
fun showAllLinesInLevel(level: Level)
|
||||
|
||||
fun showLine(id: String)
|
||||
|
||||
fun hideAllPointsExceptIds(vararg ids: String)
|
||||
|
||||
fun hideAllPointsExceptOwners(vararg owners: String)
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.mogo.map.overlay;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-10
|
||||
* <p>
|
||||
* 覆盖物
|
||||
*/
|
||||
public interface IMogoOverlayManager {
|
||||
|
||||
/**
|
||||
* 绘制线段
|
||||
*
|
||||
* @param options
|
||||
* @return
|
||||
*/
|
||||
IMogoPolyline addPolyline( MogoPolylineOptions options );
|
||||
}
|
||||
@@ -1,144 +0,0 @@
|
||||
package com.mogo.map.overlay;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
|
||||
import com.mogo.map.IDestroyable;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-10
|
||||
* <p>
|
||||
* 线段
|
||||
*/
|
||||
public interface IMogoPolyline extends IDestroyable {
|
||||
|
||||
|
||||
/**
|
||||
* 是否已经销毁
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isDestroyed();
|
||||
|
||||
/**
|
||||
* 移除
|
||||
*/
|
||||
void remove();
|
||||
|
||||
/**
|
||||
* 获取ID
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getId();
|
||||
|
||||
/**
|
||||
* 设置绘制点数据
|
||||
*
|
||||
* @param lonLats
|
||||
*/
|
||||
void setPoints( List< MogoLatLng > lonLats );
|
||||
|
||||
/**
|
||||
* 获取点
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List< MogoLatLng > getPoints();
|
||||
|
||||
/**
|
||||
* 测地线
|
||||
*
|
||||
* @param draw
|
||||
*/
|
||||
void setGeodesic( boolean draw );
|
||||
|
||||
/**
|
||||
* 是否设置了测地线
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isGeodesic();
|
||||
|
||||
/**
|
||||
* 虚线
|
||||
*
|
||||
* @param dottedLine
|
||||
*/
|
||||
void setDottedLine( boolean dottedLine );
|
||||
|
||||
/**
|
||||
* 是否是虚线
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isDottedLine();
|
||||
|
||||
/**
|
||||
* 设置线宽
|
||||
*
|
||||
* @param width
|
||||
*/
|
||||
void setWidth( float width );
|
||||
|
||||
/**
|
||||
* 获取线宽
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
float getWidth();
|
||||
|
||||
/**
|
||||
* 设置线条颜色
|
||||
*
|
||||
* @param color
|
||||
*/
|
||||
void setColor( @ColorInt int color );
|
||||
|
||||
/**
|
||||
* 获取线条颜色
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ColorInt
|
||||
int getColor();
|
||||
|
||||
/**
|
||||
* 设置Z轴
|
||||
*/
|
||||
void setZIndex( float zIndex );
|
||||
|
||||
/**
|
||||
* 获取Z轴
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
float getZIndex();
|
||||
|
||||
/**
|
||||
* 设置显示/隐藏
|
||||
*/
|
||||
void setVisible( boolean visible );
|
||||
|
||||
/**
|
||||
* 是否可见
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isVisible();
|
||||
|
||||
/**
|
||||
* 设置透明度
|
||||
*
|
||||
* @param transparency
|
||||
*/
|
||||
void setTransparency( float transparency );
|
||||
|
||||
/**
|
||||
* 设置配置项
|
||||
*/
|
||||
void setOption( MogoPolylineOptions option );
|
||||
}
|
||||
@@ -1,288 +0,0 @@
|
||||
package com.mogo.map.overlay;
|
||||
|
||||
import android.graphics.Color;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-10
|
||||
* <p>
|
||||
* 线段属性
|
||||
*/
|
||||
public class MogoPolylineOptions {
|
||||
|
||||
public boolean useFacade = false;
|
||||
public float maxIndex = Float.MIN_VALUE;
|
||||
private List<MogoLatLng> mPoints;
|
||||
private float mWidth = 10.0F;
|
||||
private int mColor = Color.BLACK;
|
||||
private float mZIndex = 0.0F;
|
||||
private boolean mIsVisible = true;
|
||||
private boolean mIsGeodesic = false;
|
||||
private boolean mIsDottedLine = false;
|
||||
private boolean mIsGradient = false;
|
||||
private float mTransparency = 1.0F;
|
||||
private boolean mIsAboveMaskLayer = false;
|
||||
private boolean mIsPointsUpdated = false;
|
||||
private boolean mGps = false;
|
||||
private List<Integer> mColorValues;
|
||||
|
||||
private float brightSpeed = Float.MIN_VALUE;
|
||||
|
||||
private int brightColor = -1;
|
||||
|
||||
private boolean isBrightOn = false;
|
||||
|
||||
public MogoPolylineOptions() {
|
||||
this.mPoints = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置顶点
|
||||
*
|
||||
* @param points
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions points(List<MogoLatLng> points) {
|
||||
this.mPoints.clear();
|
||||
this.mPoints.addAll(points);
|
||||
this.mIsPointsUpdated = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加顶点到集合最后
|
||||
*
|
||||
* @param points
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions add(MogoLatLng... points) {
|
||||
if (points != null) {
|
||||
this.mPoints.addAll(Arrays.asList(points));
|
||||
this.mIsPointsUpdated = true;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoPolylineOptions add(double lon, double lat) {
|
||||
this.mPoints.add(new MogoLatLng(lat, lon));
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoPolylineOptions add(MogoLocation location) {
|
||||
if (location != null) {
|
||||
this.mPoints.add(new MogoLatLng(location.getLatitude(), location.getLongitude()));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置线宽
|
||||
*/
|
||||
public MogoPolylineOptions width(float width) {
|
||||
this.mWidth = width;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置线的颜色
|
||||
*
|
||||
* @param color
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions color(@ColorInt int color) {
|
||||
this.mColor = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置Z轴的值
|
||||
*
|
||||
* @param zIndex
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions zIndex(float zIndex) {
|
||||
this.mZIndex = zIndex;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否可见
|
||||
*
|
||||
* @param isVisible
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions visible(boolean isVisible) {
|
||||
this.mIsVisible = isVisible;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否绘制测地线
|
||||
*
|
||||
* @param isGeodesic
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions geodesic(boolean isGeodesic) {
|
||||
this.mIsGeodesic = isGeodesic;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是虚线
|
||||
*
|
||||
* @param isDottedLine
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions dottedLine(boolean isDottedLine) {
|
||||
this.mIsDottedLine = isDottedLine;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否使用渐变色
|
||||
*
|
||||
* @param isGradient
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions useGradient(boolean isGradient) {
|
||||
this.mIsGradient = isGradient;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoPolylineOptions maxIndex(float maxIndex) {
|
||||
this.maxIndex = maxIndex;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置透明度
|
||||
*
|
||||
* @param transparency
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions transparency(float transparency) {
|
||||
this.mTransparency = transparency;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoPolylineOptions brightSpeed(float speed) {
|
||||
this.brightSpeed = speed;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoPolylineOptions openBright(boolean on) {
|
||||
this.isBrightOn = on;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoPolylineOptions brightColor(int color) {
|
||||
this.brightColor = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoPolylineOptions useFacade(boolean useFacade) {
|
||||
this.useFacade = useFacade;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param isAboveMaskLayer
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions aboveMaskLayer(boolean isAboveMaskLayer) {
|
||||
this.mIsAboveMaskLayer = isAboveMaskLayer;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param colors
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions colorValues(List<Integer> colors) {
|
||||
mColorValues = colors;
|
||||
return this;
|
||||
}
|
||||
public boolean gps() {
|
||||
return mGps;
|
||||
}
|
||||
|
||||
public MogoPolylineOptions setGps(boolean gps) {
|
||||
mGps = gps;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<MogoLatLng> getPoints() {
|
||||
return mPoints;
|
||||
}
|
||||
|
||||
public float getWidth() {
|
||||
return mWidth;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return mColor;
|
||||
}
|
||||
|
||||
public float getZIndex() {
|
||||
return mZIndex;
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return mIsVisible;
|
||||
}
|
||||
|
||||
public boolean isGeodesic() {
|
||||
return mIsGeodesic;
|
||||
}
|
||||
|
||||
public boolean isDottedLine() {
|
||||
return mIsDottedLine;
|
||||
}
|
||||
|
||||
public boolean isGradient() {
|
||||
return mIsGradient;
|
||||
}
|
||||
|
||||
public boolean useFacade() {
|
||||
return useFacade;
|
||||
}
|
||||
|
||||
|
||||
public float getTransparency() {
|
||||
return mTransparency;
|
||||
}
|
||||
|
||||
public boolean isAboveMaskLayer() {
|
||||
return mIsAboveMaskLayer;
|
||||
}
|
||||
|
||||
public boolean isPointsUpdated() {
|
||||
return mIsPointsUpdated;
|
||||
}
|
||||
|
||||
public float getBrightSpeed() {
|
||||
return brightSpeed;
|
||||
}
|
||||
|
||||
public boolean isBrightOn() {
|
||||
return isBrightOn;
|
||||
}
|
||||
|
||||
public int getBrightColor() {
|
||||
return brightColor;
|
||||
}
|
||||
|
||||
public List<Integer> getColorValues() {
|
||||
return mColorValues;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.mogo.map.overlay.core
|
||||
|
||||
enum class Level(val zIndex: Int) {
|
||||
|
||||
|
||||
DEFAULT(10),
|
||||
|
||||
/**
|
||||
* 地图上Marker覆盖物
|
||||
*/
|
||||
MAP_MARKER(100),
|
||||
|
||||
/**
|
||||
* 车道中心线
|
||||
*/
|
||||
ROAD_CENTER_LINE(40000),
|
||||
|
||||
/**
|
||||
* 前车引导线
|
||||
*/
|
||||
GUIDE_ROUTE_LINE(75000),
|
||||
|
||||
|
||||
/**
|
||||
* 道路围栏区域绘制
|
||||
*/
|
||||
MAP_POLYGON(76000)
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
package com.mogo.map.overlay.line
|
||||
|
||||
import android.graphics.*
|
||||
import android.text.TextUtils
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng
|
||||
import com.mogo.map.overlay.core.*
|
||||
import com.mogo.map.overlay.proxy.line.*
|
||||
import java.util.UUID
|
||||
|
||||
data class Polyline(val id: String, val owner: String, val level: Level, val options: Options) {
|
||||
|
||||
@Volatile
|
||||
var delegate: IMapPolylineOverlay? = null
|
||||
|
||||
class Options private constructor(private val builder: Builder) {
|
||||
|
||||
val id: String = builder.id ?: throw AssertionError("id must not be null.")
|
||||
|
||||
val owner: String = builder.owner
|
||||
|
||||
val level: Level = builder.level
|
||||
|
||||
val useFacade: Boolean = builder.useFacade
|
||||
|
||||
val maxIndex: Float = builder.maxIndex
|
||||
|
||||
val points: List<MogoLatLng>? = builder.points
|
||||
|
||||
val width = builder.width
|
||||
|
||||
val color: Int = builder.color
|
||||
|
||||
val isVisible = builder.isVisible
|
||||
|
||||
val isGeodesic = builder.isGeodesic
|
||||
|
||||
val isDottedLine = builder.isDottedLine
|
||||
|
||||
val dottedLineType = builder.dottedLineType
|
||||
|
||||
val isGradient = builder.isGradient
|
||||
|
||||
val alpha = builder.alpha
|
||||
|
||||
val isUseGps = builder.isUseGps
|
||||
|
||||
val colors: List<Int>? = builder.colors
|
||||
|
||||
val isLightOn: Boolean = builder.isLightOn
|
||||
|
||||
val lightColor: Int = builder.lightColor
|
||||
|
||||
val lightSpeed: Float = builder.lightSpeed
|
||||
|
||||
fun builder(): Builder {
|
||||
return builder
|
||||
}
|
||||
|
||||
class Builder(val owner: String, val level: Level) {
|
||||
|
||||
internal var id: String? = null
|
||||
|
||||
internal var useFacade: Boolean = false
|
||||
|
||||
internal var maxIndex: Float = Float.MIN_VALUE
|
||||
|
||||
internal var points: List<MogoLatLng>? = null
|
||||
|
||||
internal var width = 10.0f
|
||||
|
||||
internal var color: Int = Color.BLACK
|
||||
|
||||
internal var isVisible = true
|
||||
|
||||
internal var isGeodesic = false
|
||||
|
||||
internal var isDottedLine = false
|
||||
|
||||
internal var dottedLineType = -1
|
||||
|
||||
internal var isGradient = false
|
||||
|
||||
internal var alpha = 1.0f
|
||||
|
||||
internal var isUseGps = false
|
||||
|
||||
internal var colors: List<Int>? = null
|
||||
|
||||
internal var isLightOn: Boolean = false
|
||||
|
||||
internal var lightColor: Int = Color.WHITE
|
||||
|
||||
internal var lightSpeed: Float = 0f
|
||||
|
||||
fun setId(id: String) = apply {
|
||||
this.id = id
|
||||
}
|
||||
|
||||
fun points(points: List<MogoLatLng>) = apply {
|
||||
this.points = points
|
||||
}
|
||||
|
||||
fun colors(colors: List<Int>) = apply {
|
||||
this.colors = colors
|
||||
}
|
||||
|
||||
fun color(color: Int) = apply {
|
||||
this.color = color
|
||||
}
|
||||
|
||||
fun setVisible(visible: Boolean) = apply {
|
||||
this.isVisible = visible
|
||||
}
|
||||
|
||||
fun setWidth(width: Float) = apply {
|
||||
this.width = width
|
||||
}
|
||||
|
||||
fun setMaxIndex(maxIndex: Float) = apply {
|
||||
this.maxIndex = maxIndex
|
||||
}
|
||||
|
||||
fun useFacade(facade: Boolean) = apply {
|
||||
this.useFacade = facade
|
||||
}
|
||||
|
||||
fun setGeodesic(isGeodesic: Boolean) = apply {
|
||||
this.isGeodesic = isGeodesic
|
||||
}
|
||||
|
||||
fun setIsDottedLine(isDottedLine: Boolean) = apply {
|
||||
this.isDottedLine = isDottedLine
|
||||
}
|
||||
|
||||
fun setDottedLineType(type: Int) = apply {
|
||||
this.dottedLineType = type
|
||||
}
|
||||
|
||||
fun setIsGradient(isGradient: Boolean) = apply {
|
||||
this.isGradient = isGradient
|
||||
}
|
||||
|
||||
fun setAlpha(alpha: Float) = apply {
|
||||
this.alpha = alpha
|
||||
}
|
||||
|
||||
fun setUseGps(isUseGps: Boolean) = apply {
|
||||
this.isUseGps = isUseGps
|
||||
}
|
||||
|
||||
fun setLightOn(isLightOn: Boolean) = apply {
|
||||
this.isLightOn = isLightOn
|
||||
}
|
||||
|
||||
fun setLightColor(color: Int) = apply {
|
||||
this.lightColor = color
|
||||
}
|
||||
|
||||
fun setLightSpeed(speed: Float) = apply {
|
||||
this.lightSpeed = speed
|
||||
}
|
||||
|
||||
fun build(): Options {
|
||||
if (TextUtils.isEmpty(id)) {
|
||||
id = UUID.randomUUID().toString()
|
||||
}
|
||||
if (TextUtils.isEmpty(id)) {
|
||||
throw AssertionError("id must not be null.")
|
||||
}
|
||||
return Options(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as Polyline
|
||||
|
||||
if (id != other.id) return false
|
||||
if (owner != other.owner) return false
|
||||
if (level != other.level) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = id.hashCode()
|
||||
result = 31 * result + owner.hashCode()
|
||||
result = 31 * result + level.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,448 @@
|
||||
package com.mogo.map.overlay.point
|
||||
|
||||
import android.graphics.*
|
||||
import android.text.TextUtils
|
||||
import android.view.*
|
||||
import androidx.annotation.*
|
||||
import com.mogo.map.overlay.core.*
|
||||
import com.mogo.map.overlay.proxy.point.*
|
||||
import java.util.*
|
||||
|
||||
data class Point(val id: String, val owner: String, val level: Level, val option: Options) {
|
||||
|
||||
@Volatile
|
||||
var delegate: IMapPointOverlay? = null
|
||||
|
||||
/**
|
||||
*
|
||||
* 地图上绘制点相关的参数
|
||||
*/
|
||||
class Options private constructor(private val builder: Builder){
|
||||
|
||||
/**
|
||||
* 唯一标识,可以通过此标识,操作对点的显示和隐藏
|
||||
*/
|
||||
val id: String = builder.id ?: throw AssertionError("id must not be null")
|
||||
|
||||
/**
|
||||
* 当前地图覆盖物所在level(zIndex值在此存储)
|
||||
*/
|
||||
val level: Level = builder.level
|
||||
|
||||
/**
|
||||
* 当前地图覆盖物所属的业务类型
|
||||
*/
|
||||
val owner: String = builder.owner
|
||||
|
||||
/**
|
||||
* 绘制点的纬度
|
||||
*/
|
||||
val latitude: Double = builder.latitude ?: 0.0
|
||||
|
||||
/**
|
||||
* 绘制点的经度
|
||||
*/
|
||||
val longitude: Double = builder.longitude ?: 0.0
|
||||
|
||||
/**
|
||||
* 3D模型
|
||||
*/
|
||||
@RawRes
|
||||
val icon3DRes: Int = builder.icon3DRes
|
||||
|
||||
/**
|
||||
* 自定义样式
|
||||
*/
|
||||
val iconView: View? = builder.iconView
|
||||
|
||||
/**
|
||||
* 指定覆盖物的颜色
|
||||
*/
|
||||
val anchorColor: String? = builder.anchorColor
|
||||
|
||||
/**
|
||||
* 文字标题
|
||||
*/
|
||||
val title: String? = builder.title
|
||||
|
||||
/**
|
||||
* 文字描述
|
||||
*/
|
||||
val snippet: String? = builder.snippet
|
||||
|
||||
/**
|
||||
* 图标对应的Bitmap对象
|
||||
*/
|
||||
val icon: Bitmap? = builder.icon
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的动画帧图标列表,多张图片模拟gif的效果
|
||||
*/
|
||||
val icons: ArrayList<Bitmap>? = builder.icons
|
||||
|
||||
/**
|
||||
* 设置多少帧刷新一次图片资源,Marker动画的间隔时间,值越小动画越快
|
||||
*/
|
||||
val period = builder.period
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的图片旋转角度,从正北开始,逆时针计算
|
||||
*/
|
||||
val rotate = builder.rotate
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物是否平贴地图
|
||||
*/
|
||||
val isFlat = builder.isFlat
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物是否可见
|
||||
*/
|
||||
val isVisible = builder.isVisible
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的InfoWindow是否允许显示
|
||||
*/
|
||||
val isInfoWindowEnable = builder.isInfoWindowEnable
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的透明度
|
||||
*/
|
||||
val alpha = builder.alpha
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的透明度
|
||||
*/
|
||||
val scale = builder.scale
|
||||
|
||||
/**
|
||||
* Marker覆盖物的坐标是否是Gps
|
||||
*/
|
||||
val isGps = builder.isGps
|
||||
|
||||
/**
|
||||
* Marker覆盖物锚点在水平范围的比例
|
||||
*/
|
||||
val u = builder.u
|
||||
|
||||
/**
|
||||
* Marker覆盖物锚点垂直范围的比例
|
||||
*/
|
||||
val v = builder.v
|
||||
|
||||
/**
|
||||
* 是否是3D模型
|
||||
*/
|
||||
val is3DMode: Boolean = builder.is3DMode
|
||||
|
||||
/**
|
||||
* 是否控制角度
|
||||
*/
|
||||
val isControlAngle = builder.isControlAngle
|
||||
|
||||
/**
|
||||
* 资源名称,便于缓存重复使用,和mIcon3DRes、mIconView、icon等冲突,需要县设置
|
||||
*/
|
||||
val resName: String? = builder.resName
|
||||
|
||||
/**
|
||||
* 是否切换到当前marker所在的视角
|
||||
*/
|
||||
val moveToCenter: Boolean = builder.moveToCenter
|
||||
|
||||
fun builder(): Builder {
|
||||
return builder
|
||||
}
|
||||
|
||||
class Builder(val owner: String,val level: Level){
|
||||
|
||||
/**
|
||||
* 唯一标识,可以通过此标识,操作对点的显示和隐藏
|
||||
*/
|
||||
internal var id: String? = null
|
||||
|
||||
/**
|
||||
* 绘制点的纬度
|
||||
*/
|
||||
internal var latitude: Double? = null
|
||||
|
||||
/**
|
||||
* 绘制点的经度
|
||||
*/
|
||||
internal var longitude: Double? = null
|
||||
|
||||
/**
|
||||
* 3D模型
|
||||
*/
|
||||
@RawRes
|
||||
internal var icon3DRes = 0
|
||||
|
||||
|
||||
/**
|
||||
* 自定义样式
|
||||
*/
|
||||
internal var iconView: View? = null
|
||||
|
||||
/**
|
||||
* 指定覆盖物的颜色
|
||||
*/
|
||||
internal var anchorColor: String? = null
|
||||
|
||||
/**
|
||||
* 文字标题
|
||||
*/
|
||||
internal var title: String? = null
|
||||
|
||||
/**
|
||||
* 文字描述
|
||||
*/
|
||||
internal var snippet: String? = null
|
||||
|
||||
/**
|
||||
* 图标对应的Bitmap对象
|
||||
*/
|
||||
internal var icon: Bitmap? = null
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的动画帧图标列表,多张图片模拟gif的效果
|
||||
*/
|
||||
internal var icons: ArrayList<Bitmap>? = null
|
||||
|
||||
/**
|
||||
* 设置多少帧刷新一次图片资源,Marker动画的间隔时间,值越小动画越快
|
||||
*/
|
||||
internal var period = 0
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的图片旋转角度,从正北开始,逆时针计算
|
||||
*/
|
||||
internal var rotate = 0f
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物是否平贴地图
|
||||
*/
|
||||
internal var isFlat = false
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物是否可见
|
||||
*/
|
||||
internal var isVisible = true
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的InfoWindow是否允许显示
|
||||
*/
|
||||
internal var isInfoWindowEnable = true
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的透明度
|
||||
*/
|
||||
internal var alpha = 1.0f
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的透明度
|
||||
*/
|
||||
internal var scale = 1.0f
|
||||
|
||||
/**
|
||||
* Marker覆盖物的坐标是否是Gps
|
||||
*/
|
||||
internal var isGps = false
|
||||
|
||||
/**
|
||||
* Marker覆盖物锚点在水平范围的比例
|
||||
*/
|
||||
internal var u = 0.5f
|
||||
|
||||
/**
|
||||
* Marker覆盖物锚点垂直范围的比例
|
||||
*/
|
||||
internal var v = 0.5f
|
||||
|
||||
|
||||
/**
|
||||
* 是否是3D模型
|
||||
*/
|
||||
internal var is3DMode: Boolean = false
|
||||
|
||||
/**
|
||||
* 是否控制角度
|
||||
*/
|
||||
internal var isControlAngle = false
|
||||
|
||||
/**
|
||||
* 资源名称,便于缓存重复使用,和mIcon3DRes、mIconView、icon等冲突,需要县设置
|
||||
*/
|
||||
internal var resName: String? = null
|
||||
|
||||
|
||||
/**
|
||||
* 是否切换到当前marker所在的视角
|
||||
*/
|
||||
internal var moveToCenter: Boolean = true
|
||||
|
||||
fun setId(id: String) = apply {
|
||||
this.id = id
|
||||
}
|
||||
|
||||
fun resName(resName: String?) = apply {
|
||||
this.resName = resName
|
||||
}
|
||||
|
||||
fun controlAngle(controlAngle: Boolean) = apply {
|
||||
isControlAngle = controlAngle
|
||||
}
|
||||
|
||||
fun set3DMode(is3DMode: Boolean) = apply {
|
||||
this.is3DMode = is3DMode
|
||||
}
|
||||
|
||||
fun latitude(latitude: Double) = apply {
|
||||
this.latitude = latitude
|
||||
}
|
||||
|
||||
fun longitude(longitude: Double) = apply {
|
||||
this.longitude = longitude
|
||||
}
|
||||
|
||||
/**
|
||||
* 优先使用icon作为marker资源
|
||||
* @param icon
|
||||
* @return
|
||||
*/
|
||||
fun icon(icon: Bitmap?) = apply {
|
||||
this.icon = icon
|
||||
}
|
||||
|
||||
/**
|
||||
* 帧动画对应的图片序列
|
||||
*/
|
||||
fun icons(icons: ArrayList<Bitmap>?) = apply {
|
||||
this.icons = icons
|
||||
}
|
||||
|
||||
/**
|
||||
* 帧动画执行完成一次需要的时长,时间越短,帧动画越快
|
||||
*/
|
||||
fun period(period: Int) = apply {
|
||||
this.period = period
|
||||
if (this.period < 1) {
|
||||
this.period = 1
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* marker对应的资源的,旋转角度,正北方为0度,逆时针计算
|
||||
*/
|
||||
fun rotate(rotate: Float) = apply {
|
||||
this.rotate = rotate
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否平铺在地图上
|
||||
*/
|
||||
fun flat(flat: Boolean) = apply {
|
||||
isFlat = flat
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否可见
|
||||
*/
|
||||
fun visible(visible: Boolean) = apply {
|
||||
isVisible = visible
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置地图覆盖物的透明度
|
||||
*/
|
||||
fun alpha(alpha: Float) = apply {
|
||||
this.alpha = alpha
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置地图覆盖物的缩放比例
|
||||
*/
|
||||
fun scale(scale: Float) = apply {
|
||||
this.scale = scale
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否使用GPS坐标
|
||||
*/
|
||||
fun isUseGps(gps: Boolean) = apply {
|
||||
this.isGps = gps
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置地图覆盖物锚点在水平和垂直方向的比例
|
||||
*/
|
||||
fun anchor(u: Float, v: Float) = apply {
|
||||
this.u = u
|
||||
this.v = v
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义marker图层样式,优先使用 icon [.icon]作为marker资源
|
||||
*
|
||||
* @param iconView
|
||||
* @return
|
||||
*/
|
||||
fun icon(iconView: View?) = apply {
|
||||
this.iconView = iconView
|
||||
}
|
||||
|
||||
/**
|
||||
* 3D模型对应的资源
|
||||
*/
|
||||
fun icon3DRes(@RawRes icon3DRes: Int) = apply {
|
||||
this.icon3DRes = icon3DRes
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置地图覆盖物的颜色
|
||||
*/
|
||||
fun anchorColor(anchorColor: String?) = apply {
|
||||
this.anchorColor = anchorColor
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否切换到当前marker所在的视角
|
||||
*/
|
||||
fun moveToCenter(flag: Boolean) = apply {
|
||||
this.moveToCenter = flag
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建Options对象
|
||||
*/
|
||||
fun build(): Options {
|
||||
if (TextUtils.isEmpty(id)) {
|
||||
id = UUID.randomUUID().toString()
|
||||
}
|
||||
if (TextUtils.isEmpty(id)) {
|
||||
throw AssertionError("id must not be null.")
|
||||
}
|
||||
return Options(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as Point
|
||||
|
||||
if (id != other.id) return false
|
||||
if (owner != other.owner) return false
|
||||
if (level != other.level) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = id.hashCode()
|
||||
result = 31 * result + owner.hashCode()
|
||||
result = 31 * result + level.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.mogo.map.overlay.proxy
|
||||
|
||||
|
||||
interface IMapOverlay {
|
||||
|
||||
/**
|
||||
* 删除当前marker并销毁Marker的图片等资源
|
||||
*/
|
||||
fun destroy()
|
||||
|
||||
/**
|
||||
* 删除当前marker。
|
||||
*/
|
||||
fun remove()
|
||||
|
||||
/**
|
||||
* 设置 Marker 覆盖物的可见属性。
|
||||
*
|
||||
* @param visible
|
||||
*/
|
||||
fun setVisible(visible: Boolean)
|
||||
|
||||
/**
|
||||
* 是否已销毁
|
||||
*/
|
||||
fun isDestroyed(): Boolean
|
||||
|
||||
/**
|
||||
* 是否可见
|
||||
*/
|
||||
fun isVisible(): Boolean
|
||||
|
||||
|
||||
/**
|
||||
* 设置当前marker在最上面。
|
||||
*/
|
||||
fun setToTop()
|
||||
|
||||
/**
|
||||
* 取消当前marker在最上面
|
||||
*/
|
||||
fun setUnTop()
|
||||
|
||||
|
||||
fun onRemove(action: (id: String) -> Unit)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.mogo.map.overlay.proxy.line
|
||||
|
||||
import com.mogo.map.overlay.line.*
|
||||
import com.mogo.map.overlay.proxy.*
|
||||
|
||||
interface IMapPolylineOverlay: IMapOverlay {
|
||||
|
||||
fun setOptions(options: Polyline.Options)
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.mogo.map.overlay.proxy.point
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng
|
||||
import com.mogo.map.overlay.point.Point.Options
|
||||
import com.mogo.map.overlay.proxy.*
|
||||
|
||||
interface IMapPointOverlay: IMapOverlay {
|
||||
|
||||
/**
|
||||
* 设置Marker覆盖物的属性选项类 通过markerOption 给marker设置属性
|
||||
*
|
||||
* @param opt
|
||||
*/
|
||||
fun setOptions(opt: Options)
|
||||
|
||||
|
||||
fun addDynamicAnchorPosition(point: MogoLatLng, angle: Float, duration: Long)
|
||||
}
|
||||
Reference in New Issue
Block a user