feat: 1.增加道路任务1秒2拍功能,修改为快照模式 2.增加自动采集道路任务功能
This commit is contained in:
parent
dd9144aa32
commit
c925268911
@ -7,7 +7,7 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.navinfo.outdoor"
|
||||
minSdkVersion 22
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 30
|
||||
versionCode 23
|
||||
versionName "8.220617"
|
||||
@ -62,7 +62,6 @@ dependencies {
|
||||
implementation 'androidx.navigation:navigation-fragment:2.1.0'
|
||||
implementation 'androidx.navigation:navigation-ui:2.1.0'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation files('libs\\jts-1.13.jar')
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
@ -82,6 +81,7 @@ dependencies {
|
||||
|
||||
//网络框架
|
||||
implementation 'com.lzy.net:okgo:3.0.4'
|
||||
implementation 'com.lzy.net:okrx2:2.0.2'
|
||||
implementation 'com.google.code.gson:gson:2.8.5'
|
||||
|
||||
//retrofit+rxJava
|
||||
|
BIN
app/libs/gt-epsg-hsql-25.0.jar
Normal file
BIN
app/libs/gt-epsg-hsql-25.0.jar
Normal file
Binary file not shown.
BIN
app/libs/gt-main-25.0.jar
Normal file
BIN
app/libs/gt-main-25.0.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
app/libs/jts-core-1.18.2.jar
Normal file
BIN
app/libs/jts-core-1.18.2.jar
Normal file
Binary file not shown.
@ -113,6 +113,10 @@
|
||||
<activity
|
||||
android:name=".activity.VideoActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<!--自动拍照界面-->
|
||||
<activity
|
||||
android:name=".activity.AutoTakePictureActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.UserActivity"
|
||||
android:configChanges="keyboardHidden|orientation"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,30 @@
|
||||
package com.navinfo.outdoor.activity;
|
||||
|
||||
public class MyCoordinate {
|
||||
private double x;
|
||||
private double Y;
|
||||
|
||||
public MyCoordinate() {
|
||||
}
|
||||
|
||||
public MyCoordinate(double x, double y) {
|
||||
this.x = x;
|
||||
Y = y;
|
||||
}
|
||||
|
||||
public double getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(double x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public double getY() {
|
||||
return Y;
|
||||
}
|
||||
|
||||
public void setY(double y) {
|
||||
Y = y;
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.navinfo.outdoor.activity;
|
||||
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.adapter.AdapterParam;
|
||||
import com.lzy.okgo.adapter.Call;
|
||||
import com.lzy.okgo.adapter.CallAdapter;
|
||||
import com.lzy.okgo.convert.StringConvert;
|
||||
import com.lzy.okgo.model.Response;
|
||||
import com.lzy.okgo.request.GetRequest;
|
||||
import com.lzy.okgo.request.PostRequest;
|
||||
import com.lzy.okrx2.adapter.ObservableBody;
|
||||
import com.lzy.okrx2.adapter.ObservableResponse;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Flowable;
|
||||
import io.reactivex.Observable;
|
||||
|
||||
public class OkHttpUtils {
|
||||
private static OkHttpUtils instance;
|
||||
|
||||
public static OkHttpUtils getInstance() {
|
||||
if (instance==null) {
|
||||
instance = new OkHttpUtils();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public <T>Observable<Response<T>> obtainOkGet(String url, Object tag, Map<String, String> params) {
|
||||
GetRequest<T> getRequest = OkGo.getInstance().<T>get(url).tag(tag);
|
||||
if (params!=null&&!params.isEmpty()) {
|
||||
getRequest.params(params, true);
|
||||
}
|
||||
return getRequest.adapt(new ObservableResponse<T>());
|
||||
}
|
||||
|
||||
public <T>Observable<Response<T>> obtainOkPost(String url, Object tag, Map<String, String> params) {
|
||||
PostRequest<T> postRequest = OkGo.getInstance().<T>post(url).tag(tag);
|
||||
if (params!=null&&!params.isEmpty()) {
|
||||
postRequest.params(params, true);
|
||||
}
|
||||
return postRequest.adapt(new ObservableResponse<T>());
|
||||
}
|
||||
}
|
@ -35,7 +35,7 @@ import com.otaliastudios.cameraview.CameraView;
|
||||
import com.otaliastudios.cameraview.FileCallback;
|
||||
import com.otaliastudios.cameraview.PictureResult;
|
||||
import com.otaliastudios.cameraview.controls.Mode;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
import com.wanghong.webpnative.WebPNative;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
@ -61,7 +61,7 @@ import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.Polyline;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
@ -17,6 +17,8 @@ import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
@ -52,6 +54,7 @@ import com.navinfo.outdoor.util.TimestampUtil;
|
||||
import com.navinfo.outdoor.util.ToastUtils;
|
||||
import com.otaliastudios.cameraview.CameraListener;
|
||||
import com.otaliastudios.cameraview.CameraLogger;
|
||||
import com.otaliastudios.cameraview.CameraOptions;
|
||||
import com.otaliastudios.cameraview.CameraView;
|
||||
import com.otaliastudios.cameraview.FileCallback;
|
||||
import com.otaliastudios.cameraview.PictureResult;
|
||||
@ -78,9 +81,9 @@ import com.tencent.tencentmap.mapsdk.maps.model.Polyline;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions;
|
||||
import com.umeng.commonsdk.internal.crash.UMCrashManager;
|
||||
import com.umeng.umcrash.UMCrash;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.geom.LineString;
|
||||
import com.vividsolutions.jts.geom.MultiLineString;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
import org.locationtech.jts.geom.LineString;
|
||||
import org.locationtech.jts.geom.MultiLineString;
|
||||
import com.wanghong.webpnative.WebPNative;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@ -139,6 +142,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
private int videoIndex = -1;
|
||||
private int convertIndex = 0;
|
||||
private int startVideoIndex = -1;
|
||||
private static int BRIGHTNESS=40, FRAMENESS=30;
|
||||
@SuppressLint("SimpleDateFormat")
|
||||
private SimpleDateFormat formatter;
|
||||
private Handler handler = new Handler(new Handler.Callback() {
|
||||
@ -146,7 +150,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
public boolean handleMessage(@NonNull Message msg) {
|
||||
if (msg.what == 0x101) {
|
||||
System.out.println("收到拍照按钮请求");
|
||||
camera.takePicture();
|
||||
camera.takePictureSnapshot();
|
||||
} else if (msg.what == 0x102) {
|
||||
if (imageView != null) {
|
||||
imageView.setEnabled(true);
|
||||
@ -165,6 +169,17 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
});
|
||||
private boolean booleanExtra;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
SharedPreferences sharedPreferences = getSharedPreferences("pic", Context.MODE_PRIVATE);
|
||||
BRIGHTNESS = sharedPreferences.getInt("brightness", 40);
|
||||
FRAMENESS = sharedPreferences.getInt("framness", 30);
|
||||
|
||||
// 设置当前界面亮度为40%
|
||||
setWindowBrightness(BRIGHTNESS);
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
EventBus.getDefault().register(this);
|
||||
@ -202,7 +217,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
tvMapView.setOnClickListener(this);
|
||||
ivPicRoadImage = findViewById(R.id.iv_pic_road);
|
||||
ivPicVideoImage = findViewById(R.id.iv_pic_video);
|
||||
Button btnSwitch = findViewById(R.id.btn_switch);
|
||||
ImageView btnSwitch = findViewById(R.id.btn_switch);
|
||||
btnSwitch.setOnClickListener(this);
|
||||
gpsUtils = new GPSUtils(PicturesActivity.this);
|
||||
gpsUtils.setOnClickGPSStatus(new GPSUtils.OnClickGPSStatus() {
|
||||
@ -266,6 +281,10 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
ivLocation = findViewById(R.id.iv_location);
|
||||
ivLocation.setOnClickListener(this);
|
||||
camera = findViewById(R.id.camera);
|
||||
CameraOptions cameraOptions = camera.getCameraOptions();
|
||||
camera.setPreviewFrameRate(FRAMENESS);
|
||||
camera.setSnapshotMaxWidth(1920);
|
||||
camera.setSnapshotMaxHeight(1440);
|
||||
camera.setOnClickListener(this);
|
||||
tvTitle = findViewById(R.id.tv_title);
|
||||
tvConvert = findViewById(R.id.tv_convert);
|
||||
@ -372,7 +391,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
@Override
|
||||
public void run() {
|
||||
if (radioPicture == 1) {
|
||||
camera.takePicture();
|
||||
camera.takePictureSnapshot();
|
||||
} else {
|
||||
Message message = new Message();
|
||||
message.what = 0x101;
|
||||
@ -380,6 +399,14 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Button btnSetting = findViewById(R.id.btn_setting);
|
||||
btnSetting.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
class Jpg2WebpRunnable implements Runnable {
|
||||
@ -401,19 +428,20 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
@Override
|
||||
public void run() {
|
||||
if (file.exists() && file != null) {
|
||||
if (initWeb(file, count, isBoolean, index)) {
|
||||
if (PicturesActivity.this != null&&handler != null) {
|
||||
if (radioPicture == 1) {
|
||||
Message message = new Message();
|
||||
message.what = 0x103;
|
||||
handler.sendMessage(message);
|
||||
} else {
|
||||
Message message = new Message();
|
||||
message.what = 0x104;
|
||||
message.arg1 = index;
|
||||
handler.sendMessage(message);
|
||||
}
|
||||
// if (initWeb(file, count, isBoolean, index)) {
|
||||
initMarkerPaper(index);
|
||||
if (PicturesActivity.this != null&&handler != null) {
|
||||
if (radioPicture == 1) {
|
||||
Message message = new Message();
|
||||
message.what = 0x103;
|
||||
handler.sendMessage(message);
|
||||
} else {
|
||||
Message message = new Message();
|
||||
message.what = 0x104;
|
||||
message.arg1 = index;
|
||||
handler.sendMessage(message);
|
||||
}
|
||||
}
|
||||
// runOnUiThread(new Runnable() {
|
||||
// @SuppressLint("SetTextI18n")
|
||||
// @Override
|
||||
@ -421,7 +449,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
//
|
||||
// }
|
||||
// });
|
||||
}
|
||||
// }
|
||||
} else {
|
||||
isBack = false;
|
||||
if (isOration) {
|
||||
@ -726,14 +754,14 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
* 设置相机的拍照size
|
||||
* */
|
||||
private void initCameraSize() {
|
||||
SizeSelector maxWidth = SizeSelectors.maxWidth(1280);
|
||||
SizeSelector maxHeight = SizeSelectors.maxHeight(1280);
|
||||
SizeSelector minWidth = SizeSelectors.minWidth(720);
|
||||
SizeSelector minHeight = SizeSelectors.minHeight(720);
|
||||
SizeSelector maxWidth = SizeSelectors.maxWidth(1920);
|
||||
SizeSelector maxHeight = SizeSelectors.maxHeight(1440);
|
||||
SizeSelector minWidth = SizeSelectors.minWidth(1440);
|
||||
SizeSelector minHeight = SizeSelectors.minHeight(1080);
|
||||
SizeSelector maxDimensions = SizeSelectors.and(maxWidth, maxHeight); // Matches sizes bigger than 1000x2000.
|
||||
SizeSelector minDimensions = SizeSelectors.and(minWidth, minHeight); // Matches sizes bigger than 1000x2000.
|
||||
SizeSelector verticalRatio = SizeSelectors.aspectRatio(AspectRatio.of(720, 1280), 0.2f); // Matches 1:1 sizes.
|
||||
SizeSelector horzentalRatio = SizeSelectors.aspectRatio(AspectRatio.of(1280, 720), 0.2f); // Matches 1:1 sizes.
|
||||
SizeSelector verticalRatio = SizeSelectors.aspectRatio(AspectRatio.of(1080, 1920), 0.2f); // Matches 1:1 sizes.
|
||||
SizeSelector horzentalRatio = SizeSelectors.aspectRatio(AspectRatio.of(1920, 1080), 0.2f); // Matches 1:1 sizes.
|
||||
|
||||
SizeSelector result = SizeSelectors.or(
|
||||
SizeSelectors.and(verticalRatio, maxDimensions, minDimensions), // Try to match both constraints
|
||||
@ -1026,7 +1054,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
@Override
|
||||
public void run() {
|
||||
if (radioPicture == 1) {
|
||||
camera.takePicture();
|
||||
camera.takePictureSnapshot();
|
||||
} else {
|
||||
Message message = new Message();
|
||||
message.what = 0x101;
|
||||
@ -1056,4 +1084,12 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
timerTask = null;
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前界面亮度
|
||||
private void setWindowBrightness(int brightness) {
|
||||
Window window = getWindow();
|
||||
WindowManager.LayoutParams lp = window.getAttributes();
|
||||
lp.screenBrightness = brightness / 255.0f;
|
||||
window.setAttributes(lp);
|
||||
}
|
||||
}
|
@ -224,4 +224,20 @@ public class Constant {
|
||||
public static String REGION_YUE_PHONE = "892781071";
|
||||
public static String REGION_YUN_NAME = "云贵-地图寻宝群";
|
||||
public static String REGION_YUN_PHONE = "284447253";
|
||||
|
||||
/**
|
||||
* 获取信号强度描述文字
|
||||
* */
|
||||
public static String getRssiDesStr(int rssi) {
|
||||
if (rssi == 0) {
|
||||
return "无信号";
|
||||
} else if (rssi == 1) {
|
||||
return "弱";
|
||||
} else if (rssi == 2) {
|
||||
return "中";
|
||||
} else if (rssi == 3) {
|
||||
return "强";
|
||||
}
|
||||
return "无信号"; // 默认为无信号
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ public class UserApplication extends Application {
|
||||
//设置公共请求头
|
||||
.addCommonHeaders(headers)
|
||||
//全局统一超时重连次数,默认为三次,那么最差的情况会请求4次(一次原始请求,三次重连请求),不需要可以设置为0;
|
||||
.setRetryCount(0);
|
||||
.setRetryCount(3);
|
||||
StrictMode.VmPolicy.Builder picBuilder = new StrictMode.VmPolicy.Builder();
|
||||
StrictMode.setVmPolicy(picBuilder.build());
|
||||
picBuilder.detectFileUriExposure();
|
||||
|
@ -88,7 +88,7 @@ public class JobSearchBean implements Serializable {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public static class ListBean {
|
||||
public static class ListBean implements Serializable{
|
||||
/**
|
||||
* id : 8992
|
||||
* geo : dy3feM6SkaeY3Q3FrUcdfMyvvsAqu2MktMG2JtDX/+gDQ7IT9aNcPn2v1Rvi
|
||||
|
135
app/src/main/java/com/navinfo/outdoor/bean/LocationRecorder.java
Normal file
135
app/src/main/java/com/navinfo/outdoor/bean/LocationRecorder.java
Normal file
@ -0,0 +1,135 @@
|
||||
package com.navinfo.outdoor.bean;
|
||||
|
||||
import android.location.Location;
|
||||
|
||||
import androidx.room.Entity;
|
||||
import androidx.room.PrimaryKey;
|
||||
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.tencent.map.geolocation.TencentLocation;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
@Entity(tableName = "LocationRecorder")
|
||||
public class LocationRecorder implements Serializable {
|
||||
@PrimaryKey
|
||||
private long time; // 采集时间
|
||||
private double tencentLocationX;
|
||||
private double tencentLocationY;
|
||||
private double gpsLocationX;
|
||||
private double gpsLocationY;
|
||||
private int rssi; // 信号强度
|
||||
private double bearing; // 角度方向
|
||||
private int satelliteCount; // 卫星颗数
|
||||
private String imgFileName; // 照片名称
|
||||
|
||||
public long getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(long time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public double getTencentLocationX() {
|
||||
return tencentLocationX;
|
||||
}
|
||||
|
||||
public void setTencentLocationX(double tencentLocationX) {
|
||||
this.tencentLocationX = tencentLocationX;
|
||||
}
|
||||
|
||||
public double getTencentLocationY() {
|
||||
return tencentLocationY;
|
||||
}
|
||||
|
||||
public void setTencentLocationY(double tencentLocationY) {
|
||||
this.tencentLocationY = tencentLocationY;
|
||||
}
|
||||
|
||||
public double getGpsLocationX() {
|
||||
return gpsLocationX;
|
||||
}
|
||||
|
||||
public void setGpsLocationX(double gpsLocationX) {
|
||||
this.gpsLocationX = gpsLocationX;
|
||||
}
|
||||
|
||||
public double getGpsLocationY() {
|
||||
return gpsLocationY;
|
||||
}
|
||||
|
||||
public void setGpsLocationY(double gpsLocationY) {
|
||||
this.gpsLocationY = gpsLocationY;
|
||||
}
|
||||
|
||||
public int getRssi() {
|
||||
return rssi;
|
||||
}
|
||||
|
||||
public void setRssi(int rssi) {
|
||||
this.rssi = rssi;
|
||||
}
|
||||
|
||||
public double getBearing() {
|
||||
return bearing;
|
||||
}
|
||||
|
||||
public void setBearing(double bearing) {
|
||||
this.bearing = bearing;
|
||||
}
|
||||
|
||||
public int getSatelliteCount() {
|
||||
return satelliteCount;
|
||||
}
|
||||
|
||||
public void setSatelliteCount(int satelliteCount) {
|
||||
this.satelliteCount = satelliteCount;
|
||||
}
|
||||
|
||||
public String getImgFileName() {
|
||||
return imgFileName;
|
||||
}
|
||||
|
||||
public void setImgFileName(String imgFileName) {
|
||||
this.imgFileName = imgFileName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LocationRecorder{" +
|
||||
"time=" + time +
|
||||
", tencentLocationX=" + tencentLocationX +
|
||||
", tencentLocationY=" + tencentLocationY +
|
||||
", gpsLocationX=" + gpsLocationX +
|
||||
", gpsLocationY=" + gpsLocationY +
|
||||
", rssi=" + rssi +
|
||||
", bearing=" + bearing +
|
||||
", satelliteCount=" + satelliteCount +
|
||||
", imgFileName='" + imgFileName + '\'' +
|
||||
'}';
|
||||
}
|
||||
public String toString(SimpleDateFormat dateFormat, int index) {
|
||||
return new StringBuilder()
|
||||
.append(dateFormat.format(new Date(time)))
|
||||
.append(",")
|
||||
.append(index)
|
||||
.append(",")
|
||||
.append(tencentLocationY)
|
||||
.append(",")
|
||||
.append(tencentLocationX)
|
||||
.append(",")
|
||||
.append(bearing)
|
||||
.append(Constant.getRssiDesStr(rssi))
|
||||
.append(",")
|
||||
.append(satelliteCount)
|
||||
.append(",")
|
||||
.append(gpsLocationY)
|
||||
.append(",")
|
||||
.append(gpsLocationX)
|
||||
.append("\r\n")
|
||||
.toString();
|
||||
}
|
||||
}
|
184
app/src/main/java/com/navinfo/outdoor/bean/RoadMatchEntity.java
Normal file
184
app/src/main/java/com/navinfo/outdoor/bean/RoadMatchEntity.java
Normal file
@ -0,0 +1,184 @@
|
||||
package com.navinfo.outdoor.bean;
|
||||
|
||||
import androidx.room.ColumnInfo;
|
||||
|
||||
import com.navinfo.outdoor.activity.MyCoordinate;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
|
||||
import org.locationtech.jts.geom.Coordinate;
|
||||
import org.locationtech.jts.geom.Envelope;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
import org.locationtech.jts.geom.LineString;
|
||||
import org.locationtech.jts.geom.Point;
|
||||
import org.locationtech.jts.geom.Polygon;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 道路匹配的封装类
|
||||
* */
|
||||
public class RoadMatchEntity implements Serializable {
|
||||
private int id; // 唯一id
|
||||
private JobSearchBean.BodyBean.ListBean dataDetail; // 具体的内容信息
|
||||
private double angle=0; // 起点匹配方向
|
||||
private double length=0; //geometry的长度
|
||||
private String geometry; // 数据的geometry,此处应该为lineString
|
||||
// private String buffer; // line外扩的buffer,用来判断行驶过程中是否可以与当前geometry匹配
|
||||
private String sPoint; // 起点
|
||||
private String ePoint; // 起点
|
||||
private long startMatchTime; // 开始匹配的时间
|
||||
private long endMathchTime; // 结束匹配的时间
|
||||
private double lastDistance=0; // 上次匹配到的距离
|
||||
private int matchCount; // <连续>匹配到的点位个数
|
||||
private int unMatchCount; // <连续>未匹配到的点位个数
|
||||
private List<MyCoordinate> matchPointList = new ArrayList<>(); // 已匹配的点位列表
|
||||
private List<MyCoordinate> unMatchPointList = new ArrayList<>(); // 未匹配的点位列表
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public JobSearchBean.BodyBean.ListBean getDataDetail() {
|
||||
return dataDetail;
|
||||
}
|
||||
|
||||
public void setDataDetail(JobSearchBean.BodyBean.ListBean dataDetail) {
|
||||
this.dataDetail = dataDetail;
|
||||
}
|
||||
|
||||
public double getAngle() {
|
||||
return angle;
|
||||
}
|
||||
|
||||
public void setAngle(double angle) {
|
||||
this.angle = angle;
|
||||
}
|
||||
|
||||
public String getGeometry() {
|
||||
return geometry;
|
||||
}
|
||||
|
||||
public void setGeometry(LineString geometry) {
|
||||
this.geometry = geometry.toString();
|
||||
this.length = geometry.getLength();
|
||||
}
|
||||
|
||||
public double getLength() {
|
||||
return length;
|
||||
}
|
||||
|
||||
// public String getBuffer() {
|
||||
// return buffer;
|
||||
// }
|
||||
//
|
||||
// public void setBuffer(String buffer) {
|
||||
// this.buffer = buffer;
|
||||
// }
|
||||
|
||||
public String getsPoint() {
|
||||
return sPoint;
|
||||
}
|
||||
|
||||
public void setsPoint(String sPoint) {
|
||||
this.sPoint = sPoint;
|
||||
}
|
||||
|
||||
public String getePoint() {
|
||||
return ePoint;
|
||||
}
|
||||
|
||||
public void setePoint(String ePoint) {
|
||||
this.ePoint = ePoint;
|
||||
}
|
||||
|
||||
public long getStartMatchTime() {
|
||||
return startMatchTime;
|
||||
}
|
||||
|
||||
public void setStartMatchTime(long startMatchTime) {
|
||||
this.startMatchTime = startMatchTime;
|
||||
}
|
||||
|
||||
public long getEndMathchTime() {
|
||||
return endMathchTime;
|
||||
}
|
||||
|
||||
public void setEndMathchTime(long endMathchTime) {
|
||||
this.endMathchTime = endMathchTime;
|
||||
}
|
||||
|
||||
public double getLastDistance() {
|
||||
return lastDistance;
|
||||
}
|
||||
|
||||
public void setLastDistance(double lastDistance) {
|
||||
this.lastDistance = lastDistance;
|
||||
}
|
||||
|
||||
public int getMatchCount() {
|
||||
return matchCount;
|
||||
}
|
||||
|
||||
public void setMatchCount(int matchCount) {
|
||||
this.matchCount = matchCount;
|
||||
}
|
||||
|
||||
public int getUnMatchCount() {
|
||||
return unMatchCount;
|
||||
}
|
||||
|
||||
public void setUnMatchCount(int unMatchCount) {
|
||||
this.unMatchCount = unMatchCount;
|
||||
}
|
||||
|
||||
public List<MyCoordinate> getMatchPointList() {
|
||||
return matchPointList;
|
||||
}
|
||||
|
||||
public void setMatchPointList(List<MyCoordinate> matchPointList) {
|
||||
this.matchPointList = matchPointList;
|
||||
}
|
||||
|
||||
public List<MyCoordinate> getUnMatchPointList() {
|
||||
return unMatchPointList;
|
||||
}
|
||||
|
||||
public void setUnMatchPointList(List<MyCoordinate> unMatchPointList) {
|
||||
this.unMatchPointList = unMatchPointList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
RoadMatchEntity that = (RoadMatchEntity) o;
|
||||
|
||||
if (id != that.id) return false;
|
||||
return true;
|
||||
// if (angle != that.angle) return false;
|
||||
// if (dataDetail != null ? !dataDetail.equals(that.dataDetail) : that.dataDetail != null)
|
||||
// return false;
|
||||
// if (geometry != null ? !geometry.equals(that.geometry) : that.geometry != null)
|
||||
// return false;
|
||||
// if (buffer != null ? !buffer.equals(that.buffer) : that.buffer != null) return false;
|
||||
// if (sPoint != null ? !sPoint.equals(that.sPoint) : that.sPoint != null) return false;
|
||||
// return ePoint != null ? ePoint.equals(that.ePoint) : that.ePoint == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = id;
|
||||
result = 31 * result + (dataDetail != null ? dataDetail.hashCode() : 0);
|
||||
result = 31 * result + (geometry != null ? geometry.hashCode() : 0);
|
||||
result = 31 * result + (sPoint != null ? sPoint.hashCode() : 0);
|
||||
result = 31 * result + (ePoint != null ? ePoint.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
@ -84,7 +84,7 @@ import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
@ -45,7 +45,7 @@ import com.navinfo.outdoor.util.GeometryTools;
|
||||
import com.navinfo.outdoor.util.TimestampUtil;
|
||||
import com.navinfo.outdoor.util.ToastUtils;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
@ -44,7 +44,7 @@ import com.navinfo.outdoor.util.TimestampUtil;
|
||||
import com.navinfo.outdoor.util.ToastUtils;
|
||||
import com.tencent.lbssearch.httpresponse.Poi;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
|
@ -69,7 +69,7 @@ import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
@ -37,6 +37,9 @@ import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
|
||||
/**
|
||||
* 图片-fragment
|
||||
@ -107,33 +110,31 @@ public class PhotoFragment extends BaseFragment implements View.OnClickListener
|
||||
List<File> fileArrayList = new ArrayList<>();
|
||||
if (fileListByUUID.size() >= 2) {
|
||||
for (int i = 0; i < fileListByUUID.size(); i++) {
|
||||
if (!fileListByUUID.get(i).getPath().contains("paper.txt")) {
|
||||
if (!fileListByUUID.get(i).getPath().endsWith("paper.txt")) {
|
||||
fileArrayList.add(fileListByUUID.get(i));
|
||||
} else {
|
||||
fileTxt = fileListByUUID.get(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
Collections.sort(fileArrayList, new Comparator<File>() {
|
||||
|
||||
fileArrayList = fileArrayList.stream().sorted(new Comparator<File>() {
|
||||
@Override
|
||||
public int compare(File o1, File o2) {
|
||||
String[] split = o1.getName().split(".webp");
|
||||
int i = Integer.parseInt(split[0]);
|
||||
String[] split2 = o2.getName().split(".webp");
|
||||
int i2 = Integer.parseInt(split2[0]);
|
||||
if (i > i2) {
|
||||
String o1Name = o1.getName().replace(".webp","").replace(".jpg", "").replace(".png", "").replace("jpeg", "");
|
||||
String o2Name = o2.getName().replace(".webp","").replace(".jpg", "").replace(".png", "").replace("jpeg", "");
|
||||
if (Integer.parseInt(o1Name)>Integer.parseInt(o2Name)) {
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
});
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
if (fileArrayList.size() > 0) {
|
||||
for (int i = 0; i < fileArrayList.size(); i++) {
|
||||
if (fileArrayList.get(i).getPath().contains(".webp") && !fileArrayList.get(i).getPath().contains("paper.txt")) {
|
||||
if (fileArrayList.get(i).exists()) {
|
||||
fileBeans.add(new FileBean(fileArrayList.get(i), false));
|
||||
}
|
||||
if (fileArrayList.get(i).exists()) {
|
||||
fileBeans.add(new FileBean(fileArrayList.get(i), false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
@ -66,7 +66,7 @@ import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
@ -34,10 +34,12 @@ import com.hjq.permissions.XXPermissions;
|
||||
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
|
||||
import com.kongzue.dialog.util.BaseDialog;
|
||||
import com.kongzue.dialog.util.DialogSettings;
|
||||
import com.kongzue.dialog.v3.CustomDialog;
|
||||
import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.kongzue.dialog.v3.WaitDialog;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.activity.AutoTakePictureActivity;
|
||||
import com.navinfo.outdoor.activity.FragmentManagement;
|
||||
import com.navinfo.outdoor.activity.PicturesActivity;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
@ -68,7 +70,7 @@ import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@ -374,12 +376,13 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
if (describe != null && !describe.equals("")) {
|
||||
etDesc.setText(describe);
|
||||
}
|
||||
String photoList = showPoiEntity.getPhoto();//存儲在數據庫中的數據
|
||||
if (!StringUtils.isEmpty(photoList)) {
|
||||
// String photoList = showPoiEntity.getPhoto();//存儲在數據庫中的數據
|
||||
// if (!StringUtils.isEmpty(photoList)) {
|
||||
boolean isImageLoad = false;
|
||||
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
|
||||
for (int i = 0; i < fileListByUUID.size(); i++) {
|
||||
if (fileListByUUID.get(i).getPath().contains(".webp") && !fileListByUUID.get(i).getPath().contains("paper.txt")) {
|
||||
if (fileListByUUID.get(i).getPath().endsWith(".webp") || fileListByUUID.get(i).getPath().endsWith(".png")
|
||||
|| fileListByUUID.get(i).getPath().endsWith(".jpg")|| fileListByUUID.get(i).getPath().endsWith(".jpeg")) {
|
||||
if (fileListByUUID.get(i).exists() && !isImageLoad) {
|
||||
// 使用glide加载视频的第一帧
|
||||
Glide.with(Objects.requireNonNull(getActivity())).load(fileListByUUID.get(i)).into(ivRoadPicture);
|
||||
@ -388,7 +391,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
}
|
||||
}
|
||||
fmRoadPic.setTag(fileListByUUID);
|
||||
}
|
||||
// }
|
||||
if (showPoiEntity.getTaskStatus() == 3) {
|
||||
disables();
|
||||
}
|
||||
@ -408,7 +411,8 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
if (!StringUtils.isEmpty(photo)) {
|
||||
File videoFile = new File(photo);
|
||||
videoFileList.add(new File(photo));
|
||||
if (videoFile.getPath().contains(".webp") && !videoFile.getPath().contains("paper.txt")) {
|
||||
if (videoFile.getName().endsWith(".webp") || videoFile.getName().endsWith(".png")
|
||||
|| videoFile.getName().endsWith(".jpg")|| videoFile.getName().endsWith(".jpeg")) {
|
||||
if (videoFile.exists() && !isImageLoad) {
|
||||
// 使用glide加载视频的第一帧
|
||||
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
|
||||
@ -456,7 +460,8 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
boolean isImageLoad = false;
|
||||
for (int i = 0; i < fileListByUUID.size(); i++) {
|
||||
File videoFile = fileListByUUID.get(i);
|
||||
if (videoFile.getPath().contains(".webp") && !videoFile.getPath().contains("paper.txt")) {
|
||||
if (videoFile.getName().endsWith(".webp") || videoFile.getName().endsWith(".png")
|
||||
|| videoFile.getName().endsWith(".jpg")|| videoFile.getName().endsWith(".jpeg")) {
|
||||
if (videoFile.exists() && !isImageLoad) {
|
||||
// 使用glide加载视频的第一帧
|
||||
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
|
||||
@ -507,19 +512,54 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
return;
|
||||
}
|
||||
}
|
||||
Intent intent = new Intent(getContext(), PicturesActivity.class);
|
||||
File finalFile = AWMp4ParserHelper.getInstance().obtainWebpFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
|
||||
intent.putExtra(Constant.INTENT_JPG_PATH, finalFile.getAbsolutePath());
|
||||
intent.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType());
|
||||
intent.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt());
|
||||
intent.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail());
|
||||
int gpsRssi = Constant.currentLocation.getGPSRssi();
|
||||
if (gpsRssi == 0) {
|
||||
intent.putExtra(Constant.INTENT_BOOLEAN, false);
|
||||
} else {
|
||||
intent.putExtra(Constant.INTENT_BOOLEAN, true);
|
||||
}
|
||||
startActivityForResult(intent, 0x101);
|
||||
|
||||
// 设置亮度和摄像机刷新率
|
||||
CustomDialog.show((AppCompatActivity) getActivity(), R.layout.camera_setting_pre, new CustomDialog.OnBindView() {
|
||||
@Override
|
||||
public void onBind(CustomDialog dialog, View v) {
|
||||
SharedPreferences sharedPreferences = getActivity().getSharedPreferences("pic", Context.MODE_PRIVATE);
|
||||
int brightness = sharedPreferences.getInt("brightness", 40);
|
||||
EditText edtBrightness = v.findViewById(R.id.edt_camera_setting_brightness);
|
||||
edtBrightness.setText(brightness+"");
|
||||
|
||||
int framness = sharedPreferences.getInt("framness", 30);
|
||||
EditText edtFramness = v.findViewById(R.id.edt_camera_setting_framness);
|
||||
edtFramness.setText(framness+"");
|
||||
|
||||
Button btnConfirm = v.findViewById(R.id.btn_camera_setting_confirm);
|
||||
btnConfirm.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
SharedPreferences.Editor editor = getActivity().getSharedPreferences("pic", Context.MODE_PRIVATE).edit();
|
||||
if (!edtBrightness.getText().toString().isEmpty()) {
|
||||
int b = Integer.parseInt(edtBrightness.getText().toString());
|
||||
editor.putInt("brightness", b);
|
||||
}
|
||||
if (!edtFramness.getText().toString().isEmpty()) {
|
||||
int f = Integer.parseInt(edtFramness.getText().toString());
|
||||
editor.putInt("framness", f);
|
||||
}
|
||||
editor.commit();
|
||||
Toast.makeText(getActivity(), "设置完成", Toast.LENGTH_SHORT).show();
|
||||
|
||||
Intent intent = new Intent(getContext(), PicturesActivity.class);
|
||||
File finalFile = AWMp4ParserHelper.getInstance().obtainWebpFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
|
||||
intent.putExtra(Constant.INTENT_JPG_PATH, finalFile.getAbsolutePath());
|
||||
intent.putExtra(Constant.INTENT_TYPE, showPoiEntity.getType());
|
||||
intent.putExtra(Constant.INTENT_GEO_WKT, showPoiEntity.getGeoWkt());
|
||||
intent.putExtra(Constant.INTENT_DETAIL, showPoiEntity.getDetail());
|
||||
int gpsRssi = Constant.currentLocation.getGPSRssi();
|
||||
if (gpsRssi == 0) {
|
||||
intent.putExtra(Constant.INTENT_BOOLEAN, false);
|
||||
} else {
|
||||
intent.putExtra(Constant.INTENT_BOOLEAN, true);
|
||||
}
|
||||
startActivityForResult(intent, 0x101);
|
||||
dialog.doDismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
}).setFullScreen(true);
|
||||
break;
|
||||
case R.id.road_upload:
|
||||
roadBuilder.append(TimestampUtil.time()).append(",").append("点击了上传的按钮 ,");
|
||||
|
@ -10,6 +10,7 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Matrix;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
@ -19,13 +20,17 @@ import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
@ -44,12 +49,14 @@ import com.jcodecraeer.xrecyclerview.XRecyclerView;
|
||||
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
|
||||
import com.kongzue.dialog.util.BaseDialog;
|
||||
import com.kongzue.dialog.util.DialogSettings;
|
||||
import com.kongzue.dialog.v3.CustomDialog;
|
||||
import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.kongzue.dialog.v3.ShareDialog;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.lzy.okgo.model.Progress;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.activity.AutoTakePictureActivity;
|
||||
import com.navinfo.outdoor.activity.FragmentManagement;
|
||||
import com.navinfo.outdoor.activity.HomeActivity;
|
||||
import com.navinfo.outdoor.activity.WebActivity;
|
||||
@ -76,6 +83,7 @@ import com.navinfo.outdoor.util.GeometryTools;
|
||||
import com.navinfo.outdoor.util.MapManager;
|
||||
import com.navinfo.outdoor.util.MyTecentLocationSource;
|
||||
import com.navinfo.outdoor.util.NetWorkUtils;
|
||||
import com.navinfo.outdoor.util.TencentMarkerUtils;
|
||||
import com.navinfo.outdoor.util.TimestampUtil;
|
||||
import com.navinfo.outdoor.util.ToastUtils;
|
||||
import com.sothree.slidinguppanel.ScrollableViewHelper;
|
||||
@ -101,9 +109,9 @@ import com.tencent.tencentmap.mapsdk.maps.model.Polyline;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions;
|
||||
import com.umeng.message.UmengNotificationClickHandler;
|
||||
import com.umeng.message.entity.UMessage;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.geom.MultiPoint;
|
||||
import com.vividsolutions.jts.geom.Point;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
import org.locationtech.jts.geom.MultiPoint;
|
||||
import org.locationtech.jts.geom.Point;
|
||||
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@ -137,16 +145,13 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
private List<Removable> removables;
|
||||
private List<Removable> removableScreenMarker;
|
||||
private List<Removable> removablesLocality;
|
||||
private final int MARKER_BIG = 4;
|
||||
/*
|
||||
* bitmapDescriptor1
|
||||
*/
|
||||
//private BitmapDescriptor bitmapDescriptor1, bitmapDescriptor2, bitmapDescriptor3, bitmapDescriptor4, bitmapDescriptor5;
|
||||
private Marker bigMarker;
|
||||
private List<Integer> upload;
|
||||
private final int MARKER_DOT = 3;
|
||||
private final int MARKER_LINE = 2;
|
||||
private final int MARKER_FACE = 1;
|
||||
private final int MARKER_BIG = 4;
|
||||
private HashMap<String, List<Marker>> removableHashMap;
|
||||
private ArrayList<LatLng> latList;
|
||||
private ArrayList<PoiEntity> poiEntityArrayList;
|
||||
@ -169,6 +174,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
});
|
||||
private TextView tvTenantGaps;
|
||||
private TencentMarkerUtils tencentMarkerUtils;
|
||||
private Button imgAutoMatchRoad; // 自动匹配道路
|
||||
|
||||
public static TreasureFragment newInstance(Bundle bundle) {
|
||||
TreasureFragment fragment = new TreasureFragment();
|
||||
@ -185,6 +192,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
@Override
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
tencentMarkerUtils = new TencentMarkerUtils();
|
||||
sharedPreferences = Objects.requireNonNull(getActivity()).getSharedPreferences(Constant.MESSAGE_TYPE, Context.MODE_PRIVATE);
|
||||
sharedEdit = sharedPreferences.edit();
|
||||
//fragment 管理器
|
||||
@ -292,6 +300,49 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
tencentMap.setOnMarkerClickListener(Constant.markerClickListener);
|
||||
}
|
||||
});
|
||||
|
||||
imgAutoMatchRoad = findViewById(R.id.iv_auto_match_road);
|
||||
imgAutoMatchRoad.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// 设置亮度和摄像机刷新率
|
||||
CustomDialog.show((AppCompatActivity) getActivity(), R.layout.camera_setting_pre, new CustomDialog.OnBindView() {
|
||||
@Override
|
||||
public void onBind(CustomDialog dialog, View v) {
|
||||
SharedPreferences sharedPreferences = getActivity().getSharedPreferences("pic", Context.MODE_PRIVATE);
|
||||
int brightness = sharedPreferences.getInt("brightness", 40);
|
||||
EditText edtBrightness = v.findViewById(R.id.edt_camera_setting_brightness);
|
||||
edtBrightness.setText(brightness+"");
|
||||
|
||||
int framness = sharedPreferences.getInt("framness", 30);
|
||||
EditText edtFramness = v.findViewById(R.id.edt_camera_setting_framness);
|
||||
edtFramness.setText(framness+"");
|
||||
|
||||
Button btnConfirm = v.findViewById(R.id.btn_camera_setting_confirm);
|
||||
btnConfirm.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
SharedPreferences.Editor editor = getActivity().getSharedPreferences("pic", Context.MODE_PRIVATE).edit();
|
||||
if (!edtBrightness.getText().toString().isEmpty()) {
|
||||
int b = Integer.parseInt(edtBrightness.getText().toString());
|
||||
editor.putInt("brightness", b);
|
||||
}
|
||||
if (!edtFramness.getText().toString().isEmpty()) {
|
||||
int f = Integer.parseInt(edtFramness.getText().toString());
|
||||
editor.putInt("framness", f);
|
||||
}
|
||||
editor.commit();
|
||||
Toast.makeText(getActivity(), "设置完成", Toast.LENGTH_SHORT).show();
|
||||
|
||||
Intent autoMatchIntent = new Intent(getContext(), AutoTakePictureActivity.class);
|
||||
startActivity(autoMatchIntent);
|
||||
dialog.doDismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
}).setFullScreen(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initUM() {
|
||||
@ -346,10 +397,35 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
dismissLoadingDialog();
|
||||
removableHashMap.clear();
|
||||
if (Constant.USHERED != null) {
|
||||
initThread(); // 刷新筛选的本地数据
|
||||
// 刷新筛选的本地数据
|
||||
tencentMarkerUtils.initLocalMarker(getActivity(), tencentMap, removablesLocality, removableHashMap, new TencentMarkerUtils.MarkerInitCallback<PoiEntity>() {
|
||||
@Override
|
||||
public void onMarkerInit(Map<String, List<Marker>> removableHashMap, List<Integer> uploadByNet, List<PoiEntity> listData) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
if (Constant.currentLocation != null) {
|
||||
initList(Constant.currentLocation); // 刷新筛选的网络数据
|
||||
if (Constant.currentLocation != null) { //筛选从服务器获取到的数据
|
||||
tencentMarkerUtils.initNetMarkerList(getActivity(), Constant.currentLocation, tencentMap, removables,null, null, removableHashMap, 200, new TencentMarkerUtils.MarkerInitCallback<JobSearchBean.BodyBean.ListBean>() {
|
||||
|
||||
@Override
|
||||
public void onMarkerInit(Map<String, List<Marker>> removableHashMap, List<Integer> uploadByNet, List<JobSearchBean.BodyBean.ListBean> listData) {
|
||||
latList.clear();
|
||||
for (Map.Entry<String, List<Marker>> entry : removableHashMap.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
LatLng lng = GeometryTools.createLatLng(key);
|
||||
latList.add(lng);
|
||||
}
|
||||
|
||||
// 服务返回的目前已上报但未上传照片的数据列表
|
||||
upload = uploadByNet;
|
||||
if (upload != null) {
|
||||
ivSubmit.setEnabled(true);
|
||||
} else {
|
||||
ivSubmit.setEnabled(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ToastUtils.Message(getActivity(), "未开启定位服务");
|
||||
}
|
||||
@ -564,306 +640,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 网络删选接口
|
||||
*
|
||||
* @param tencentLocation location
|
||||
*/
|
||||
private void initList(TencentLocation tencentLocation) {
|
||||
int task_type = Constant.TASK_TYPE;
|
||||
int limit_type = Constant.LIMIT_TYPE;
|
||||
int taskStatus = Constant.TASK_STARTUP;
|
||||
if (taskStatus == 1) {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_SEARCH_WORD;
|
||||
obtain.obj = null;
|
||||
EventBus.getDefault().post(obtain);
|
||||
return;
|
||||
}
|
||||
//获取中心点位置
|
||||
LatLng mapCenterPoint = getMapCenterPoint();
|
||||
if (mapCenterPoint != null) {
|
||||
centerEncode = Geohash.getInstance().encode(mapCenterPoint.latitude, mapCenterPoint.longitude);
|
||||
}
|
||||
String userEncode = Geohash.getInstance().encode(tencentLocation.getLatitude(), tencentLocation.getLongitude());
|
||||
OkGo.getInstance().cancelTag(this);
|
||||
Log.d("TAG", "initList: " + Constant.USHERED);
|
||||
// 请求方式和请求url
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("userGeo", userEncode);
|
||||
httpParams.put("centerGeo", centerEncode);
|
||||
httpParams.put("pageSize", Constant.NUMBER);
|
||||
httpParams.put("pageNum", 1);
|
||||
httpParams.put("type", task_type);
|
||||
httpParams.put("isExclusive", limit_type);
|
||||
if (taskStatus == 2) {
|
||||
if (Constant.USHERED != null) {
|
||||
httpParams.put("received", Constant.USHERED);
|
||||
}
|
||||
}
|
||||
showLoadingDialog();
|
||||
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
||||
.time(30)
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.TASK_LIST)
|
||||
.cls(JobSearchBean.class)
|
||||
.params(httpParams)
|
||||
.token(Constant.ACCESS_TOKEN);
|
||||
okGoBuilder.getRequest(new Callback<JobSearchBean>() {
|
||||
@Override
|
||||
public void onSuccess(JobSearchBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
if (response.getCode() == 200) {
|
||||
JobSearchBean.BodyBean body = response.getBody();
|
||||
if (body != null) {
|
||||
upload = response.getBody().getUpload();
|
||||
if (upload != null) {
|
||||
ivSubmit.setEnabled(true);
|
||||
} else {
|
||||
ivSubmit.setEnabled(false);
|
||||
}
|
||||
Log.d("TAG", "onSuccess: " + response.getBody().toString());
|
||||
for (int i = 0; i < removables.size(); i++) {
|
||||
removables.get(i).remove();
|
||||
}
|
||||
removables.clear();
|
||||
List<JobSearchBean.BodyBean.ListBean> list = response.getBody().getList();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
JobSearchBean.BodyBean.ListBean listBean = list.get(i);
|
||||
String encodeStr = list.get(i).getGeo();
|
||||
// 解密geo
|
||||
String geo = Geohash.getInstance().decode(encodeStr);
|
||||
Log.d("TAG", "onSuccess: " + geo);
|
||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||
LatLng latLng = null;
|
||||
switch (geometry.getGeometryType()) {
|
||||
case "LineString": //线
|
||||
case "MultiLineString"://多线
|
||||
BitmapDescriptor bitmapLine = null;
|
||||
if (listBean.getType() == 3) {//poi录像
|
||||
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.road_arrows);
|
||||
} else if (listBean.getType() == 4) {//道路录像
|
||||
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows);
|
||||
}
|
||||
List<LatLng> latLineString = GeometryTools.getLatLags(geo);
|
||||
// 构造 PolylineOptions
|
||||
PolylineOptions polylineOptions = new PolylineOptions()
|
||||
.addAll(latLineString)
|
||||
// 折线设置圆形线头
|
||||
.lineCap(true)
|
||||
// 折线的颜色为绿色
|
||||
.color(Color.parseColor("#0096FF"))
|
||||
// 折线宽度为5像素
|
||||
.width(28)
|
||||
// 还可以添加描边颜色
|
||||
//.borderColor(0xffff0000)
|
||||
// 描边颜色的宽度,线宽还是 25 像素,不过填充的部分宽度为 `width` - 2 * `borderWidth`
|
||||
//.borderWidth(1);
|
||||
.arrow(true)
|
||||
.arrowSpacing(80)
|
||||
.arrowTexture(bitmapLine);
|
||||
// 绘制折线
|
||||
Polyline polyline = tencentMap.addPolyline(polylineOptions);
|
||||
if (polyline != null) {
|
||||
polyline.setZIndex(MARKER_LINE);
|
||||
removables.add(polyline);
|
||||
if (latLineString != null && latLineString.size() > 0) {
|
||||
latLng = latLineString.get(0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "Point": //点
|
||||
latLng = GeometryTools.createLatLng(geo);
|
||||
break;
|
||||
case "Polygon": //面
|
||||
List<LatLng> latPolygon = GeometryTools.getLatLags(geo);
|
||||
Polygon polygon = tencentMap.addPolygon(new PolygonOptions().
|
||||
//连接封闭图形的点
|
||||
addAll(latPolygon).
|
||||
//填充颜色为红色
|
||||
fillColor(Color.parseColor("#97E0E7EC")).
|
||||
//边线颜色为黑色
|
||||
strokeColor(0xff000000).
|
||||
//边线宽度15像素
|
||||
strokeWidth(5));
|
||||
if (polygon != null) {
|
||||
polygon.setZIndex(MARKER_FACE);
|
||||
removables.add(polygon);
|
||||
com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid();
|
||||
double x = centroid.getX();
|
||||
double y = centroid.getY();
|
||||
latLng = new LatLng();
|
||||
latLng.setLatitude(y);
|
||||
latLng.setLongitude(x);
|
||||
}
|
||||
break;
|
||||
}
|
||||
switch (list.get(i).getType()) {
|
||||
case 1://poi
|
||||
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi);
|
||||
//poiDescriptor.getForager().setScale(50);
|
||||
assert latLng != null;
|
||||
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.9f)
|
||||
.anchor(0.5f, 1.0f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
if (poiMarker != null) {
|
||||
if (listBean != null) {
|
||||
poiMarker.setTag(listBean);
|
||||
}
|
||||
poiMarker.setZIndex(MARKER_DOT);
|
||||
removables.add(poiMarker);
|
||||
String poiGeo = initGeo(latLng);
|
||||
geoMarker(poiGeo, poiMarker);
|
||||
poiMarker.setClickable(true);
|
||||
}
|
||||
break;
|
||||
case 2://充电站
|
||||
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge);
|
||||
assert latLng != null;
|
||||
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor).alpha(0.9f)
|
||||
.anchor(0.5f, 1.0f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
if (stationMarker != null) {
|
||||
if (listBean != null) {
|
||||
stationMarker.setTag(listBean);
|
||||
}
|
||||
stationMarker.setZIndex(MARKER_DOT);
|
||||
removables.add(stationMarker);
|
||||
String stationGeo = initGeo(latLng);
|
||||
geoMarker(stationGeo, stationMarker);
|
||||
stationMarker.setClickable(true);
|
||||
}
|
||||
break;
|
||||
case 3://poi录像
|
||||
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_video);
|
||||
assert latLng != null;
|
||||
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor).alpha(0.9f)
|
||||
.anchor(0.5f, 1.0f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
if (poiVideoMarker != null) {
|
||||
if (listBean != null) {
|
||||
poiVideoMarker.setTag(listBean);
|
||||
}
|
||||
poiVideoMarker.setZIndex(MARKER_DOT);
|
||||
removables.add(poiVideoMarker);
|
||||
String poiVideoGeo = initGeo(latLng);
|
||||
geoMarker(poiVideoGeo, poiVideoMarker);
|
||||
poiVideoMarker.setClickable(true);
|
||||
}
|
||||
break;
|
||||
case 4://道路录像
|
||||
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road);
|
||||
assert latLng != null;
|
||||
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).alpha(0.9f)
|
||||
.anchor(0.5f, 1.0f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
if (roadMarker != null) {
|
||||
if (listBean != null) {
|
||||
roadMarker.setTag(listBean);
|
||||
}
|
||||
roadMarker.setZIndex(MARKER_DOT);
|
||||
removables.add(roadMarker);
|
||||
String roadGeo = initGeo(latLng);
|
||||
geoMarker(roadGeo, roadMarker);
|
||||
roadMarker.setClickable(true);
|
||||
}
|
||||
break;
|
||||
case 5://其他
|
||||
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other);
|
||||
assert latLng != null;
|
||||
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).alpha(0.9f)
|
||||
.anchor(0.5f, 1.0f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
if (otherMarker != null) {
|
||||
if (listBean != null) {
|
||||
otherMarker.setTag(listBean);
|
||||
}
|
||||
otherMarker.setZIndex(MARKER_DOT);
|
||||
removables.add(otherMarker);
|
||||
String otherGeo = initGeo(latLng);
|
||||
geoMarker(otherGeo, otherMarker);
|
||||
otherMarker.setClickable(true);
|
||||
}
|
||||
break;
|
||||
case 6://面状任务
|
||||
BitmapDescriptor Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_facet);
|
||||
assert latLng != null;
|
||||
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor).alpha(0.9f)
|
||||
.anchor(0.5f, 1.0f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
if (planarMarker != null) {
|
||||
if (listBean != null) {
|
||||
planarMarker.setTag(listBean);
|
||||
}
|
||||
planarMarker.setZIndex(MARKER_DOT);
|
||||
removables.add(planarMarker);
|
||||
String planarGeo = initGeo(latLng);
|
||||
geoMarker(planarGeo, planarMarker);
|
||||
planarMarker.setClickable(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
latList.clear();
|
||||
for (Map.Entry<String, List<Marker>> entry : removableHashMap.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
LatLng lng = GeometryTools.createLatLng(key);
|
||||
latList.add(lng);
|
||||
}
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_SEARCH_WORD;
|
||||
obtain.obj = response;
|
||||
EventBus.getDefault().post(obtain);
|
||||
} else if (response.getCode() == 230) {
|
||||
FlushTokenUtil.flushToken(getActivity());
|
||||
} else {
|
||||
ToastUtils.Message(getActivity(), response.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
String message = e.getMessage();
|
||||
assert message != null;
|
||||
if (message.equals("timeout") || message.equals("Read time out")) {
|
||||
ToastUtils.Message(getActivity(), "请求超时");
|
||||
} else {
|
||||
ToastUtils.Message(getActivity(), message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* geo 坐标点转成
|
||||
*
|
||||
* @param latLng lat
|
||||
*/
|
||||
public String initGeo(LatLng latLng) {
|
||||
return GeometryTools.createGeometry(latLng).toString();
|
||||
}
|
||||
|
||||
public void geoMarker(String geo, Marker marker) {
|
||||
if (!removableHashMap.containsKey(geo)) {
|
||||
List<Marker> markers = new ArrayList<>();
|
||||
markers.add(marker);
|
||||
removableHashMap.put(geo, markers);
|
||||
} else {
|
||||
List<Marker> markers = removableHashMap.get(geo);
|
||||
assert markers != null;
|
||||
markers.add(marker);
|
||||
removableHashMap.put(geo, markers);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* marker 选中的状态
|
||||
*
|
||||
@ -927,7 +703,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
// 绘制折线
|
||||
Polyline polyline = tencentMap.addPolyline(polylineOptions);
|
||||
if (polyline != null) {
|
||||
polyline.setZIndex(MARKER_LINE);
|
||||
polyline.setZIndex(TencentMarkerUtils.MARKER_LINE);
|
||||
removableScreenMarker.add(polyline);
|
||||
if (latLineString != null && latLineString.size() > 0) {
|
||||
latLng = latLineString.get(0);
|
||||
@ -946,9 +722,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
//边线宽度15像素
|
||||
strokeWidth(25));
|
||||
if (polygon != null) {
|
||||
polygon.setZIndex(MARKER_FACE);
|
||||
polygon.setZIndex(TencentMarkerUtils.MARKER_FACE);
|
||||
removableScreenMarker.add(polygon);
|
||||
com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid();
|
||||
org.locationtech.jts.geom.Point centroid = geometry.getCentroid();
|
||||
double x = centroid.getX();
|
||||
double y = centroid.getY();
|
||||
latLng = new LatLng();
|
||||
@ -1000,297 +776,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
}
|
||||
|
||||
/*本地数据库数据*/
|
||||
private void initThread() {
|
||||
int taskStatus = Constant.TASK_STARTUP;
|
||||
int type = Constant.TASK_TYPE;
|
||||
int limit = Constant.LIMIT_TYPE;
|
||||
PoiDatabase poiDatabase = PoiDatabase.getInstance(getContext());
|
||||
if (poiDatabase == null) {
|
||||
return;
|
||||
}
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<PoiEntity> allTaskStatus = poiDatabase.getPoiDao().getAllTaskStatus(taskStatus, taskStatus, type, type, limit, limit);
|
||||
if (getActivity() != null) {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (int i = 0; i < removablesLocality.size(); i++) {
|
||||
removablesLocality.get(i).remove();
|
||||
}
|
||||
removablesLocality.clear();
|
||||
for (int i = 0; i < allTaskStatus.size(); i++) {
|
||||
PoiEntity poiEntity = allTaskStatus.get(i);
|
||||
String geoWkt = allTaskStatus.get(i).getGeoWkt();
|
||||
LatLng latLng = null;
|
||||
Log.d("TAG", "onSuccess: " + geoWkt);
|
||||
if (geoWkt != null) {
|
||||
String geo = Geohash.getInstance().decode(geoWkt);//解密geo
|
||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||
switch (geometry.getGeometryType()) {
|
||||
case "Point": //点
|
||||
latLng = GeometryTools.createLatLng(geo);
|
||||
break;
|
||||
case "LineString": //线
|
||||
case "MultiLineString"://多线
|
||||
BitmapDescriptor bitmapLine = null;
|
||||
int color = 0;
|
||||
if (poiEntity.getType() == 3) {//poi录像
|
||||
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.road_arrows);
|
||||
} else if (poiEntity.getType() == 4) {//道路录像
|
||||
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows);
|
||||
}
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
color = Color.parseColor("#FFE70C");
|
||||
} else {
|
||||
color = Color.parseColor("#BDBDBD");
|
||||
}
|
||||
List<LatLng> latLineString = GeometryTools.getLatLags(geo);
|
||||
// 构造 PolylineOnions
|
||||
PolylineOptions polylineOptions = new PolylineOptions()
|
||||
.addAll(latLineString)
|
||||
// 折线设置圆形线头
|
||||
.lineCap(true)
|
||||
.color(color)
|
||||
// 折线宽度为5像素
|
||||
.width(28)
|
||||
.arrow(true)
|
||||
.arrowSpacing(80)
|
||||
.arrowTexture(bitmapLine);
|
||||
// 绘制折线
|
||||
Polyline polyline = tencentMap.addPolyline(polylineOptions);
|
||||
if (polyline != null) {
|
||||
polyline.setZIndex(MARKER_LINE);
|
||||
removablesLocality.add(polyline);
|
||||
if (latLineString != null && latLineString.size() > 0) {
|
||||
latLng = latLineString.get(0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "Polygon": //面
|
||||
List<LatLng> latPolygon = GeometryTools.getLatLags(geo);
|
||||
Polygon polygon = tencentMap.addPolygon(new PolygonOptions().//连接封闭图形的点
|
||||
addAll(latPolygon).//填充颜色为浅蓝色
|
||||
fillColor(Color.parseColor("#97E0E7EC")).//边线颜色为黑色
|
||||
strokeColor(0xff00ff00).//边线宽度15像素
|
||||
strokeWidth(5));
|
||||
if (polygon != null) {
|
||||
polygon.setZIndex(MARKER_FACE);
|
||||
removablesLocality.add(polygon);
|
||||
Point centroid = geometry.getCentroid();
|
||||
double x = centroid.getX();
|
||||
double y = centroid.getY();
|
||||
latLng = new LatLng();
|
||||
latLng.setLatitude(y);
|
||||
latLng.setLongitude(x);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
String detail = allTaskStatus.get(i).getDetail();
|
||||
if (detail != null) {
|
||||
String geo = Geohash.getInstance().decode(detail);//解密geo
|
||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||
switch (geometry.getGeometryType()) {
|
||||
case "Point": //点
|
||||
latLng = GeometryTools.createLatLng(geo);
|
||||
break;
|
||||
case "LineString": //线
|
||||
case "MultiLineString"://多线
|
||||
BitmapDescriptor bitmapLine = null;
|
||||
int color = 0;
|
||||
if (poiEntity.getType() == 3) {//poi录像
|
||||
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.road_arrows);
|
||||
} else if (poiEntity.getType() == 4) {//道路录像
|
||||
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows);
|
||||
}
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
color = Color.parseColor("#FFE70C");
|
||||
} else {
|
||||
color = Color.parseColor("#BDBDBD");
|
||||
}
|
||||
List<LatLng> latLineString = GeometryTools.getLatLags(geo);
|
||||
// 构造 PolylineOnions
|
||||
PolylineOptions polylineOptions = new PolylineOptions()
|
||||
.addAll(latLineString)
|
||||
// 折线设置圆形线头
|
||||
.lineCap(true)
|
||||
.color(color)
|
||||
// 折线宽度为5像素
|
||||
.width(28)
|
||||
.arrow(true)
|
||||
.arrowSpacing(80)
|
||||
.arrowTexture(bitmapLine);
|
||||
// 绘制折线
|
||||
Polyline polyline = tencentMap.addPolyline(polylineOptions);
|
||||
if (polyline != null) {
|
||||
polyline.setZIndex(MARKER_LINE);
|
||||
removablesLocality.add(polyline);
|
||||
if (latLineString != null && latLineString.size() > 0) {
|
||||
latLng = latLineString.get(0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "Polygon": //面
|
||||
List<LatLng> latPolygon = GeometryTools.getLatLags(geo);
|
||||
Polygon polygon = tencentMap.addPolygon(new PolygonOptions().//连接封闭图形的点
|
||||
addAll(latPolygon).//填充颜色为浅蓝色
|
||||
fillColor(Color.parseColor("#97E0E7EC")).//边线颜色为黑色
|
||||
strokeColor(0xff00ff00).//边线宽度15像素
|
||||
strokeWidth(5));
|
||||
if (polygon != null) {
|
||||
polygon.setZIndex(MARKER_FACE);
|
||||
removablesLocality.add(polygon);
|
||||
Point centroid = geometry.getCentroid();
|
||||
double x = centroid.getX();
|
||||
double y = centroid.getY();
|
||||
latLng = new LatLng();
|
||||
latLng.setLatitude(y);
|
||||
latLng.setLongitude(x);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (allTaskStatus.get(i).getX() != null && allTaskStatus.get(i).getY() != null) {
|
||||
latLng = new LatLng(Double.parseDouble(allTaskStatus.get(i).getY()), Double.parseDouble(allTaskStatus.get(i).getX()));
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (poiEntity.getType()) {
|
||||
case 1://poi
|
||||
BitmapDescriptor poiDescriptor = null;
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi);
|
||||
} else {
|
||||
poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.graypoi);
|
||||
}
|
||||
assert latLng != null;
|
||||
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor)
|
||||
.flat(true)
|
||||
.anchor(0.5f, 1f)
|
||||
.clockwise(false));
|
||||
poiMarker.setClickable(true);
|
||||
poiMarker.setZIndex(MARKER_DOT);
|
||||
poiMarker.setTitle(poiEntity.getName() + "");
|
||||
poiMarker.setTag(poiEntity);
|
||||
removablesLocality.add(poiMarker);
|
||||
String poiGeo = initGeo(latLng);
|
||||
geoMarker(poiGeo, poiMarker);
|
||||
break;
|
||||
case 2://充电站
|
||||
BitmapDescriptor chargeDescriptor = null;
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge);
|
||||
} else {
|
||||
chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.graycharge);
|
||||
}
|
||||
assert latLng != null;
|
||||
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor)
|
||||
.flat(true)
|
||||
.anchor(0.5f, 1f)
|
||||
.clockwise(false));
|
||||
stationMarker.setClickable(true);
|
||||
stationMarker.setZIndex(MARKER_DOT);
|
||||
stationMarker.setTitle(poiEntity.getName() + "");
|
||||
stationMarker.setTag(poiEntity);
|
||||
removablesLocality.add(stationMarker);
|
||||
String stationGeo = initGeo(latLng);
|
||||
geoMarker(stationGeo, stationMarker);
|
||||
break;
|
||||
case 3://poi录像
|
||||
BitmapDescriptor poiVideoDescriptor = null;
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_video);
|
||||
} else {
|
||||
poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.graypoivideo);
|
||||
}
|
||||
assert latLng != null;
|
||||
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor)
|
||||
.anchor(0.5f, 1f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
poiVideoMarker.setClickable(true);
|
||||
poiVideoMarker.setZIndex(MARKER_DOT);
|
||||
poiVideoMarker.setTitle(poiEntity.getName() + "");
|
||||
poiVideoMarker.setTag(poiEntity);
|
||||
removablesLocality.add(poiVideoMarker);
|
||||
String poiVideoGeo = initGeo(latLng);
|
||||
geoMarker(poiVideoGeo, poiVideoMarker);
|
||||
break;
|
||||
case 4://道路录像
|
||||
BitmapDescriptor roadDescriptor = null;
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road);
|
||||
} else {
|
||||
roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.grayroad);
|
||||
}
|
||||
assert latLng != null;
|
||||
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor)
|
||||
.anchor(0.5f, 1f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
roadMarker.setClickable(true);
|
||||
roadMarker.setZIndex(MARKER_DOT);
|
||||
roadMarker.setTitle(poiEntity.getName() + "");
|
||||
roadMarker.setTag(poiEntity);
|
||||
removablesLocality.add(roadMarker);
|
||||
String roadGeo = initGeo(latLng);
|
||||
geoMarker(roadGeo, roadMarker);
|
||||
break;
|
||||
case 5://其他
|
||||
BitmapDescriptor otherDescriptor = null;
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other);
|
||||
} else {
|
||||
otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.grayother);
|
||||
}
|
||||
assert latLng != null;
|
||||
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor)
|
||||
.anchor(0.5f, 1f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
otherMarker.setClickable(true);
|
||||
otherMarker.setZIndex(MARKER_DOT);
|
||||
otherMarker.setTitle(poiEntity.getName() + "");
|
||||
otherMarker.setTag(poiEntity);
|
||||
removablesLocality.add(otherMarker);
|
||||
String otherGeo = initGeo(latLng);
|
||||
geoMarker(otherGeo, otherMarker);
|
||||
break;
|
||||
case 6://面状任务
|
||||
BitmapDescriptor Descriptor = null;
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_facet);
|
||||
} else {
|
||||
Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.grayfacet);
|
||||
}
|
||||
assert latLng != null;
|
||||
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor)
|
||||
.anchor(0.5f, 1f)
|
||||
.clockwise(false)
|
||||
.flat(true));
|
||||
planarMarker.setClickable(true);
|
||||
planarMarker.setZIndex(MARKER_DOT);
|
||||
planarMarker.setTitle(poiEntity.getName() + "");
|
||||
planarMarker.setTag(poiEntity);
|
||||
removablesLocality.add(planarMarker);
|
||||
String planarGeo = initGeo(latLng);
|
||||
geoMarker(planarGeo, planarMarker);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_SEARCH_POI_WORD;
|
||||
obtain.obj = allTaskStatus;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(Message data) {
|
||||
@ -1973,7 +1458,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
point.set(minX, minY);
|
||||
lngArrayList.add(new LatLng(projection.fromScreenLocation(point)));
|
||||
poiEntityArrayList = new ArrayList<>();
|
||||
com.vividsolutions.jts.geom.Polygon polygon = GeometryTools.createPolygon(lngArrayList);
|
||||
org.locationtech.jts.geom.Polygon polygon = GeometryTools.createPolygon(lngArrayList);
|
||||
//多点
|
||||
MultiPoint multiPoint = GeometryTools.createMultiPoint(latList);
|
||||
//拿到覆蓋點
|
||||
@ -2124,11 +1609,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
}
|
||||
|
||||
/*获取屏幕中心点位置*/
|
||||
public LatLng getMapCenterPoint() {
|
||||
return tencentMap.getCameraPosition().target;
|
||||
}
|
||||
|
||||
/*自定义dialog*/
|
||||
public void customDialog(List<PoiEntity> list, Marker marker) {
|
||||
AlertDialog dialog = builder.create();
|
||||
@ -2251,4 +1731,16 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
}
|
||||
|
||||
private void geoMarker(String geo, Marker marker) {
|
||||
if (!removableHashMap.containsKey(geo)) {
|
||||
List<Marker> markers = new ArrayList<>();
|
||||
markers.add(marker);
|
||||
removableHashMap.put(geo, markers);
|
||||
} else {
|
||||
List<Marker> markers = removableHashMap.get(geo);
|
||||
assert markers != null;
|
||||
markers.add(marker);
|
||||
removableHashMap.put(geo, markers);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package com.navinfo.outdoor.room;
|
||||
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Delete;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.OnConflictStrategy;
|
||||
import androidx.room.Query;
|
||||
import androidx.room.Update;
|
||||
|
||||
import com.navinfo.outdoor.bean.LocationRecorder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 访问数据库操作的接口
|
||||
*/
|
||||
@Dao
|
||||
public interface LocationRecorderDao {
|
||||
/*
|
||||
* 查询
|
||||
*/
|
||||
@Query("SELECT * FROM LocationRecorder")
|
||||
List<LocationRecorder> getAllLocationRecorder();
|
||||
|
||||
@Query("SELECT * FROM LocationRecorder where time >= :startTime and time<=:endTime order by time")
|
||||
List<LocationRecorder> getLocationRecorderByTime(long startTime, long endTime);
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insertLocationRecorder(LocationRecorder... locationRecorders);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
@Update
|
||||
void updateLocationRecorder(LocationRecorder... locationRecorders);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@Delete
|
||||
void deleteLocationRecorder(LocationRecorder... locationRecorders);
|
||||
|
||||
/**
|
||||
* 根据条件删除
|
||||
*/
|
||||
@Query("DELETE FROM LocationRecorder where time >= :startTime and time<=:endTime ")
|
||||
void deleteForTime(long startTime, long endTime);
|
||||
|
||||
|
||||
/**
|
||||
* 全部删除
|
||||
*/
|
||||
@Query("DELETE FROM LocationRecorder")
|
||||
void deleteAllLocationRecorder();
|
||||
}
|
@ -10,6 +10,7 @@ import androidx.room.migration.Migration;
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase;
|
||||
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.bean.LocationRecorder;
|
||||
import com.navinfo.outdoor.util.SdkFolderCreate;
|
||||
|
||||
import java.io.File;
|
||||
@ -27,7 +28,7 @@ import java.io.File;
|
||||
* 如果需要在主线程调用则使用allowMainThreadQueries进行说明。
|
||||
*/
|
||||
|
||||
@Database(entities = {PoiEntity.class,ChargingPileEntity.class}, version = 2, exportSchema = false)
|
||||
@Database(entities = {PoiEntity.class,ChargingPileEntity.class, LocationRecorder.class}, version = 3, exportSchema = false)
|
||||
public abstract class PoiDatabase extends RoomDatabase {
|
||||
private static final String DB_NAME = "navinfo.db";
|
||||
private static volatile PoiDatabase instance;
|
||||
@ -50,6 +51,7 @@ public abstract class PoiDatabase extends RoomDatabase {
|
||||
getDbName=dbFolder.getAbsolutePath()+"/"+DB_NAME;
|
||||
return Room.databaseBuilder(context, PoiDatabase.class, Constant.POI_DAO+"/"+DB_NAME)
|
||||
.addMigrations(migration_1_2)
|
||||
.addMigrations(migration_2_3)
|
||||
//.fallbackToDestructiveMigration()//数据库更新时删除数据重新创建 改动特别大的时候在用
|
||||
.build();
|
||||
}
|
||||
@ -65,23 +67,20 @@ public abstract class PoiDatabase extends RoomDatabase {
|
||||
private static Migration migration_2_3 = new Migration(2, 3) {
|
||||
@Override
|
||||
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
||||
database.execSQL("ALTER TABLE poi ADD stage TEXT DEFAULT ''");
|
||||
}
|
||||
};
|
||||
private static Migration migration_3_4 = new Migration(3, 4) {
|
||||
@Override
|
||||
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
||||
database.execSQL("ALTER TABLE poi ADD views INTEGER NOT NULL DEFAULT 0");
|
||||
}
|
||||
};
|
||||
private static Migration migration_4_5 = new Migration(4, 5) {
|
||||
@Override
|
||||
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
||||
database.execSQL("ALTER TABLE poi ADD partner INTEGER NOT NULL DEFAULT 0");
|
||||
database.execSQL("CREATE TABLE LocationRecorder (" +
|
||||
"time INTEGER PRIMARY KEY NOT NULL ," +
|
||||
"tencentLocationX REAL NOT NULL ," +
|
||||
"tencentLocationY REAL NOT NULL ," +
|
||||
"gpsLocationX REAL NOT NULL ," +
|
||||
"gpsLocationY REAL NOT NULL ," +
|
||||
"rssi INTEGER NOT NULL ," +
|
||||
"bearing REAL NOT NULL," +
|
||||
"satelliteCount INTEGER NOT NULL ," +
|
||||
"imgFileName TEXT)");//添加轨迹记录功能
|
||||
}
|
||||
};
|
||||
|
||||
public abstract PoiDao getPoiDao();//其他信息
|
||||
public abstract ChargingPileDao getChargingPileDao();//充电桩
|
||||
|
||||
public abstract LocationRecorderDao getRecorderDao();
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.navinfo.outdoor.util;
|
||||
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
|
@ -3,17 +3,18 @@ package com.navinfo.outdoor.util;
|
||||
import android.graphics.Point;
|
||||
import android.util.Log;
|
||||
|
||||
import com.navinfo.outdoor.activity.MyCoordinate;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.geom.GeometryFactory;
|
||||
import com.vividsolutions.jts.geom.LineString;
|
||||
import com.vividsolutions.jts.geom.MultiLineString;
|
||||
import com.vividsolutions.jts.geom.MultiPoint;
|
||||
import com.vividsolutions.jts.geom.MultiPolygon;
|
||||
import com.vividsolutions.jts.geom.Polygon;
|
||||
import com.vividsolutions.jts.io.WKTReader;
|
||||
import org.locationtech.jts.geom.Coordinate;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
import org.locationtech.jts.geom.GeometryFactory;
|
||||
import org.locationtech.jts.geom.LineString;
|
||||
import org.locationtech.jts.geom.MultiLineString;
|
||||
import org.locationtech.jts.geom.MultiPoint;
|
||||
import org.locationtech.jts.geom.MultiPolygon;
|
||||
import org.locationtech.jts.geom.Polygon;
|
||||
import org.locationtech.jts.io.WKTReader;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
@ -263,8 +264,8 @@ public class GeometryTools {
|
||||
/**
|
||||
* 创建点
|
||||
*/
|
||||
public com.vividsolutions.jts.geom.Point createPoint(Coordinate chord) {
|
||||
com.vividsolutions.jts.geom.Point point = null;
|
||||
public org.locationtech.jts.geom.Point createPoint(Coordinate chord) {
|
||||
org.locationtech.jts.geom.Point point = null;
|
||||
GeometryFactory factory = new GeometryFactory();
|
||||
point = factory.createPoint(chord);
|
||||
return point;
|
||||
@ -286,7 +287,7 @@ public class GeometryTools {
|
||||
try {
|
||||
geometers = reader.read(geometry);
|
||||
if (geometers != null) {
|
||||
com.vividsolutions.jts.geom.Point point = geometers.getInteriorPoint();
|
||||
org.locationtech.jts.geom.Point point = geometers.getInteriorPoint();
|
||||
LatLng geoInteriorPoint = new LatLng(point.getY(), point.getX());
|
||||
if (geometers.getGeometryType().equalsIgnoreCase("Point")) {
|
||||
Coordinate coordinate = geometers.getCoordinate();
|
||||
@ -570,6 +571,42 @@ public class GeometryTools {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取线型
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
public static LineString getLineStringByPointList(List<org.locationtech.jts.geom.Point> list) {
|
||||
|
||||
if (list != null && list.size() > 1) {
|
||||
int size = list.size();
|
||||
Coordinate[] coors = new Coordinate[size];
|
||||
for (int i = 0; i < size; i++) {
|
||||
org.locationtech.jts.geom.Point point = list.get(i);
|
||||
coors[i] = new Coordinate(point.getX(), point.getY());
|
||||
}
|
||||
return getLineStrinGeo(coors);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/*
|
||||
* 获取线型
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
public static LineString getLineStringByMyCoordinate(List<MyCoordinate> list) {
|
||||
|
||||
if (list != null && list.size() > 1) {
|
||||
int size = list.size();
|
||||
Coordinate[] coors = new Coordinate[size];
|
||||
for (int i = 0; i < size; i++) {
|
||||
coors[i] = new Coordinate(list.get(i).getX(), list.get(i).getY());
|
||||
}
|
||||
return getLineStrinGeo(coors);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取线型
|
||||
* @param coors
|
||||
@ -941,7 +978,7 @@ public class GeometryTools {
|
||||
if (wkts == null || wkts.size() == 0 || LatLng == null) {
|
||||
return -1;
|
||||
}
|
||||
com.vividsolutions.jts.geom.Point point = createPoint(new Coordinate(LatLng.getLongitude(), LatLng.getLatitude()));
|
||||
org.locationtech.jts.geom.Point point = createPoint(new Coordinate(LatLng.getLongitude(), LatLng.getLatitude()));
|
||||
for (int i = 0; i < wkts.size(); i++) {
|
||||
Geometry geometry = createGeometry(wkts.get(i));
|
||||
if (geometry != null && geometry.getGeometryType().equals("Polygon")) {
|
||||
@ -1187,4 +1224,5 @@ public class GeometryTools {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,646 @@
|
||||
package com.navinfo.outdoor.util;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.bean.JobSearchBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
import com.tencent.map.geolocation.TencentLocation;
|
||||
import com.tencent.tencentmap.mapsdk.maps.interfaces.Removable;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.Polygon;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.PolygonOptions;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.Polyline;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
|
||||
import org.locationtech.jts.geom.Point;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 处理marker的公共类
|
||||
* */
|
||||
public class TencentMarkerUtils {
|
||||
public static final int MARKER_DOT = 3;
|
||||
public static final int MARKER_LINE = 2;
|
||||
public static final int MARKER_FACE = 1;
|
||||
public static final int MARKER_BIG = 4;
|
||||
// 根据当前位置和屏幕中心点位置,获取marker列表数据
|
||||
/**
|
||||
* 网络删选接口
|
||||
*
|
||||
* @param tencentLocation location 用户当前位置
|
||||
*/
|
||||
public void initNetMarkerList(Activity mContext, TencentLocation tencentLocation, TencentMap tencentMap, List<Removable> removables, String taskTypeStr, String taskStatusStr, Map<String, List<Marker>> removableHashMap, int pageSize, MarkerInitCallback callback) {
|
||||
int task_type = Constant.TASK_TYPE;
|
||||
if (taskTypeStr != null) {
|
||||
task_type = Integer.parseInt(taskTypeStr);
|
||||
}
|
||||
int limit_type = Constant.LIMIT_TYPE;
|
||||
int taskStatus = Constant.TASK_STARTUP;
|
||||
if (taskTypeStr!=null) {
|
||||
taskStatus = Integer.parseInt(taskStatusStr);
|
||||
}
|
||||
if (taskStatus == 1) {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_SEARCH_WORD;
|
||||
obtain.obj = null;
|
||||
EventBus.getDefault().post(obtain);
|
||||
return;
|
||||
}
|
||||
LatLng mapCenterPoint = tencentMap.getCameraPosition().target;
|
||||
if (mapCenterPoint == null) {
|
||||
mapCenterPoint = new LatLng(tencentLocation.getLatitude(), tencentLocation.getLongitude());
|
||||
}
|
||||
|
||||
//获取中心点位置
|
||||
String centerEncode = Geohash.getInstance().encode(mapCenterPoint.latitude, mapCenterPoint.longitude);
|
||||
String userEncode = Geohash.getInstance().encode(tencentLocation.getLatitude(), tencentLocation.getLongitude());
|
||||
OkGo.getInstance().cancelTag(this);
|
||||
Log.d("TAG", "initList: " + Constant.USHERED);
|
||||
// 请求方式和请求url
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("userGeo", userEncode);
|
||||
httpParams.put("centerGeo", centerEncode);
|
||||
if (pageSize>0) {
|
||||
httpParams.put("pageSize", pageSize);
|
||||
} else {
|
||||
httpParams.put("pageSize", Constant.NUMBER);
|
||||
}
|
||||
httpParams.put("pageNum", 1);
|
||||
httpParams.put("type", task_type);
|
||||
httpParams.put("isExclusive", limit_type);
|
||||
if (taskStatus == 2) {
|
||||
if (Constant.USHERED != null) {
|
||||
httpParams.put("received", Constant.USHERED);
|
||||
}
|
||||
}
|
||||
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
||||
.time(30)
|
||||
.Builder(mContext)
|
||||
.url(HttpInterface.TASK_LIST)
|
||||
.cls(JobSearchBean.class)
|
||||
.params(httpParams)
|
||||
.token(Constant.ACCESS_TOKEN);
|
||||
okGoBuilder.getRequest(new Callback<JobSearchBean>() {
|
||||
@Override
|
||||
public void onSuccess(JobSearchBean response, int id) {
|
||||
if (response.getCode() == 200) {
|
||||
JobSearchBean.BodyBean body = response.getBody();
|
||||
if (body != null) {
|
||||
Log.d("TAG", "onSuccess: " + response.getBody().toString());
|
||||
for (int i = 0; i < removables.size(); i++) {
|
||||
removables.get(i).remove();
|
||||
}
|
||||
removables.clear();
|
||||
List<JobSearchBean.BodyBean.ListBean> list = response.getBody().getList();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
JobSearchBean.BodyBean.ListBean listBean = list.get(i);
|
||||
String encodeStr = list.get(i).getGeo();
|
||||
// 解密geo
|
||||
String geo = Geohash.getInstance().decode(encodeStr);
|
||||
Log.d("TAG", "onSuccess: " + geo);
|
||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||
LatLng latLng = null;
|
||||
switch (geometry.getGeometryType()) {
|
||||
case "LineString": //线
|
||||
case "MultiLineString"://多线
|
||||
BitmapDescriptor bitmapLine = null;
|
||||
if (listBean.getType() == 3) {//poi录像
|
||||
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.road_arrows);
|
||||
} else if (listBean.getType() == 4) {//道路录像
|
||||
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows);
|
||||
}
|
||||
List<LatLng> latLineString = GeometryTools.getLatLags(geo);
|
||||
// 构造 PolylineOptions
|
||||
PolylineOptions polylineOptions = new PolylineOptions()
|
||||
.addAll(latLineString)
|
||||
// 折线设置圆形线头
|
||||
.lineCap(true)
|
||||
// 折线的颜色为绿色
|
||||
.color(Color.parseColor("#0096FF"))
|
||||
// 折线宽度为5像素
|
||||
.width(28)
|
||||
// 还可以添加描边颜色
|
||||
//.borderColor(0xffff0000)
|
||||
// 描边颜色的宽度,线宽还是 25 像素,不过填充的部分宽度为 `width` - 2 * `borderWidth`
|
||||
//.borderWidth(1);
|
||||
.arrow(true)
|
||||
.arrowSpacing(80)
|
||||
.arrowTexture(bitmapLine);
|
||||
// 绘制折线
|
||||
Polyline polyline = tencentMap.addPolyline(polylineOptions);
|
||||
if (polyline != null) {
|
||||
polyline.setZIndex(MARKER_LINE);
|
||||
removables.add(polyline);
|
||||
if (latLineString != null && latLineString.size() > 0) {
|
||||
latLng = latLineString.get(0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "Point": //点
|
||||
latLng = GeometryTools.createLatLng(geo);
|
||||
break;
|
||||
case "Polygon": //面
|
||||
List<LatLng> latPolygon = GeometryTools.getLatLags(geo);
|
||||
Polygon polygon = tencentMap.addPolygon(new PolygonOptions().
|
||||
//连接封闭图形的点
|
||||
addAll(latPolygon).
|
||||
//填充颜色为红色
|
||||
fillColor(Color.parseColor("#97E0E7EC")).
|
||||
//边线颜色为黑色
|
||||
strokeColor(0xff000000).
|
||||
//边线宽度15像素
|
||||
strokeWidth(5));
|
||||
if (polygon != null) {
|
||||
polygon.setZIndex(MARKER_FACE);
|
||||
removables.add(polygon);
|
||||
org.locationtech.jts.geom.Point centroid = geometry.getCentroid();
|
||||
double x = centroid.getX();
|
||||
double y = centroid.getY();
|
||||
latLng = new LatLng();
|
||||
latLng.setLatitude(y);
|
||||
latLng.setLongitude(x);
|
||||
}
|
||||
break;
|
||||
}
|
||||
switch (list.get(i).getType()) {
|
||||
case 1://poi
|
||||
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi);
|
||||
//poiDescriptor.getForager().setScale(50);
|
||||
assert latLng != null;
|
||||
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.9f)
|
||||
.anchor(0.5f, 1.0f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
if (poiMarker != null) {
|
||||
if (listBean != null) {
|
||||
poiMarker.setTag(listBean);
|
||||
}
|
||||
poiMarker.setZIndex(MARKER_DOT);
|
||||
removables.add(poiMarker);
|
||||
String poiGeo = initGeo(latLng);
|
||||
geoMarker(poiGeo, poiMarker, removableHashMap);
|
||||
poiMarker.setClickable(true);
|
||||
}
|
||||
break;
|
||||
case 2://充电站
|
||||
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge);
|
||||
assert latLng != null;
|
||||
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor).alpha(0.9f)
|
||||
.anchor(0.5f, 1.0f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
if (stationMarker != null) {
|
||||
if (listBean != null) {
|
||||
stationMarker.setTag(listBean);
|
||||
}
|
||||
stationMarker.setZIndex(MARKER_DOT);
|
||||
removables.add(stationMarker);
|
||||
String stationGeo = initGeo(latLng);
|
||||
geoMarker(stationGeo, stationMarker, removableHashMap);
|
||||
stationMarker.setClickable(true);
|
||||
}
|
||||
break;
|
||||
case 3://poi录像
|
||||
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_video);
|
||||
assert latLng != null;
|
||||
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor).alpha(0.9f)
|
||||
.anchor(0.5f, 1.0f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
if (poiVideoMarker != null) {
|
||||
if (listBean != null) {
|
||||
poiVideoMarker.setTag(listBean);
|
||||
}
|
||||
poiVideoMarker.setZIndex(MARKER_DOT);
|
||||
removables.add(poiVideoMarker);
|
||||
String poiVideoGeo = initGeo(latLng);
|
||||
geoMarker(poiVideoGeo, poiVideoMarker, removableHashMap);
|
||||
poiVideoMarker.setClickable(true);
|
||||
}
|
||||
break;
|
||||
case 4://道路录像
|
||||
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road);
|
||||
assert latLng != null;
|
||||
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).alpha(0.9f)
|
||||
.anchor(0.5f, 1.0f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
if (roadMarker != null) {
|
||||
if (listBean != null) {
|
||||
roadMarker.setTag(listBean);
|
||||
}
|
||||
roadMarker.setZIndex(MARKER_DOT);
|
||||
removables.add(roadMarker);
|
||||
String roadGeo = initGeo(latLng);
|
||||
geoMarker(roadGeo, roadMarker, removableHashMap);
|
||||
roadMarker.setClickable(true);
|
||||
}
|
||||
break;
|
||||
case 5://其他
|
||||
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other);
|
||||
assert latLng != null;
|
||||
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).alpha(0.9f)
|
||||
.anchor(0.5f, 1.0f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
if (otherMarker != null) {
|
||||
if (listBean != null) {
|
||||
otherMarker.setTag(listBean);
|
||||
}
|
||||
otherMarker.setZIndex(MARKER_DOT);
|
||||
removables.add(otherMarker);
|
||||
String otherGeo = initGeo(latLng);
|
||||
geoMarker(otherGeo, otherMarker, removableHashMap);
|
||||
otherMarker.setClickable(true);
|
||||
}
|
||||
break;
|
||||
case 6://面状任务
|
||||
BitmapDescriptor Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_facet);
|
||||
assert latLng != null;
|
||||
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor).alpha(0.9f)
|
||||
.anchor(0.5f, 1.0f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
if (planarMarker != null) {
|
||||
if (listBean != null) {
|
||||
planarMarker.setTag(listBean);
|
||||
}
|
||||
planarMarker.setZIndex(MARKER_DOT);
|
||||
removables.add(planarMarker);
|
||||
String planarGeo = initGeo(latLng);
|
||||
geoMarker(planarGeo, planarMarker, removableHashMap);
|
||||
planarMarker.setClickable(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
callback.onMarkerInit(removableHashMap, response.getBody().getUpload(), list);
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_SEARCH_WORD;
|
||||
obtain.obj = response;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
} else if (response.getCode() == 230) {
|
||||
FlushTokenUtil.flushToken(mContext);
|
||||
} else {
|
||||
ToastUtils.Message(mContext, response.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
String message = e.getMessage();
|
||||
assert message != null;
|
||||
if (message.equals("timeout") || message.equals("Read time out")) {
|
||||
ToastUtils.Message(mContext, "请求超时");
|
||||
} else {
|
||||
ToastUtils.Message(mContext, message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*本地数据库数据*/
|
||||
public void initLocalMarker(Activity mContext, TencentMap tencentMap, List<Removable> removablesLocality, Map<String, List<Marker>> removableHashMap, MarkerInitCallback callback) {
|
||||
int taskStatus = Constant.TASK_STARTUP;
|
||||
int type = Constant.TASK_TYPE;
|
||||
int limit = Constant.LIMIT_TYPE;
|
||||
PoiDatabase poiDatabase = PoiDatabase.getInstance(mContext);
|
||||
if (poiDatabase == null) {
|
||||
return;
|
||||
}
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<PoiEntity> allTaskStatus = poiDatabase.getPoiDao().getAllTaskStatus(taskStatus, taskStatus, type, type, limit, limit);
|
||||
if (mContext != null) {
|
||||
mContext.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (int i = 0; i < removablesLocality.size(); i++) {
|
||||
removablesLocality.get(i).remove();
|
||||
}
|
||||
removablesLocality.clear();
|
||||
for (int i = 0; i < allTaskStatus.size(); i++) {
|
||||
PoiEntity poiEntity = allTaskStatus.get(i);
|
||||
String geoWkt = allTaskStatus.get(i).getGeoWkt();
|
||||
LatLng latLng = null;
|
||||
Log.d("TAG", "onSuccess: " + geoWkt);
|
||||
if (geoWkt != null) {
|
||||
String geo = Geohash.getInstance().decode(geoWkt);//解密geo
|
||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||
switch (geometry.getGeometryType()) {
|
||||
case "Point": //点
|
||||
latLng = GeometryTools.createLatLng(geo);
|
||||
break;
|
||||
case "LineString": //线
|
||||
case "MultiLineString"://多线
|
||||
BitmapDescriptor bitmapLine = null;
|
||||
int color = 0;
|
||||
if (poiEntity.getType() == 3) {//poi录像
|
||||
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.road_arrows);
|
||||
} else if (poiEntity.getType() == 4) {//道路录像
|
||||
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows);
|
||||
}
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
color = Color.parseColor("#FFE70C");
|
||||
} else {
|
||||
color = Color.parseColor("#BDBDBD");
|
||||
}
|
||||
List<LatLng> latLineString = GeometryTools.getLatLags(geo);
|
||||
// 构造 PolylineOnions
|
||||
PolylineOptions polylineOptions = new PolylineOptions()
|
||||
.addAll(latLineString)
|
||||
// 折线设置圆形线头
|
||||
.lineCap(true)
|
||||
.color(color)
|
||||
// 折线宽度为5像素
|
||||
.width(28)
|
||||
.arrow(true)
|
||||
.arrowSpacing(80)
|
||||
.arrowTexture(bitmapLine);
|
||||
// 绘制折线
|
||||
Polyline polyline = tencentMap.addPolyline(polylineOptions);
|
||||
if (polyline != null) {
|
||||
polyline.setZIndex(MARKER_LINE);
|
||||
removablesLocality.add(polyline);
|
||||
if (latLineString != null && latLineString.size() > 0) {
|
||||
latLng = latLineString.get(0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "Polygon": //面
|
||||
List<LatLng> latPolygon = GeometryTools.getLatLags(geo);
|
||||
Polygon polygon = tencentMap.addPolygon(new PolygonOptions().//连接封闭图形的点
|
||||
addAll(latPolygon).//填充颜色为浅蓝色
|
||||
fillColor(Color.parseColor("#97E0E7EC")).//边线颜色为黑色
|
||||
strokeColor(0xff00ff00).//边线宽度15像素
|
||||
strokeWidth(5));
|
||||
if (polygon != null) {
|
||||
polygon.setZIndex(MARKER_FACE);
|
||||
removablesLocality.add(polygon);
|
||||
Point centroid = geometry.getCentroid();
|
||||
double x = centroid.getX();
|
||||
double y = centroid.getY();
|
||||
latLng = new LatLng();
|
||||
latLng.setLatitude(y);
|
||||
latLng.setLongitude(x);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
String detail = allTaskStatus.get(i).getDetail();
|
||||
if (detail != null) {
|
||||
String geo = Geohash.getInstance().decode(detail);//解密geo
|
||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||
switch (geometry.getGeometryType()) {
|
||||
case "Point": //点
|
||||
latLng = GeometryTools.createLatLng(geo);
|
||||
break;
|
||||
case "LineString": //线
|
||||
case "MultiLineString"://多线
|
||||
BitmapDescriptor bitmapLine = null;
|
||||
int color = 0;
|
||||
if (poiEntity.getType() == 3) {//poi录像
|
||||
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.road_arrows);
|
||||
} else if (poiEntity.getType() == 4) {//道路录像
|
||||
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows);
|
||||
}
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
color = Color.parseColor("#FFE70C");
|
||||
} else {
|
||||
color = Color.parseColor("#BDBDBD");
|
||||
}
|
||||
List<LatLng> latLineString = GeometryTools.getLatLags(geo);
|
||||
// 构造 PolylineOnions
|
||||
PolylineOptions polylineOptions = new PolylineOptions()
|
||||
.addAll(latLineString)
|
||||
// 折线设置圆形线头
|
||||
.lineCap(true)
|
||||
.color(color)
|
||||
// 折线宽度为5像素
|
||||
.width(28)
|
||||
.arrow(true)
|
||||
.arrowSpacing(80)
|
||||
.arrowTexture(bitmapLine);
|
||||
// 绘制折线
|
||||
Polyline polyline = tencentMap.addPolyline(polylineOptions);
|
||||
if (polyline != null) {
|
||||
polyline.setZIndex(MARKER_LINE);
|
||||
removablesLocality.add(polyline);
|
||||
if (latLineString != null && latLineString.size() > 0) {
|
||||
latLng = latLineString.get(0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "Polygon": //面
|
||||
List<LatLng> latPolygon = GeometryTools.getLatLags(geo);
|
||||
Polygon polygon = tencentMap.addPolygon(new PolygonOptions().//连接封闭图形的点
|
||||
addAll(latPolygon).//填充颜色为浅蓝色
|
||||
fillColor(Color.parseColor("#97E0E7EC")).//边线颜色为黑色
|
||||
strokeColor(0xff00ff00).//边线宽度15像素
|
||||
strokeWidth(5));
|
||||
if (polygon != null) {
|
||||
polygon.setZIndex(MARKER_FACE);
|
||||
removablesLocality.add(polygon);
|
||||
Point centroid = geometry.getCentroid();
|
||||
double x = centroid.getX();
|
||||
double y = centroid.getY();
|
||||
latLng = new LatLng();
|
||||
latLng.setLatitude(y);
|
||||
latLng.setLongitude(x);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (allTaskStatus.get(i).getX() != null && allTaskStatus.get(i).getY() != null) {
|
||||
latLng = new LatLng(Double.parseDouble(allTaskStatus.get(i).getY()), Double.parseDouble(allTaskStatus.get(i).getX()));
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (poiEntity.getType()) {
|
||||
case 1://poi
|
||||
BitmapDescriptor poiDescriptor = null;
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi);
|
||||
} else {
|
||||
poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.graypoi);
|
||||
}
|
||||
assert latLng != null;
|
||||
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor)
|
||||
.flat(true)
|
||||
.anchor(0.5f, 1f)
|
||||
.clockwise(false));
|
||||
poiMarker.setClickable(true);
|
||||
poiMarker.setZIndex(MARKER_DOT);
|
||||
poiMarker.setTitle(poiEntity.getName() + "");
|
||||
poiMarker.setTag(poiEntity);
|
||||
removablesLocality.add(poiMarker);
|
||||
String poiGeo = initGeo(latLng);
|
||||
geoMarker(poiGeo, poiMarker, removableHashMap);
|
||||
break;
|
||||
case 2://充电站
|
||||
BitmapDescriptor chargeDescriptor = null;
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge);
|
||||
} else {
|
||||
chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.graycharge);
|
||||
}
|
||||
assert latLng != null;
|
||||
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor)
|
||||
.flat(true)
|
||||
.anchor(0.5f, 1f)
|
||||
.clockwise(false));
|
||||
stationMarker.setClickable(true);
|
||||
stationMarker.setZIndex(MARKER_DOT);
|
||||
stationMarker.setTitle(poiEntity.getName() + "");
|
||||
stationMarker.setTag(poiEntity);
|
||||
removablesLocality.add(stationMarker);
|
||||
String stationGeo = initGeo(latLng);
|
||||
geoMarker(stationGeo, stationMarker, removableHashMap);
|
||||
break;
|
||||
case 3://poi录像
|
||||
BitmapDescriptor poiVideoDescriptor = null;
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_video);
|
||||
} else {
|
||||
poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.graypoivideo);
|
||||
}
|
||||
assert latLng != null;
|
||||
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor)
|
||||
.anchor(0.5f, 1f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
poiVideoMarker.setClickable(true);
|
||||
poiVideoMarker.setZIndex(MARKER_DOT);
|
||||
poiVideoMarker.setTitle(poiEntity.getName() + "");
|
||||
poiVideoMarker.setTag(poiEntity);
|
||||
removablesLocality.add(poiVideoMarker);
|
||||
String poiVideoGeo = initGeo(latLng);
|
||||
geoMarker(poiVideoGeo, poiVideoMarker, removableHashMap);
|
||||
break;
|
||||
case 4://道路录像
|
||||
BitmapDescriptor roadDescriptor = null;
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road);
|
||||
} else {
|
||||
roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.grayroad);
|
||||
}
|
||||
assert latLng != null;
|
||||
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor)
|
||||
.anchor(0.5f, 1f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
roadMarker.setClickable(true);
|
||||
roadMarker.setZIndex(MARKER_DOT);
|
||||
roadMarker.setTitle(poiEntity.getName() + "");
|
||||
roadMarker.setTag(poiEntity);
|
||||
removablesLocality.add(roadMarker);
|
||||
String roadGeo = initGeo(latLng);
|
||||
geoMarker(roadGeo, roadMarker, removableHashMap);
|
||||
break;
|
||||
case 5://其他
|
||||
BitmapDescriptor otherDescriptor = null;
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other);
|
||||
} else {
|
||||
otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.grayother);
|
||||
}
|
||||
assert latLng != null;
|
||||
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor)
|
||||
.anchor(0.5f, 1f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
otherMarker.setClickable(true);
|
||||
otherMarker.setZIndex(MARKER_DOT);
|
||||
otherMarker.setTitle(poiEntity.getName() + "");
|
||||
otherMarker.setTag(poiEntity);
|
||||
removablesLocality.add(otherMarker);
|
||||
String otherGeo = initGeo(latLng);
|
||||
geoMarker(otherGeo, otherMarker, removableHashMap);
|
||||
break;
|
||||
case 6://面状任务
|
||||
BitmapDescriptor Descriptor = null;
|
||||
if (poiEntity.getTaskStatus() == 1) {
|
||||
Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_facet);
|
||||
} else {
|
||||
Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.grayfacet);
|
||||
}
|
||||
assert latLng != null;
|
||||
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor)
|
||||
.anchor(0.5f, 1f)
|
||||
.clockwise(false)
|
||||
.flat(true));
|
||||
planarMarker.setClickable(true);
|
||||
planarMarker.setZIndex(MARKER_DOT);
|
||||
planarMarker.setTitle(poiEntity.getName() + "");
|
||||
planarMarker.setTag(poiEntity);
|
||||
removablesLocality.add(planarMarker);
|
||||
String planarGeo = initGeo(latLng);
|
||||
geoMarker(planarGeo, planarMarker, removableHashMap);
|
||||
break;
|
||||
}
|
||||
}
|
||||
callback.onMarkerInit(removableHashMap, null, allTaskStatus);
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_SEARCH_POI_WORD;
|
||||
obtain.obj = allTaskStatus;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* geo 坐标点转成
|
||||
*
|
||||
* @param latLng lat
|
||||
*/
|
||||
private String initGeo(LatLng latLng) {
|
||||
return GeometryTools.createGeometry(latLng).toString();
|
||||
}
|
||||
|
||||
|
||||
private void geoMarker(String geo, Marker marker, Map<String, List<Marker>> removableHashMap) {
|
||||
if (!removableHashMap.containsKey(geo)) {
|
||||
List<Marker> markers = new ArrayList<>();
|
||||
markers.add(marker);
|
||||
removableHashMap.put(geo, markers);
|
||||
} else {
|
||||
List<Marker> markers = removableHashMap.get(geo);
|
||||
assert markers != null;
|
||||
markers.add(marker);
|
||||
removableHashMap.put(geo, markers);
|
||||
}
|
||||
}
|
||||
|
||||
public interface MarkerInitCallback<T> {
|
||||
public void onMarkerInit(Map<String, List<Marker>> removableHashMap, List<Integer> uploadByNet/*服务器返回的该用户需要上传的数据列表*/, List<T> listData);
|
||||
}
|
||||
}
|
256
app/src/main/res/layout/activity_auto_take_pictures.xml
Normal file
256
app/src/main/res/layout/activity_auto_take_pictures.xml
Normal file
@ -0,0 +1,256 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#FF444444"
|
||||
tools:context=".activity.PicturesActivity">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/layer_change"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<com.otaliastudios.cameraview.CameraView
|
||||
android:id="@+id/camera"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:keepScreenOn="true"
|
||||
app:cameraPictureFormat="jpeg"
|
||||
app:cameraPictureMetering="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.tencent.tencentmap.mapsdk.maps.TextureMapView
|
||||
android:id="@+id/text_map_view"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="157dp"
|
||||
app:layout_constraintHeight_default="percent"
|
||||
app:layout_constraintHeight_percent="0.4"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_default="percent"
|
||||
app:layout_constraintWidth_percent="0.4" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_view"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="157dp"
|
||||
app:layout_constraintHeight_default="percent"
|
||||
app:layout_constraintHeight_percent="0.4"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintWidth_default="percent"
|
||||
app:layout_constraintWidth_percent="0.4" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="25dp"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_convert"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_zoom_add"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginEnd="25dp"
|
||||
android:src="@mipmap/zoom_add"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toTopOf="@+id/btn_stop_picture"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_zoom_del"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:src="@mipmap/zoom_del"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintLeft_toLeftOf="@id/iv_zoom_add"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_zoom_add" />
|
||||
|
||||
<!--<CheckBox
|
||||
android:id="@+id/cb_map_type"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:background="@drawable/atlas_selector"
|
||||
android:button="@null"
|
||||
android:checked="false"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintLeft_toLeftOf="@id/iv_zoom_del"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_zoom_del" />-->
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_location"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:src="@mipmap/mine_location"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintLeft_toLeftOf="@id/iv_zoom_del"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_zoom_del" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="25dp"
|
||||
android:src="@mipmap/switcher"
|
||||
android:padding="@dimen/default_widget_padding"
|
||||
android:text="切换"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_setting"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="设置"
|
||||
android:layout_marginTop="@dimen/default_widget_padding"
|
||||
app:layout_constraintTop_toBottomOf="@id/btn_switch"
|
||||
app:layout_constraintRight_toRightOf="parent"></Button>
|
||||
|
||||
<Switch
|
||||
android:id="@+id/location_switch"
|
||||
android:text="启用定位"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true"
|
||||
android:padding="@dimen/default_widget_padding"
|
||||
app:layout_constraintTop_toBottomOf="@id/btn_setting"
|
||||
app:layout_constraintRight_toRightOf="parent"></Switch>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/radio_group_picture"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="35dp"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/image_view">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/radio_btn_hand"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:button="@null"
|
||||
android:text="手动"
|
||||
android:textColor="@color/rbtn_text_color_selector" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/radio_btn_half_sec"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:button="@null"
|
||||
android:text="自动0.5秒"
|
||||
android:textColor="@color/rbtn_text_color_selector" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/radio_btn_auto"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:button="@null"
|
||||
android:text="自动1秒"
|
||||
android:textColor="@color/rbtn_text_color_selector" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/radio_btn_auto_sec"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:button="@null"
|
||||
android:text="自动2秒"
|
||||
android:textColor="@color/rbtn_text_color_selector" />
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_pic_road"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/take_pic_arrow"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_pic_video"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/take_poi_video_arrow"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/clear_all_match_data"
|
||||
style="@style/user_data_style"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:background="@drawable/user_style"
|
||||
android:button="@null"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/fab_margin"
|
||||
android:text="清空匹配"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@id/btn_stop_picture" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_stop_picture"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/uploding_shape"
|
||||
android:text="结束采集"
|
||||
android:textColor="@color/colorBlue"
|
||||
app:layout_constraintBottom_toBottomOf="@id/clear_all_match_data"
|
||||
app:layout_constraintLeft_toRightOf="@id/clear_all_match_data"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -122,17 +122,27 @@
|
||||
app:layout_constraintLeft_toLeftOf="@id/iv_zoom_del"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_zoom_del" />
|
||||
|
||||
<Button
|
||||
<ImageView
|
||||
android:id="@+id/btn_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="25dp"
|
||||
android:text="切换"
|
||||
android:visibility="gone"
|
||||
android:src="@mipmap/switcher"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_setting"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="设置"
|
||||
android:layout_marginTop="@dimen/default_widget_padding"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toBottomOf="@id/btn_switch"
|
||||
app:layout_constraintRight_toRightOf="parent"></Button>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/radio_group_picture"
|
||||
android:layout_width="wrap_content"
|
||||
|
165
app/src/main/res/layout/camera_setting.xml
Normal file
165
app/src/main/res/layout/camera_setting.xml
Normal file
@ -0,0 +1,165 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/dialogButtonMIUITextGray"
|
||||
android:padding="@dimen/fab_margin"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="@dimen/default_widget_padding"
|
||||
android:text="屏幕亮度"></TextView>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_camera_setting_brightness"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="number"
|
||||
android:hint="屏幕亮度"
|
||||
></EditText>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="@dimen/default_widget_padding"
|
||||
android:text="相机刷新"></TextView>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_camera_setting_framness"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="number"
|
||||
android:hint="相机刷新"
|
||||
></EditText>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="@dimen/default_widget_padding"
|
||||
android:text="起点距离阈值"></TextView>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_camera_setting_start_distance"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:hint="起点距离阈值"
|
||||
></EditText>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="@dimen/default_widget_padding"
|
||||
android:text="过程点距离阈值"></TextView>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_camera_setting_mid_distance"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:hint="过程点距离阈值"
|
||||
></EditText>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="@dimen/default_widget_padding"
|
||||
android:text="起点放弃个数"></TextView>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_camera_setting_start_count"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="number"
|
||||
android:hint="起点放弃个数"
|
||||
></EditText>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="@dimen/default_widget_padding"
|
||||
android:text="过程点放弃个数"></TextView>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_camera_setting_mid_count"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="number"
|
||||
android:hint="过程点放弃个数"
|
||||
></EditText>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="@dimen/default_widget_padding"
|
||||
android:text="放弃匹配距离阈值"></TextView>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_camera_setting_unmatch_pecent"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:hint="放弃匹配距离百分比"
|
||||
></EditText>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="@dimen/default_widget_padding"
|
||||
android:text="完全匹配距离百分比"></TextView>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_camera_setting_match_pecent"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:hint="完全匹配距离百分比"
|
||||
></EditText>
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_camera_setting_confirm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="确定"
|
||||
android:layout_gravity="center"></Button>
|
||||
</LinearLayout>
|
53
app/src/main/res/layout/camera_setting_pre.xml
Normal file
53
app/src/main/res/layout/camera_setting_pre.xml
Normal file
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/dialogButtonMIUITextGray"
|
||||
android:padding="@dimen/fab_margin"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="@dimen/default_widget_padding"
|
||||
android:text="屏幕亮度"></TextView>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_camera_setting_brightness"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="number"
|
||||
android:hint="屏幕亮度"
|
||||
></EditText>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="@dimen/default_widget_padding"
|
||||
android:text="相机刷新"></TextView>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edt_camera_setting_framness"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="number"
|
||||
android:hint="相机刷新"
|
||||
></EditText>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_camera_setting_confirm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="确定"
|
||||
android:layout_gravity="center"></Button>
|
||||
</LinearLayout>
|
@ -41,6 +41,7 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_mas_notification"
|
||||
android:layout_width="10dp"
|
||||
@ -115,6 +116,16 @@
|
||||
app:layout_constraintLeft_toLeftOf="@id/cb_map_type"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_refrish" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/iv_auto_match_road"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="道路自动匹配"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_zoom_add"
|
||||
android:layout_width="50dp"
|
||||
|
BIN
app/src/main/res/mipmap-xxhdpi/switcher.png
Normal file
BIN
app/src/main/res/mipmap-xxhdpi/switcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 474 B |
@ -1,9 +1,16 @@
|
||||
package com.navinfo.outdoor;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.locationtech.jts.geom.LineString;
|
||||
import org.locationtech.jts.geom.Point;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
@ -14,4 +21,15 @@ public class ExampleUnitTest {
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
@Test
|
||||
public void testDistance() {
|
||||
Point point = (Point) GeometryTools.createGeometry(new LatLng(4,4));
|
||||
List<LatLng> latLngList = new ArrayList<>();
|
||||
latLngList.add(new LatLng(0,0));
|
||||
latLngList.add(new LatLng(1,1));
|
||||
|
||||
LineString lineString = GeometryTools.getLineStainGeo(latLngList);
|
||||
|
||||
System.out.println("距离:"+lineString.distance(point));
|
||||
}
|
||||
}
|
1229
app/src/test/java/com/navinfo/outdoor/GeometryTools.java
Normal file
1229
app/src/test/java/com/navinfo/outdoor/GeometryTools.java
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user