修改位压盖点

This commit is contained in:
wangdongsheng 2021-09-01 18:11:02 +08:00
parent e4d6924c9e
commit 4db3982b83
11 changed files with 816 additions and 311 deletions

View File

@ -162,6 +162,7 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
navInfoEditor.putString("refresh_token",body.getRefresh_token()); navInfoEditor.putString("refresh_token",body.getRefresh_token());
navInfoEditor.putString("pass_word",paw); navInfoEditor.putString("pass_word",paw);
navInfoEditor.putString("user_name",name); navInfoEditor.putString("user_name",name);
navInfoEditor.putString("user_id",body.getUserId());
navInfoEditor.commit(); navInfoEditor.commit();
Constant.ACCESS_TOKEN=body.getAccess_token(); Constant.ACCESS_TOKEN=body.getAccess_token();
Constant.REFRESH_TOKEN=body.getRefresh_token(); Constant.REFRESH_TOKEN=body.getRefresh_token();
@ -232,28 +233,6 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
if (needGuide==1){ if (needGuide==1){
Intent intent = new Intent(LoginActivity.this, GuidanceActivity.class); Intent intent = new Intent(LoginActivity.this, GuidanceActivity.class);
startActivity(intent); startActivity(intent);
/* AlertDialog alertDialog = new AlertDialog.Builder(LoginActivity.this,R.style.dialog).create();
alertDialog.show();
WindowManager windowManager = getWindowManager();
Display defaultDisplay = windowManager.getDefaultDisplay();
Point point = new Point();
defaultDisplay.getSize(point);
Window window = alertDialog.getWindow();
assert window != null;
WindowManager.LayoutParams lp = ((Window) window).getAttributes();
lp.width = point.x; // 设置宽度和高度
lp.height = point.y;
getWindow().getDecorView().setPadding( 0 , 0 , 0 , 0 );
window.setAttributes(lp);
window.setContentView(R.layout.login_task_item);
window.findViewById(R.id.btn_login).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(LoginActivity.this, GuidanceActivity.class);
startActivity(intent);
alertDialog.dismiss();
}
});*/
}else { }else {
Toast.makeText(LoginActivity.this, "登录成功", Toast.LENGTH_SHORT).show(); Toast.makeText(LoginActivity.this, "登录成功", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(LoginActivity.this, HomeActivity.class); Intent intent = new Intent(LoginActivity.this, HomeActivity.class);

View File

@ -1,8 +1,10 @@
package com.navinfo.outdoor.activity; package com.navinfo.outdoor.activity;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.CountDownTimer; import android.os.CountDownTimer;
@ -74,6 +76,7 @@ public class MainActivity extends BaseActivity {
}); });
private ProgressDialog pBar; private ProgressDialog pBar;
private int progress; private int progress;
private String user_id;
@Override @Override
protected int getLayout() { protected int getLayout() {
@ -117,7 +120,11 @@ public class MainActivity extends BaseActivity {
@Override @Override
public void onGranted(List<String> permissions, boolean all) { public void onGranted(List<String> permissions, boolean all) {
if (all) { if (all) {
initCheckVersion(); if (user_id!=null){
initCheckVersion();
}else {
initTime();
}
//initTime(); //initTime();
} else { } else {
initPermission(); initPermission();
@ -288,7 +295,7 @@ public class MainActivity extends BaseActivity {
FileOutputStream fileOutputStream = null; FileOutputStream fileOutputStream = null;
if (is != null) { if (is != null) {
//对apk进行保存 //对apk进行保存
File file = new File(Constant.NABISCO_APk +"NVINFO.apk"); File file = new File(Constant.NABISCO_APk +"DTXB.apk");
fileOutputStream = new FileOutputStream(file); fileOutputStream = new FileOutputStream(file);
byte[] buf = new byte[1024]; byte[] buf = new byte[1024];
int ch; int ch;
@ -318,6 +325,10 @@ public class MainActivity extends BaseActivity {
@Override @Override
protected void initView() { protected void initView() {
super.initView(); super.initView();
SharedPreferences navInfo = getSharedPreferences(Constant.SHARED_PREFERENCES, Context.MODE_PRIVATE);
user_id = navInfo.getString("user_id", null);
Constant.ACCESS_TOKEN= navInfo.getString("access_token", null);;
HttpInterface.initAppPath(user_id);
initPermission(); initPermission();
} }

View File

@ -1,8 +1,6 @@
package com.navinfo.outdoor.activity; package com.navinfo.outdoor.activity;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Intent; import android.content.Intent;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
@ -54,22 +52,18 @@ import com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle;
import com.tencent.tencentmap.mapsdk.maps.model.Polyline; import com.tencent.tencentmap.mapsdk.maps.model.Polyline;
import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions; import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions;
import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.Geometry;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.eventbus.ThreadMode;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.io.File; import java.io.File;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE; import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE;
import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER; import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER;
import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_MAP_ROTATE_NO_CENTER;
public class PicturesActivity extends BaseActivity implements View.OnClickListener { public class PicturesActivity extends BaseActivity implements View.OnClickListener {
private static final CameraLogger LOG = CameraLogger.create("Picture"); private static final CameraLogger LOG = CameraLogger.create("Picture");

View File

@ -6,19 +6,33 @@ import android.graphics.Color;
import android.graphics.Matrix; import android.graphics.Matrix;
import android.os.Message; import android.os.Message;
import android.util.Log; import android.util.Log;
import android.view.Gravity;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.Toast; import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.kongzue.dialog.util.BaseDialog;
import com.kongzue.dialog.v3.CustomDialog;
import com.lzy.okgo.OkGo; import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.HttpParams; import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R; import com.navinfo.outdoor.R;
import com.navinfo.outdoor.adapter.MarkerAdapter;
import com.navinfo.outdoor.api.Constant; import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseActivity; import com.navinfo.outdoor.base.BaseActivity;
import com.navinfo.outdoor.bean.JobSearchBean; import com.navinfo.outdoor.bean.JobSearchBean;
import com.navinfo.outdoor.http.Callback; import com.navinfo.outdoor.http.Callback;
import com.navinfo.outdoor.http.HttpInterface; import com.navinfo.outdoor.http.HttpInterface;
import com.navinfo.outdoor.http.OkGoBuilder; import com.navinfo.outdoor.http.OkGoBuilder;
import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.Geohash; import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.GeometryTools; import com.navinfo.outdoor.util.GeometryTools;
import com.navinfo.outdoor.util.MarkerClusterItem; import com.navinfo.outdoor.util.MarkerClusterItem;
@ -26,6 +40,7 @@ import com.navinfo.outdoor.util.MyTecentLocationSource;
import com.tencent.map.geolocation.TencentLocation; import com.tencent.map.geolocation.TencentLocation;
import com.tencent.tencentmap.mapsdk.maps.CameraUpdate; import com.tencent.tencentmap.mapsdk.maps.CameraUpdate;
import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory; import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory;
import com.tencent.tencentmap.mapsdk.maps.Projection;
import com.tencent.tencentmap.mapsdk.maps.TencentMap; import com.tencent.tencentmap.mapsdk.maps.TencentMap;
import com.tencent.tencentmap.mapsdk.maps.TextureMapView; import com.tencent.tencentmap.mapsdk.maps.TextureMapView;
import com.tencent.tencentmap.mapsdk.maps.UiSettings; import com.tencent.tencentmap.mapsdk.maps.UiSettings;
@ -48,6 +63,7 @@ import com.tencent.tencentmap.mapsdk.vector.utils.clustering.ClusterItem;
import com.tencent.tencentmap.mapsdk.vector.utils.clustering.ClusterManager; import com.tencent.tencentmap.mapsdk.vector.utils.clustering.ClusterManager;
import com.tencent.tencentmap.mapsdk.vector.utils.clustering.algo.NonHierarchicalDistanceBasedAlgorithm; import com.tencent.tencentmap.mapsdk.vector.utils.clustering.algo.NonHierarchicalDistanceBasedAlgorithm;
import com.tencent.tencentmap.mapsdk.vector.utils.clustering.view.DefaultClusterRenderer; import com.tencent.tencentmap.mapsdk.vector.utils.clustering.view.DefaultClusterRenderer;
import com.vividsolutions.jts.awt.PointShapeFactory;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.geom.GeometryFactory;
@ -60,7 +76,9 @@ import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE; import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE;
import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER; import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER;
@ -69,14 +87,12 @@ public class TestActivity extends BaseActivity {
private TencentMap tencentMap; private TencentMap tencentMap;
private List<Removable> removables; private List<Removable> removables;
private List<LatLng> markerLatlng;
private final int MARKER_DOT = 3; private final int MARKER_DOT = 3;
private final int MARKER_LINE = 2; private final int MARKER_LINE = 2;
private final int MARKER_FACE = 1; private final int MARKER_FACE = 1;
private ClusterManager<MarkerClusterItem> clusterItemClusterManager; private ClusterManager<MarkerClusterItem> clusterItemClusterManager;
private Circle circle; private HashMap<String, List<Marker>> stringListHashMap;
private List<MarkerClusterItem> items; private ArrayList<LatLng> listLatlng;
@Override @Override
protected int getLayout() { protected int getLayout() {
@ -87,9 +103,10 @@ public class TestActivity extends BaseActivity {
protected void initData() { protected void initData() {
super.initData(); super.initData();
removables = new ArrayList<>();//存储网络数据的marker数据线 removables = new ArrayList<>();//存储网络数据的marker数据线
markerLatlng = new ArrayList<>();//存储网络数据的marker数据线 stringListHashMap = new HashMap<>();//key wktvalue :存储的数据类型
//存储的多点latlng
listLatlng = new ArrayList<>();
initList(Constant.currentLocation); initList(Constant.currentLocation);
} }
private void initList(TencentLocation tencentLocation) { private void initList(TencentLocation tencentLocation) {
@ -105,6 +122,7 @@ public class TestActivity extends BaseActivity {
} }
//获取中心点位置 //获取中心点位置
LatLng mapCenterPoint = tencentMap.getCameraPosition().target; LatLng mapCenterPoint = tencentMap.getCameraPosition().target;
String centerEncode = null; String centerEncode = null;
if (mapCenterPoint != null) { if (mapCenterPoint != null) {
centerEncode = Geohash.getInstance().encode(mapCenterPoint.latitude, mapCenterPoint.longitude); centerEncode = Geohash.getInstance().encode(mapCenterPoint.latitude, mapCenterPoint.longitude);
@ -134,17 +152,19 @@ public class TestActivity extends BaseActivity {
if (response.getCode() == 200) { if (response.getCode() == 200) {
JobSearchBean.BodyBean body = response.getBody(); JobSearchBean.BodyBean body = response.getBody();
if (body != null) { if (body != null) {
Log.d("TAG", "onSuccess: " + response.getBody().toString() + "sassafras's"); Log.d("TAG", "onSuccess: " + response.getBody().toString());
for (int i = 0; i < removables.size(); i++) { for (int i = 0; i < removables.size(); i++) {
removables.get(i).remove(); removables.get(i).remove();
} }
removables.clear(); removables.clear();
stringListHashMap.clear();
List<JobSearchBean.BodyBean.ListBean> list = response.getBody().getList(); List<JobSearchBean.BodyBean.ListBean> list = response.getBody().getList();
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
JobSearchBean.BodyBean.ListBean listBean = list.get(i); JobSearchBean.BodyBean.ListBean listBean = list.get(i);
String encodeStr = list.get(i).getGeo(); String encodeStr = list.get(i).getGeo();
// 解密geo // 解密geo
String geo = Geohash.getInstance().decode(encodeStr); Geometry geoMe = GeometryTools.createGeometry(Geohash.getInstance().decode(encodeStr));
String geo = geoMe.toString();
listBean.setGeo(geo); listBean.setGeo(geo);
Log.d("TAG", "onSuccess: " + geo); Log.d("TAG", "onSuccess: " + geo);
Geometry geometry = GeometryTools.createGeometry(geo); Geometry geometry = GeometryTools.createGeometry(geo);
@ -163,20 +183,15 @@ public class TestActivity extends BaseActivity {
List<LatLng> latLineString = GeometryTools.getLatLngs(geo); List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
// 构造 PolylineOptions // 构造 PolylineOptions
PolylineOptions polylineOptions = new PolylineOptions() PolylineOptions polylineOptions = new PolylineOptions()
.addAll(latLineString) .addAll(latLineString)// 折线设置圆形线头
// 折线设置圆形线头 .lineCap(true)// 折线的颜色为绿色
.lineCap(true) .color(Color.parseColor("#0096FF"))// 折线宽度为5像素
// 折线的颜色为绿色
.color(Color.parseColor("#0096FF"))
// 折线宽度为5像素
.width(10) .width(10)
.arrow(true) .arrow(true)
//.borderColor(0xffff0000) // 还可以添加描边颜色
//.borderWidth(1) // 描边颜色的宽度线宽还是 25 像素不过填充的部分宽度为 `width` - 2 * `borderWidth`
.arrowSpacing(100) .arrowSpacing(100)
.arrowTexture(bitmapLine); .arrowTexture(bitmapLine);
// 还可以添加描边颜色
//.borderColor(0xffff0000)
// 描边颜色的宽度线宽还是 25 像素不过填充的部分宽度为 `width` - 2 * `borderWidth`
//.borderWidth(1);
// 绘制折线 // 绘制折线
Polyline polyline = tencentMap.addPolyline(polylineOptions); Polyline polyline = tencentMap.addPolyline(polylineOptions);
polyline.setZIndex(MARKER_LINE); polyline.setZIndex(MARKER_LINE);
@ -188,14 +203,10 @@ public class TestActivity extends BaseActivity {
case "Polygon": // case "Polygon": //
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo); List<LatLng> latPolygon = GeometryTools.getLatLngs(geo);
Polygon polygon = tencentMap.addPolygon(new PolygonOptions(). Polygon polygon = tencentMap.addPolygon(new PolygonOptions().
//连接封闭图形的点 addAll(latPolygon).//连接封闭图形的点
addAll(latPolygon). fillColor(Color.parseColor("#97E0E7EC")). //填充颜色为红色
//填充颜色为红色 strokeColor(0xff000000).//边线颜色为黑色
fillColor(Color.parseColor("#97E0E7EC")). strokeWidth(5));//边线宽度15像素
//边线颜色为黑色
strokeColor(0xff000000).
//边线宽度15像素
strokeWidth(5));
polygon.setZIndex(MARKER_FACE); polygon.setZIndex(MARKER_FACE);
removables.add(polygon); removables.add(polygon);
com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid(); com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid();
@ -209,7 +220,6 @@ public class TestActivity extends BaseActivity {
}*/ }*/
break; break;
} }
markerLatlng.add(latLng);
switch (list.get(i).getType()) { switch (list.get(i).getType()) {
case 1://poi case 1://poi
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bg1); BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bg1);
@ -223,6 +233,7 @@ public class TestActivity extends BaseActivity {
poiMarker.setTag(listBean); poiMarker.setTag(listBean);
removables.add(poiMarker); removables.add(poiMarker);
poiMarker.setClickable(true); poiMarker.setClickable(true);
onMarker(geo, poiMarker);
break; break;
case 2://充电站 case 2://充电站
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bg1); BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bg1);
@ -235,6 +246,7 @@ public class TestActivity extends BaseActivity {
stationMarker.setTag(listBean); stationMarker.setTag(listBean);
removables.add(stationMarker); removables.add(stationMarker);
stationMarker.setClickable(true); stationMarker.setClickable(true);
onMarker(geo, stationMarker);
break; break;
case 3://poi录像 case 3://poi录像
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_video_bg1); BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_video_bg1);
@ -247,6 +259,7 @@ public class TestActivity extends BaseActivity {
poiVideoMarker.setZIndex(MARKER_DOT); poiVideoMarker.setZIndex(MARKER_DOT);
removables.add(poiVideoMarker); removables.add(poiVideoMarker);
poiVideoMarker.setClickable(true); poiVideoMarker.setClickable(true);
onMarker(geo, poiVideoMarker);
break; break;
case 4://道路录像 case 4://道路录像
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bg); BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bg);
@ -259,6 +272,7 @@ public class TestActivity extends BaseActivity {
roadMarker.setTag(listBean); roadMarker.setTag(listBean);
removables.add(roadMarker); removables.add(roadMarker);
roadMarker.setClickable(true); roadMarker.setClickable(true);
onMarker(geo, roadMarker);
break; break;
case 5://其他 case 5://其他
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg1); BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg1);
@ -271,6 +285,7 @@ public class TestActivity extends BaseActivity {
otherMarker.setTag(listBean); otherMarker.setTag(listBean);
removables.add(otherMarker); removables.add(otherMarker);
otherMarker.setClickable(true); otherMarker.setClickable(true);
onMarker(geo, otherMarker);
break; break;
case 6://面状任务 case 6://面状任务
BitmapDescriptor Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_facet_bg1); BitmapDescriptor Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_facet_bg1);
@ -283,11 +298,22 @@ public class TestActivity extends BaseActivity {
planarMarker.setTag(listBean); planarMarker.setTag(listBean);
removables.add(planarMarker); removables.add(planarMarker);
planarMarker.setClickable(true); planarMarker.setClickable(true);
onMarker(geo, planarMarker);
break; break;
} }
} }
} }
initNewMarker(); listLatlng.clear();
for (Map.Entry<String, List<Marker>> entry : stringListHashMap.entrySet()) {
String key = entry.getKey();
List<Marker> markerList = stringListHashMap.get(key);
assert markerList != null;
Log.d("TAG", "onSuenccess: "+markerList.toString());
Log.d("TAG", "onSuenccess: "+entry.getValue()+"sssssssssssssssssssssssssssssss"+entry.getKey());
LatLng lng = GeometryTools.createLatLng(key);
listLatlng.add(lng);
}
Message obtain = Message.obtain(); Message obtain = Message.obtain();
obtain.what = Constant.JOB_SEARCH_WORD; obtain.what = Constant.JOB_SEARCH_WORD;
obtain.obj = response; obtain.obj = response;
@ -296,6 +322,7 @@ public class TestActivity extends BaseActivity {
Toast.makeText(TestActivity.this, response.getMessage(), Toast.LENGTH_SHORT).show(); Toast.makeText(TestActivity.this, response.getMessage(), Toast.LENGTH_SHORT).show();
} }
} }
@Override @Override
public void onError(Throwable e, int id) { public void onError(Throwable e, int id) {
dismissLoadingDialog(); dismissLoadingDialog();
@ -304,6 +331,19 @@ public class TestActivity extends BaseActivity {
}); });
} }
public void onMarker(String geo, Marker marker) {
if (!stringListHashMap.containsKey(geo)) {
List<Marker> markers = new ArrayList<>();
markers.add(marker);
stringListHashMap.put(geo, markers);
} else {
List<Marker> markers = stringListHashMap.get(geo);
assert markers != null;
markers.add(marker);
stringListHashMap.put(geo, markers);
}
}
@Override @Override
protected void initView() { protected void initView() {
super.initView(); super.initView();
@ -317,40 +357,162 @@ public class TestActivity extends BaseActivity {
uiSettings.setTiltGesturesEnabled(false);//禁止倾斜手势. uiSettings.setTiltGesturesEnabled(false);//禁止倾斜手势.
//uiSettings.setAllGesturesEnabled(false); //uiSettings.setAllGesturesEnabled(false);
setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER); setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER);
// initCluster(); // initCluster();
initNewMarker();
} }
private void initNewMarker() { private void initNewMarker() {
//添加圆 tencentMap.setOnMapClickListener(new TencentMap.OnMapClickListener() {
LatLng mapCenterPoint = tencentMap.getCameraPosition().target; @Override
circle = tencentMap.addCircle(new CircleOptions(). public void onMapClick(LatLng latLng) {
center(mapCenterPoint).// 圆心
radius(1000d).// 半径
fillColor(0xff0000ff).// 圆的填充色为蓝色 }
strokeColor(0xff000000).// 描边的颜色为黑色 });
strokeWidth(1).// 描边宽度 tencentMap.setOnMarkerClickListener(new TencentMap.OnMarkerClickListener() {
clickable(true).// 可点击性 @Override
visible(true).// 可见性 public boolean onMarkerClick(Marker marker) {
zIndex(2));// 层级 LatLng latLng = marker.getPosition();
circle.setFillColor(0xFF00ff00);// 设置圆的填充色为红色 ArrayList<LatLng> latLngs = new ArrayList<>();//存储的是内部的屏幕点坐标
// 移除圆 Projection projection = tencentMap.getProjection();
// circle.remove(); android.graphics.Point point = projection.toScreenLocation(latLng);//转换为屏幕坐标
//中心点的圆 int minX = point.x - 200;
Geometry geometry = GeometryTools.createGeometry(mapCenterPoint); int minY = point.y - 200;
// int maxX = point.x + 200;
MultiPoint multiPoint = GeometryTools.createMultiPoint(markerLatlng); int maxY = point.y + 200;
// 点与多点直接形成的交叉点 point.set(minX, minY);
if (multiPoint!=null){ latLngs.add(new LatLng(projection.fromScreenLocation(point)));
Geometry intersection = geometry.intersection(multiPoint); point.set(maxX, minY);
if (intersection.getGeometryType().equals("Point")){} latLngs.add(new LatLng(projection.fromScreenLocation(point)));
Log.d("ddddd", "initNewMarker: " + intersection); point.set(maxX, maxY);
} latLngs.add(new LatLng(projection.fromScreenLocation(point)));
point.set(minX, maxY);
latLngs.add(new LatLng(projection.fromScreenLocation(point)));
point.set(minX, minY);
latLngs.add(new LatLng(projection.fromScreenLocation(point)));
com.vividsolutions.jts.geom.Polygon polygon = GeometryTools.createPolygon(latLngs);
//多点
MultiPoint multiPoint = GeometryTools.createMultiPoint(listLatlng);
//拿到覆蓋點
Geometry intersection = polygon.intersection(multiPoint);
String geometryType = intersection.getGeometryType();
ArrayList<PoiEntity> poiEntityArrayList = new ArrayList<>();
if (geometryType.equals("MultiPoint")) {
List<LatLng> latList = GeometryTools.getLatList(intersection);
for (int i = 0; i < latList.size(); i++) {
LatLng latL = latList.get(i);
Geometry geometry = GeometryTools.createGeometry(latL);
Log.d("TAG", "onMarkerClick: "+geometry.toString());
List<Marker> markerList = stringListHashMap.get(geometry.toText());
if (markerList!=null){
for (Marker mar : markerList) {
JobSearchBean.BodyBean.ListBean listBean = (JobSearchBean.BodyBean.ListBean) mar.getTag();
if (listBean != null) {
PoiEntity poiListEntity = new PoiEntity();
poiListEntity.setTaskId(listBean.getId());
poiListEntity.setGeoWkt(listBean.getGeo());
poiListEntity.setName(listBean.getName());
poiListEntity.setAddress(listBean.getAddress());
poiListEntity.setTelPhone(listBean.getTelephone() + "");
poiListEntity.setPrecision(listBean.getPrice() + "");
poiListEntity.setDist(listBean.getDist() + "");
poiListEntity.setDescribe(listBean.getMemo());
poiListEntity.setCreateTime(listBean.getEndDate());
poiListEntity.setType(listBean.getType());
String beanGeo = listBean.getGeo();
poiListEntity.setGeoWkt(beanGeo);
Geometry geos = GeometryTools.createGeometry(beanGeo);
switch (geos.getGeometryType()) {
case "Point": //
LatLng lng = GeometryTools.createLatLng(beanGeo);
poiListEntity.setX(lng.longitude + "");
poiListEntity.setY(lng.latitude + "");
break;
case "LineString": //线
case "Polygon": //
List<LatLng> latLineString = GeometryTools.getLatLngs(beanGeo);
assert latLineString != null;
poiListEntity.setX(latLineString.get(0).longitude + "");
poiListEntity.setY(latLineString.get(0).latitude + "");
break;
}
poiEntityArrayList.add(poiListEntity);
}
}
}
}
customDialog(poiEntityArrayList);
} else {
Log.d("TAG", "onMapClick: " + geometryType);
}
return false;
}
});
/* tencentMap.setOnMarkerClickListener(new TencentMap.OnMarkerClickListener() {
@Override
public boolean onMarkerClick(Marker marker) {
if (marker.getTag().equals("marker")) {
Toast.makeText(TestActivity.this, marker.getId()+"sssssssssssssssssssss", Toast.LENGTH_SHORT).show();
//中心点的圆
// Geometry geometry = GeometryTools.createGeometry();
//
MultiPoint multiPoint = GeometryTools.createMultiPoint(markerLatlng);
// 点与多点直接形成的交叉点
if (multiPoint != null) {
Geometry intersection = geometry.intersection(multiPoint);
intersection.getGeometryType()
Coordinate[] coordinates = intersection.getCoordinates();
if (coordinates != null && coordinates.length > 0) {
LatLng geo = new LatLng(coordinates[0].y, coordinates[0].x);
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bg1);
tencentMap.addMarker(new MarkerOptions(geo).icon(chargeDescriptor).alpha(0.9f)
.anchor(0.5f, 1.0f)
.flat(true)
.clockwise(false));
Log.d("yyyy", "initNewMarker: " + geo);
}
}
}
return false;
}
});*/
}
/**
* 自定义登录对话框
*/
public void customDialog(List<PoiEntity> list) {
AlertDialog.Builder builder = new AlertDialog.Builder(TestActivity.this);
final AlertDialog dialog = builder.create();
View dialogView = View.inflate(this, R.layout.layout_marker_dialog, null);
dialog.setView(dialogView);
Window win = dialog.getWindow();
win.setGravity(Gravity.BOTTOM); // 这里控制弹出的位置
win.getDecorView().setPadding(0, 0, 0, 0);
WindowManager.LayoutParams lp = win.getAttributes();
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
dialog.getWindow().setBackgroundDrawable(null);
win.setAttributes(lp);
dialog.show();
RecyclerView recyclerView = dialogView.findViewById(R.id.rv_marker_view);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
MarkerAdapter markerAdapter = new MarkerAdapter(list, TestActivity.this);
recyclerView.setAdapter(markerAdapter);
markerAdapter.setOnBankClick(new MarkerAdapter.OnBankClick() {
@Override
public void onClick(PoiEntity poiEntity) {
dialog.dismiss();
}
});
} }
private void initCluster() { private void initCluster() {
// 实例化点聚合管理者 // 实例化点聚合管理者
clusterItemClusterManager = new ClusterManager<>(this, tencentMap); clusterItemClusterManager = new ClusterManager<>(this, tencentMap);
//默认聚合策略调用是不必添加如果需要其他聚合策略可以按以下代码修改 //默认聚合策略调用是不必添加如果需要其他聚合策略可以按以下代码修改
NonHierarchicalDistanceBasedAlgorithm<MarkerClusterItem> hierarchicalDistanceBasedAlgorithm = new NonHierarchicalDistanceBasedAlgorithm<>(this); NonHierarchicalDistanceBasedAlgorithm<MarkerClusterItem> hierarchicalDistanceBasedAlgorithm = new NonHierarchicalDistanceBasedAlgorithm<>(this);
//设置点聚合生效距离以dp为代码 //设置点聚合生效距离以dp为代码
@ -361,13 +523,11 @@ public class TestActivity extends BaseActivity {
DefaultClusterRenderer<MarkerClusterItem> markerClusterItemDefaultClusterRenderer = new DefaultClusterRenderer<>(this, tencentMap, clusterItemClusterManager); DefaultClusterRenderer<MarkerClusterItem> markerClusterItemDefaultClusterRenderer = new DefaultClusterRenderer<>(this, tencentMap, clusterItemClusterManager);
//设置最小聚合数量默认为4.这里设置为2即有两个以上不包括2个marker 才会聚合 //设置最小聚合数量默认为4.这里设置为2即有两个以上不包括2个marker 才会聚合
markerClusterItemDefaultClusterRenderer.setMinClusterSize(2); markerClusterItemDefaultClusterRenderer.setMinClusterSize(2);
//定义聚合的分段当超过五个不足10个的时候显示5+ 其他分段同理 //定义聚合的分段当超过五个不足10个的时候显示5+ 其他分段同理
markerClusterItemDefaultClusterRenderer.setBuckets(new int[]{5, 10, 15, 20, 25, 50, 100, 200}); markerClusterItemDefaultClusterRenderer.setBuckets(new int[]{5, 10, 15, 20, 25, 50, 100, 200});
clusterItemClusterManager.setRenderer(markerClusterItemDefaultClusterRenderer); clusterItemClusterManager.setRenderer(markerClusterItemDefaultClusterRenderer);
//添加聚合 //添加聚合
List<MarkerClusterItem> items = new ArrayList<>();
items = new ArrayList<>();
items.add(new MarkerClusterItem(39.984059, 116.307621)); items.add(new MarkerClusterItem(39.984059, 116.307621));
items.add(new MarkerClusterItem(39.981954, 116.304703)); items.add(new MarkerClusterItem(39.981954, 116.304703));
items.add(new MarkerClusterItem(39.984355, 116.312256)); items.add(new MarkerClusterItem(39.984355, 116.312256));
@ -394,13 +554,11 @@ public class TestActivity extends BaseActivity {
items.add(new MarkerClusterItem(22.538086, 113.999805)); items.add(new MarkerClusterItem(22.538086, 113.999805));
items.add(new MarkerClusterItem(22.534756, 114.082031)); items.add(new MarkerClusterItem(22.534756, 114.082031));
clusterItemClusterManager.addItems(items); clusterItemClusterManager.addItems(items);
tencentMap.setOnCameraChangeListener(clusterItemClusterManager); tencentMap.setOnCameraChangeListener(clusterItemClusterManager);
tencentMap.setOnCameraChangeListener(new TencentMap.OnCameraChangeListener() { tencentMap.setOnCameraChangeListener(new TencentMap.OnCameraChangeListener() {
@Override @Override
public void onCameraChange(CameraPosition cameraPosition) { public void onCameraChange(CameraPosition cameraPosition) {
clusterItemClusterManager.cluster(); clusterItemClusterManager.cluster();
} }
@Override @Override
@ -442,7 +600,6 @@ public class TestActivity extends BaseActivity {
return bitmap; return bitmap;
} }
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMessageMainThread(Message msg) { public void onEventMessageMainThread(Message msg) {
if (msg.what == Constant.EVENT_WHAT_LOCATION_CHANGE) { // 用户位置更新 if (msg.what == Constant.EVENT_WHAT_LOCATION_CHANGE) { // 用户位置更新
@ -458,4 +615,5 @@ public class TestActivity extends BaseActivity {
} }
} }
} }
} }

View File

@ -0,0 +1,118 @@
package com.navinfo.outdoor.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.bean.BankPathBean;
import com.navinfo.outdoor.room.PoiEntity;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class MarkerAdapter extends RecyclerView.Adapter<MarkerAdapter.ViewHolder> {
private List<PoiEntity> poiEntities ;
private Context context;
public MarkerAdapter(List<PoiEntity> poiEntities, Context context) {
this.poiEntities = poiEntities;
this.context = context;
}
@NotNull
@Override
public ViewHolder onCreateViewHolder(@NonNull @NotNull ViewGroup parent, int viewType) {
View inflate = LayoutInflater.from(context).inflate(R.layout.item_marker, parent, false);
return new ViewHolder(inflate);
}
@Override
public void onBindViewHolder(@NonNull @NotNull ViewHolder holder, int position) {
PoiEntity poiEntity = poiEntities.get(position);
if (poiEntity.getTaskStatus()==0||poiEntity.getTaskStatus()==1){
switch (poiEntity.getType()){
case 1:
Glide.with(context).load(R.drawable.marker_poi_bg1).into(holder.ivIcon);
break;
case 2:
Glide.with(context).load(R.drawable.marker_charge_bg1).into(holder.ivIcon);
break;
case 3:
Glide.with(context).load(R.drawable.marker_poi_video_bg1).into(holder.ivIcon);
break;
case 4:
Glide.with(context).load(R.drawable.marker_road_bg).into(holder.ivIcon);
break;
case 5:
Glide.with(context).load(R.drawable.marker_other_bg1).into(holder.ivIcon);
break;
case 6:
Glide.with(context).load(R.drawable.marker_facet_bg1).into(holder.ivIcon);
break;
}
}else if (poiEntity.getTaskStatus()==2||poiEntity.getTaskStatus()==3||poiEntity.getTaskStatus()==4){
switch (poiEntity.getType()){
case 1:
Glide.with(context).load(R.drawable.graypoi).into(holder.ivIcon);
break;
case 2:
Glide.with(context).load(R.drawable.graycharge).into(holder.ivIcon);
break;
case 3:
Glide.with(context).load(R.drawable.poi_video_have_bg1).into(holder.ivIcon);
break;
case 4:
Glide.with(context).load(R.drawable.grayroad).into(holder.ivIcon);
break;
case 5:
Glide.with(context).load(R.drawable.grayother).into(holder.ivIcon);
break;
case 6:
Glide.with(context).load(R.drawable.grayfacet).into(holder.ivIcon);
break;
}
}
holder.titer.setText(poiEntity.getName());
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBankClick.onClick(poiEntities.get(position));
}
});
}
@Override
public int getItemCount() {
return poiEntities.size();
}
static class ViewHolder extends RecyclerView.ViewHolder {
TextView titer;
ImageView ivIcon;
public ViewHolder(@NonNull @NotNull View itemView) {
super(itemView);
titer = itemView.findViewById(R.id.tv_title);
ivIcon=itemView.findViewById(R.id.iv_icon);
}
}
public interface OnBankClick {
void onClick(PoiEntity poiEntity);
}
private OnBankClick onBankClick;
public void setOnBankClick(OnBankClick onBankClick) {
this.onBankClick = onBankClick;
}
}

View File

@ -347,18 +347,22 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
String geo = Geohash.getInstance().decode(encodeStr); String geo = Geohash.getInstance().decode(encodeStr);
chargingStationEntity.setGeoWkt(geo); chargingStationEntity.setGeoWkt(geo);
Geometry geometry = GeometryTools.createGeometry(geo); Geometry geometry = GeometryTools.createGeometry(geo);
if (geometry.getGeometryType().equals("Point")) {// switch (geometry.getGeometryType()) {
LatLng latLng = GeometryTools.createLatLng(geo); case "Point": //
chargingStationEntity.setX(latLng.longitude + ""); LatLng latLng = GeometryTools.createLatLng(geo);
chargingStationEntity.setY(latLng.latitude + ""); chargingStationEntity.setX(latLng.longitude + "");
} else if (geometry.getGeometryType().equals("LineString")) {//线 chargingStationEntity.setY(latLng.latitude + "");
List<LatLng> latLineString = GeometryTools.getLatLngs(geo); break;
chargingStationEntity.setX(latLineString.get(0).longitude + ""); case "LineString": //线
chargingStationEntity.setY(latLineString.get(0).latitude + ""); List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
} else if (geometry.getGeometryType().equals("Polygon")) {// chargingStationEntity.setX(latLineString.get(0).longitude + "");
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo); chargingStationEntity.setY(latLineString.get(0).latitude + "");
chargingStationEntity.setX(latPolygon.get(0).longitude + ""); break;
chargingStationEntity.setY(latPolygon.get(0).latitude + ""); case "Polygon": //
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo);
chargingStationEntity.setX(latPolygon.get(0).longitude + "");
chargingStationEntity.setY(latPolygon.get(0).latitude + "");
break;
} }
//充电桩 //充电桩

View File

@ -13,7 +13,10 @@ import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.util.Log; import android.util.Log;
import android.view.Gravity;
import android.view.View; import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.FrameLayout; import android.widget.FrameLayout;
@ -22,9 +25,13 @@ import android.widget.LinearLayout;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.core.widget.NestedScrollView; import androidx.core.widget.NestedScrollView;
import androidx.fragment.app.FragmentTransaction; import androidx.fragment.app.FragmentTransaction;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.github.lazylibrary.util.DensityUtil; import com.github.lazylibrary.util.DensityUtil;
import com.google.gson.Gson; import com.google.gson.Gson;
@ -41,6 +48,8 @@ import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.HttpParams; import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R; import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.FragmentManagement; import com.navinfo.outdoor.activity.FragmentManagement;
import com.navinfo.outdoor.activity.TestActivity;
import com.navinfo.outdoor.adapter.MarkerAdapter;
import com.navinfo.outdoor.api.Constant; import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseDrawerFragment; import com.navinfo.outdoor.base.BaseDrawerFragment;
import com.navinfo.outdoor.base.BaseFragment; import com.navinfo.outdoor.base.BaseFragment;
@ -67,6 +76,7 @@ import com.tencent.map.geolocation.TencentLocation;
import com.tencent.tencentmap.mapsdk.maps.CameraUpdate; import com.tencent.tencentmap.mapsdk.maps.CameraUpdate;
import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory; import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory;
import com.tencent.tencentmap.mapsdk.maps.MapView; import com.tencent.tencentmap.mapsdk.maps.MapView;
import com.tencent.tencentmap.mapsdk.maps.Projection;
import com.tencent.tencentmap.mapsdk.maps.TencentMap; import com.tencent.tencentmap.mapsdk.maps.TencentMap;
import com.tencent.tencentmap.mapsdk.maps.UiSettings; import com.tencent.tencentmap.mapsdk.maps.UiSettings;
import com.tencent.tencentmap.mapsdk.maps.interfaces.Removable; import com.tencent.tencentmap.mapsdk.maps.interfaces.Removable;
@ -82,6 +92,7 @@ import com.tencent.tencentmap.mapsdk.maps.model.PolygonOptions;
import com.tencent.tencentmap.mapsdk.maps.model.Polyline; import com.tencent.tencentmap.mapsdk.maps.model.Polyline;
import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions; import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions;
import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.MultiPoint;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
@ -90,6 +101,7 @@ import org.greenrobot.eventbus.Subscribe;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
/** /**
@ -107,9 +119,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
private ImageView ivSubmit; private ImageView ivSubmit;
private ImageView ivRaffish; private ImageView ivRaffish;
private SlidingUpPanelLayout sliding_layout; private SlidingUpPanelLayout sliding_layout;
// private FragmentTransaction fragmentTransaction;
private ImageView ivFilter; private ImageView ivFilter;
private Point screenPosition; //marker的屏幕坐标
private FrameLayout frameLayout; private FrameLayout frameLayout;
private GatherGetFragment gatherGetFragment; private GatherGetFragment gatherGetFragment;
public ImageView ivMessage; public ImageView ivMessage;
@ -138,7 +148,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
private final int MARKER_LINE = 2; private final int MARKER_LINE = 2;
private final int MARKER_FACE = 1; private final int MARKER_FACE = 1;
private final int MARKER_BIG = 4; private final int MARKER_BIG = 4;
private boolean isBack=false; private boolean isBack = false;
private HashMap<String, List<Marker>> removableHashMap;
private ArrayList<LatLng> latList;
private ArrayList<PoiEntity> poiEntityArrayList;
public static TreasureFragment newInstance(Bundle bundle) { public static TreasureFragment newInstance(Bundle bundle) {
@ -160,6 +173,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
msg.what = Constant.FILTER_DATA_CLEAR; msg.what = Constant.FILTER_DATA_CLEAR;
EventBus.getDefault().post(msg); EventBus.getDefault().post(msg);
dismissLoadingDialog(); dismissLoadingDialog();
removableHashMap.clear();
initThread(); // 刷新筛选的本地数据 initThread(); // 刷新筛选的本地数据
initList(Constant.currentLocation); // 刷新筛选的网络数据 initList(Constant.currentLocation); // 刷新筛选的网络数据
} }
@ -230,6 +244,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
removables = new ArrayList<>();//存储网络数据的marker数据线 removables = new ArrayList<>();//存储网络数据的marker数据线
removablesLocality = new ArrayList<>(); //存储本地的marker数据线 removablesLocality = new ArrayList<>(); //存储本地的marker数据线
removableScreenMarker = new ArrayList<>();//存储点击屏幕上的marker的marker数据线 removableScreenMarker = new ArrayList<>();//存储点击屏幕上的marker的marker数据线
//key wktvalue :存储的数据类型
removableHashMap = new HashMap<>();
//存储的多点latlng
latList = new ArrayList<>();
tencentMap.addOnMapLoadedCallback(new TencentMap.OnMapLoadedCallback() { tencentMap.addOnMapLoadedCallback(new TencentMap.OnMapLoadedCallback() {
@Override @Override
public void onMapLoaded() { public void onMapLoaded() {
@ -259,7 +277,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} else { } else {
dismissLoadingDialog(); dismissLoadingDialog();
} }
Constant.markerClickListener=markerClickListener; Constant.markerClickListener = markerClickListener;
tencentMap.setOnMarkerClickListener(Constant.markerClickListener); tencentMap.setOnMarkerClickListener(Constant.markerClickListener);
} }
}); });
@ -382,7 +400,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} }
String userEncode = Geohash.getInstance().encode(tencentLocation.getLatitude(), tencentLocation.getLongitude()); String userEncode = Geohash.getInstance().encode(tencentLocation.getLatitude(), tencentLocation.getLongitude());
OkGo.getInstance().cancelTag(this); OkGo.getInstance().cancelTag(this);
Log.d("TAG", "initList: "+Constant.USHERED); Log.d("TAG", "initList: " + Constant.USHERED);
showLoadingDialog(); showLoadingDialog();
// 请求方式和请求url // 请求方式和请求url
HttpParams httpParams = new HttpParams(); HttpParams httpParams = new HttpParams();
@ -405,9 +423,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
dismissLoadingDialog(); dismissLoadingDialog();
if (response.getCode() == 200) { if (response.getCode() == 200) {
JobSearchBean.BodyBean body = response.getBody(); JobSearchBean.BodyBean body = response.getBody();
upload = response.getBody().getUpload();
if (body != null) { if (body != null) {
upload = response.getBody().getUpload();
if (upload != null) { if (upload != null) {
ivSubmit.setEnabled(true); ivSubmit.setEnabled(true);
} else { } else {
@ -449,13 +466,13 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.color(Color.parseColor("#0096FF")) .color(Color.parseColor("#0096FF"))
// 折线宽度为5像素 // 折线宽度为5像素
.width(10) .width(10)
// 还可以添加描边颜色
//.borderColor(0xffff0000)
// 描边颜色的宽度线宽还是 25 像素不过填充的部分宽度为 `width` - 2 * `borderWidth`
//.borderWidth(1);
.arrow(true) .arrow(true)
.arrowSpacing(100) .arrowSpacing(100)
.arrowTexture(bitmapLine); .arrowTexture(bitmapLine);
// 还可以添加描边颜色
//.borderColor(0xffff0000)
// 描边颜色的宽度线宽还是 25 像素不过填充的部分宽度为 `width` - 2 * `borderWidth`
//.borderWidth(1);
// 绘制折线 // 绘制折线
Polyline polyline = tencentMap.addPolyline(polylineOptions); Polyline polyline = tencentMap.addPolyline(polylineOptions);
polyline.setZIndex(MARKER_LINE); polyline.setZIndex(MARKER_LINE);
@ -483,9 +500,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
latLng = new LatLng(); latLng = new LatLng();
latLng.setLatitude(y); latLng.setLatitude(y);
latLng.setLongitude(x); latLng.setLongitude(x);
/* if (latPolygon != null && latPolygon.size() > 0) {
latLng = latPolygon.get(0);
}*/
break; break;
} }
switch (list.get(i).getType()) { switch (list.get(i).getType()) {
@ -500,6 +514,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
poiMarker.setZIndex(MARKER_DOT); poiMarker.setZIndex(MARKER_DOT);
poiMarker.setTag(listBean); poiMarker.setTag(listBean);
removables.add(poiMarker); removables.add(poiMarker);
String poiGeo = initGeo(latLng);
geoMarker(poiGeo, poiMarker);
poiMarker.setClickable(true); poiMarker.setClickable(true);
break; break;
case 2://充电站 case 2://充电站
@ -512,6 +528,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
stationMarker.setZIndex(MARKER_DOT); stationMarker.setZIndex(MARKER_DOT);
stationMarker.setTag(listBean); stationMarker.setTag(listBean);
removables.add(stationMarker); removables.add(stationMarker);
String stationGeo = initGeo(latLng);
geoMarker(stationGeo, stationMarker);
stationMarker.setClickable(true); stationMarker.setClickable(true);
break; break;
@ -525,6 +543,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
poiVideoMarker.setTag(listBean); poiVideoMarker.setTag(listBean);
poiVideoMarker.setZIndex(MARKER_DOT); poiVideoMarker.setZIndex(MARKER_DOT);
removables.add(poiVideoMarker); removables.add(poiVideoMarker);
String poiVideoGeo = initGeo(latLng);
geoMarker(poiVideoGeo, poiVideoMarker);
poiVideoMarker.setClickable(true); poiVideoMarker.setClickable(true);
break; break;
case 4://道路录像 case 4://道路录像
@ -537,8 +557,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
roadMarker.setZIndex(MARKER_DOT); roadMarker.setZIndex(MARKER_DOT);
roadMarker.setTag(listBean); roadMarker.setTag(listBean);
removables.add(roadMarker); removables.add(roadMarker);
String roadGeo = initGeo(latLng);
geoMarker(roadGeo, roadMarker);
roadMarker.setClickable(true); roadMarker.setClickable(true);
break; break;
case 5://其他 case 5://其他
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg1); BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg1);
@ -550,6 +571,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
otherMarker.setZIndex(MARKER_DOT); otherMarker.setZIndex(MARKER_DOT);
otherMarker.setTag(listBean); otherMarker.setTag(listBean);
removables.add(otherMarker); removables.add(otherMarker);
String otherGeo = initGeo(latLng);
geoMarker(otherGeo, otherMarker);
otherMarker.setClickable(true); otherMarker.setClickable(true);
break; break;
case 6://面状任务 case 6://面状任务
@ -562,11 +585,20 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
planarMarker.setZIndex(MARKER_DOT); planarMarker.setZIndex(MARKER_DOT);
planarMarker.setTag(listBean); planarMarker.setTag(listBean);
removables.add(planarMarker); removables.add(planarMarker);
String planarGeo = initGeo(latLng);
geoMarker(planarGeo, planarMarker);
planarMarker.setClickable(true); planarMarker.setClickable(true);
break; 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(); Message obtain = Message.obtain();
obtain.what = Constant.JOB_SEARCH_WORD; obtain.what = Constant.JOB_SEARCH_WORD;
obtain.obj = response; obtain.obj = response;
@ -585,6 +617,23 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}); });
} }
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);
}
}
public void initMarker(PoiEntity poiEntity, boolean aBoolean) { public void initMarker(PoiEntity poiEntity, boolean aBoolean) {
String geo = poiEntity.getGeoWkt(); String geo = poiEntity.getGeoWkt();
Log.d("TAG", "onSuccess: " + geo); Log.d("TAG", "onSuccess: " + geo);
@ -592,12 +641,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
if (geometry == null) { if (geometry == null) {
return; return;
} }
for (int i = 0; i < removableScreenMarker.size(); i++) { for (int i = 0; i < removableScreenMarker.size(); i++) {
removableScreenMarker.get(i).remove(); removableScreenMarker.get(i).remove();
} }
removableScreenMarker.clear(); removableScreenMarker.clear();
LatLng latLng = null; LatLng latLng = null;
switch (geometry.getGeometryType()) { switch (geometry.getGeometryType()) {
case "Point": // case "Point": //
@ -623,10 +670,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.arrow(true) .arrow(true)
.arrowSpacing(150) .arrowSpacing(150)
.arrowTexture(bitmapLine); .arrowTexture(bitmapLine);
/* // 还可以添加描边颜色
.borderColor(0xffff0000)
// 描边颜色的宽度线宽还是 25 像素不过填充的部分宽度为 `width` - 2 * `borderWidth`
.borderWidth(1);*/
// 绘制折线 // 绘制折线
Polyline polyline = tencentMap.addPolyline(polylineOptions); Polyline polyline = tencentMap.addPolyline(polylineOptions);
polyline.setZIndex(MARKER_LINE); polyline.setZIndex(MARKER_LINE);
@ -655,9 +698,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
latLng = new LatLng(); latLng = new LatLng();
latLng.setLatitude(y); latLng.setLatitude(y);
latLng.setLongitude(x); latLng.setLongitude(x);
/* if (latPolygon != null && latPolygon.size() > 0) {
latLng = latPolygon.get(0);
}*/
break; break;
} }
BitmapDescriptor descriptor = null; BitmapDescriptor descriptor = null;
@ -701,7 +741,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
fragmentTransaction.replace(R.id.frame_layout, gatherGetFragment); fragmentTransaction.replace(R.id.frame_layout, gatherGetFragment);
fragmentTransaction.commit(); fragmentTransaction.commit();
} }
} }
private void initThread() { private void initThread() {
@ -714,7 +753,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
List<PoiEntity> allTaskStatus = poiDao.getAllTaskStatus(taskStatus, taskStatus, type, type, limit, limit); List<PoiEntity> allTaskStatus = poiDao.getAllTaskStatus(taskStatus, taskStatus, type, type, limit, limit);
//List<PoiEntity> allTaskStatus = poiDao.getAllPoi(); //List<PoiEntity> allTaskStatus = poiDao.getAllPoi();
List<PoiEntity> allPoiStatus = poiDao.getAllPoiStatus(); List<PoiEntity> allPoiStatus = poiDao.getAllPoiStatus();
if (allPoiStatus!=null){ if (allPoiStatus != null) {
poiDao.deleteAll(allPoiStatus); poiDao.deleteAll(allPoiStatus);
} }
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() { Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
@ -755,10 +794,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.arrow(true) .arrow(true)
.arrowSpacing(100) .arrowSpacing(100)
.arrowTexture(bitmapLine); .arrowTexture(bitmapLine);
/* // 还可以添加描边颜色
.borderColor(0xffff0000)
// 描边颜色的宽度线宽还是 25 像素不过填充的部分宽度为 `width` - 2 * `borderWidth`
.borderWidth(1);*/
// 绘制折线 // 绘制折线
Polyline polyline = tencentMap.addPolyline(polylineOptions); Polyline polyline = tencentMap.addPolyline(polylineOptions);
polyline.setZIndex(MARKER_LINE); polyline.setZIndex(MARKER_LINE);
@ -814,6 +849,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
poiMarker.setTitle(poiEntity.getName() + ""); poiMarker.setTitle(poiEntity.getName() + "");
poiMarker.setTag(poiEntity); poiMarker.setTag(poiEntity);
removablesLocality.add(poiMarker); removablesLocality.add(poiMarker);
String poiGeo = initGeo(latLng);
geoMarker(poiGeo, poiMarker);
break; break;
case 2://充电站 case 2://充电站
BitmapDescriptor chargeDescriptor = null; BitmapDescriptor chargeDescriptor = null;
@ -832,6 +869,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
stationMarker.setTitle(poiEntity.getName() + ""); stationMarker.setTitle(poiEntity.getName() + "");
stationMarker.setTag(poiEntity); stationMarker.setTag(poiEntity);
removablesLocality.add(stationMarker); removablesLocality.add(stationMarker);
String stationGeo = initGeo(latLng);
geoMarker(stationGeo, stationMarker);
break; break;
case 3://poi录像 case 3://poi录像
BitmapDescriptor poiVideoDescriptor = null; BitmapDescriptor poiVideoDescriptor = null;
@ -850,6 +889,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
poiVideoMarker.setTitle(poiEntity.getName() + ""); poiVideoMarker.setTitle(poiEntity.getName() + "");
poiVideoMarker.setTag(poiEntity); poiVideoMarker.setTag(poiEntity);
removablesLocality.add(poiVideoMarker); removablesLocality.add(poiVideoMarker);
String poiVideoGeo = initGeo(latLng);
geoMarker(poiVideoGeo, poiVideoMarker);
break; break;
case 4://道路录像 case 4://道路录像
BitmapDescriptor roadDescriptor = null; BitmapDescriptor roadDescriptor = null;
@ -868,6 +909,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
roadMarker.setTitle(poiEntity.getName() + ""); roadMarker.setTitle(poiEntity.getName() + "");
roadMarker.setTag(poiEntity); roadMarker.setTag(poiEntity);
removablesLocality.add(roadMarker); removablesLocality.add(roadMarker);
String roadGeo = initGeo(latLng);
geoMarker(roadGeo, roadMarker);
break; break;
case 5://其他 case 5://其他
BitmapDescriptor otherDescriptor = null; BitmapDescriptor otherDescriptor = null;
@ -886,6 +929,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
otherMarker.setTitle(poiEntity.getName() + ""); otherMarker.setTitle(poiEntity.getName() + "");
otherMarker.setTag(poiEntity); otherMarker.setTag(poiEntity);
removablesLocality.add(otherMarker); removablesLocality.add(otherMarker);
String otherGeo = initGeo(latLng);
geoMarker(otherGeo, otherMarker);
break; break;
case 6://面状任务 case 6://面状任务
BitmapDescriptor Descriptor = null; BitmapDescriptor Descriptor = null;
@ -904,6 +949,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
planarMarker.setTitle(poiEntity.getName() + ""); planarMarker.setTitle(poiEntity.getName() + "");
planarMarker.setTag(poiEntity); planarMarker.setTag(poiEntity);
removablesLocality.add(planarMarker); removablesLocality.add(planarMarker);
String planarGeo = initGeo(latLng);
geoMarker(planarGeo, planarMarker);
break; break;
} }
} }
@ -1025,8 +1072,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
fragmentTransaction.commit(); fragmentTransaction.commit();
} }
PoiEntity poiEntity = (PoiEntity) data.obj; PoiEntity poiEntity = (PoiEntity) data.obj;
initMarker(poiEntity,true); initMarker(poiEntity, true);
} else if (data.what == Constant.GATHER_GET_MAP) { //地图界面点击采集 点击开始采集 } else if (data.what == Constant.GATHER_GET_MAP) { //地图界面点击采集 点击开始采集
if (bigMarker != null) { if (bigMarker != null) {
bigMarker.setVisible(false); bigMarker.setVisible(false);
} }
@ -1062,31 +1109,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
fragmentTransaction.remove(gatherGetFragment); fragmentTransaction.remove(gatherGetFragment);
fragmentTransaction.commit(); fragmentTransaction.commit();
} }
}/* else if (data.what == Constant.TREASURE_WORD) { // POI采集-移动位置 } else if (data.what == Constant.TREASURE_FRAGMENT) {//抽屉界面的展示和隐藏
initPoiMarker((LatLng) data.obj);
} else if (data.what == Constant.TREASURE_CHECKED_WORD) {//poi采集 -确定位置
if ((boolean) data.obj) {
initCheckedMarker(Constant.POI_WORD);
}
} else if (data.what == Constant.MAIN_CHARGING_STATION) {//充电站采集-移动位置
initPoiMarker((LatLng) data.obj);
} else if (data.what == Constant.MAIN_CHARGING_CHECKED_STATION) {//充电站采集 -确定位置
if ((boolean) data.obj) {
initCheckedMarker(Constant.CHARGING_STATION_WORD);
}
}*//* else if (data.what == Constant.MAIN_CHARGING_PILE) {//充电桩采集-移动位置
initPileMarker((LatLng) data.obj);
} else if (data.what == Constant.MAIN_CHARGING_CHECKED_PILE) {//充电桩采集-确定位置
if ((boolean) data.obj) {
initCheckedPileMarker(Constant.CHARGING_PILE_WORD);
}
}*//* else if (data.what == Constant.MAIN_OTHER) {//其他采集-移动位置
initPoiMarker((LatLng) data.obj);
} else if (data.what == Constant.MAIN_CHECKED_OTHER) {//其他采集-确定位置
if ((boolean) data.obj) {
initCheckedMarker(Constant.OTHER_WORD);
}
}*/ else if (data.what == Constant.TREASURE_FRAGMENT) {//抽屉界面的展示和隐藏
if ((boolean) data.obj) { if ((boolean) data.obj) {
frameLayout.setVisibility(View.GONE); frameLayout.setVisibility(View.GONE);
sliding_layout.setPanelHeight(0); sliding_layout.setPanelHeight(0);
@ -1156,7 +1179,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
removableScreenMarker.clear(); removableScreenMarker.clear();
refreshFilterData(); refreshFilterData();
} }
} else if (data.what == Constant.EVENT_WHAT_COMPLETE_TASK) { } else if (data.what == Constant.EVENT_WHAT_COMPLETE_TASK) {
PoiEntity poiEntity = (PoiEntity) data.obj; PoiEntity poiEntity = (PoiEntity) data.obj;
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putBoolean("isSliding", true); // 通知抽屉不收回 bundle.putBoolean("isSliding", true); // 通知抽屉不收回
@ -1372,7 +1395,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
ToastUtil.showShort(getContext(), "无法获取当前位置请检查GPS是否打开"); ToastUtil.showShort(getContext(), "无法获取当前位置请检查GPS是否打开");
return; return;
} }
// LatLng mapCenterPoint = getMapCenterPoint(); //LatLng mapCenterPoint = getMapCenterPoint();
LatLng newPoiLatLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()); LatLng newPoiLatLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude());
poiEntity.setX(newPoiLatLng.getLongitude() + ""); poiEntity.setX(newPoiLatLng.getLongitude() + "");
poiEntity.setY(newPoiLatLng.getLatitude() + ""); poiEntity.setY(newPoiLatLng.getLatitude() + "");
@ -1519,9 +1542,60 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
TencentMap.OnMarkerClickListener markerClickListener = new TencentMap.OnMarkerClickListener() { TencentMap.OnMarkerClickListener markerClickListener = new TencentMap.OnMarkerClickListener() {
@Override @Override
public boolean onMarkerClick(Marker marker) { public boolean onMarkerClick(Marker marker) {
FragmentTransaction fragmentTransaction = supportFragmentManager.beginTransaction(); LatLng latLng = marker.getPosition();
if (marker.getTitle() != null && !marker.getTitle().equals("")) {//是本地数据直接跳转到采集页面 ArrayList<LatLng> lngArrayList = new ArrayList<>();//存储的是内部的屏幕点坐标
PoiEntity poiEntity = (PoiEntity) marker.getTag(); Projection projection = tencentMap.getProjection();
android.graphics.Point point = projection.toScreenLocation(latLng);//转换为屏幕坐标
int minX = point.x - 200;
int minY = point.y - 200;
int maxX = point.x + 200;
int maxY = point.y + 200;
point.set(minX, minY);
lngArrayList.add(new LatLng(projection.fromScreenLocation(point)));
point.set(maxX, minY);
lngArrayList.add(new LatLng(projection.fromScreenLocation(point)));
point.set(maxX, maxY);
lngArrayList.add(new LatLng(projection.fromScreenLocation(point)));
point.set(minX, maxY);
lngArrayList.add(new LatLng(projection.fromScreenLocation(point)));
point.set(minX, minY);
lngArrayList.add(new LatLng(projection.fromScreenLocation(point)));
poiEntityArrayList = new ArrayList<>();
com.vividsolutions.jts.geom.Polygon polygon = GeometryTools.createPolygon(lngArrayList);
//多点
MultiPoint multiPoint = GeometryTools.createMultiPoint(latList);
//拿到覆蓋點
Geometry intersection = polygon.intersection(multiPoint);
if (intersection == null) {
initEntity(marker, true);
} else {
if (intersection.getGeometryType().equals("MultiPoint")) {
List<LatLng> latList = GeometryTools.getLatList(intersection);
for (int i = 0; i < latList.size(); i++) {
LatLng latL = latList.get(i);
Geometry geometry = GeometryTools.createGeometry(latL);
Log.d("TAG", "onMarkerClick: " + geometry.toString());
List<Marker> markerList = removableHashMap.get(geometry.toText());
if (markerList != null) {
for (Marker mar : markerList) {
initEntity(mar, false);
}
}
}
customDialog(poiEntityArrayList, marker);
} else {
initEntity(marker, true);
}
}
return false;
}
};
private void initEntity(Marker marker, boolean isBack) {
FragmentTransaction fragmentTransaction = supportFragmentManager.beginTransaction();
if (marker.getTitle() != null && !marker.getTitle().equals("")) {//是本地数据直接跳转到采集页面
PoiEntity poiEntity = (PoiEntity) marker.getTag();
if (isBack) {
frameLayout.setVisibility(View.GONE); frameLayout.setVisibility(View.GONE);
if (gatherGetFragment != null) { if (gatherGetFragment != null) {
fragmentTransaction.remove(gatherGetFragment); fragmentTransaction.remove(gatherGetFragment);
@ -1533,100 +1607,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
removableScreenMarker.get(i).remove(); removableScreenMarker.get(i).remove();
} }
removableScreenMarker.clear(); removableScreenMarker.clear();
if (poiEntity.getTaskStatus()==1){//已领取 if (poiEntity.getTaskStatus() == 1) {//已领取
initMarker(poiEntity, true); initMarker(poiEntity, true);
switch (poiEntity.getType()){
case 1:
case 2:
case 5:
marker.remove();
break;
case 3:
case 4:
case 6:
break;
}
}else {
Bundle bundle = new Bundle();
bundle.putSerializable("poiEntity", poiEntity);
switch (poiEntity.getType()) { switch (poiEntity.getType()) {
case 1:
initMarker(poiEntity,false);
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
showSlidingFragment(poiFragment);
marker.remove();
break;
case 2:
initMarker(poiEntity,false);
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
showSlidingFragment(chargingStationFragment);
marker.remove();
break;
case 3:
initMarker(poiEntity,false);
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
showSlidingFragment(poiVideoFragment);
marker.remove();
break;
case 4:
initMarker(poiEntity,false);
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
showSlidingFragment(roadFragment);
marker.remove();
break;
case 5:
initMarker(poiEntity,false);
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
showSlidingFragment(otherFragment);
marker.remove();
break;
case 6:
initMarker(poiEntity, true);
break;
}
}
} else {
JobSearchBean.BodyBean.ListBean listBean = (JobSearchBean.BodyBean.ListBean) marker.getTag();
if (listBean != null) {
PoiEntity poiListEntity = new PoiEntity();
poiListEntity.setTaskId(listBean.getId());
poiListEntity.setGeoWkt(listBean.getGeo());
poiListEntity.setName(listBean.getName());
poiListEntity.setAddress(listBean.getAddress());
poiListEntity.setTelPhone(listBean.getTelephone() + "");
poiListEntity.setPrecision(listBean.getPrice() + "");
poiListEntity.setDist(listBean.getDist() + "");
poiListEntity.setDescribe(listBean.getMemo());
poiListEntity.setCreateTime(listBean.getEndDate());
poiListEntity.setType(listBean.getType());
String geo = listBean.getGeo();
poiListEntity.setGeoWkt(geo);
Geometry geometry = GeometryTools.createGeometry(geo);
switch (geometry.getGeometryType()) {
case "Point": //
LatLng latLng = GeometryTools.createLatLng(geo);
poiListEntity.setX(latLng.longitude + "");
poiListEntity.setY(latLng.latitude + "");
break;
case "LineString": //线
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
assert latLineString != null;
poiListEntity.setX(latLineString.get(0).longitude + "");
poiListEntity.setY(latLineString.get(0).latitude + "");
break;
case "Polygon": //
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo);
assert latPolygon != null;
poiListEntity.setX(latPolygon.get(0).longitude + "");
poiListEntity.setY(latPolygon.get(0).latitude + "");
break;
}
initMarker(poiListEntity, true);
switch (listBean.getType()){
case 1: case 1:
case 2: case 2:
case 5: case 5:
@ -1638,12 +1621,101 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break; break;
} }
} else { } else {
Toast.makeText(getActivity(), "数据为空", Toast.LENGTH_SHORT).show(); Bundle bundle = new Bundle();
bundle.putSerializable("poiEntity", poiEntity);
switch (poiEntity.getType()) {
case 1:
initMarker(poiEntity, false);
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
showSlidingFragment(poiFragment);
marker.remove();
break;
case 2:
initMarker(poiEntity, false);
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
showSlidingFragment(chargingStationFragment);
marker.remove();
break;
case 3:
initMarker(poiEntity, false);
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
showSlidingFragment(poiVideoFragment);
marker.remove();
break;
case 4:
initMarker(poiEntity, false);
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
showSlidingFragment(roadFragment);
marker.remove();
break;
case 5:
initMarker(poiEntity, false);
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
showSlidingFragment(otherFragment);
marker.remove();
break;
case 6:
initMarker(poiEntity, true);
break;
}
} }
} else {
poiEntityArrayList.add(poiEntity);
}
} else {
JobSearchBean.BodyBean.ListBean listBean = (JobSearchBean.BodyBean.ListBean) marker.getTag();
if (listBean != null) {
PoiEntity poiListEntity = new PoiEntity();
poiListEntity.setTaskId(listBean.getId());
poiListEntity.setGeoWkt(listBean.getGeo());
poiListEntity.setName(listBean.getName());
poiListEntity.setAddress(listBean.getAddress());
poiListEntity.setTelPhone(listBean.getTelephone());
poiListEntity.setPrecision(listBean.getPrice() + "");
poiListEntity.setDist(listBean.getDist() + "");
poiListEntity.setDescribe(listBean.getMemo());
poiListEntity.setCreateTime(listBean.getEndDate());
poiListEntity.setType(listBean.getType());
String geo = listBean.getGeo();
poiListEntity.setGeoWkt(geo);
Geometry geometry = GeometryTools.createGeometry(geo);
switch (geometry.getGeometryType()) {
case "Point": //
LatLng lng = GeometryTools.createLatLng(geo);
poiListEntity.setX(lng.longitude + "");
poiListEntity.setY(lng.latitude + "");
break;
case "LineString": //线
case "Polygon": //
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
assert latLineString != null;
poiListEntity.setX(latLineString.get(0).longitude + "");
poiListEntity.setY(latLineString.get(0).latitude + "");
break;
}
if (isBack) {
initMarker(poiListEntity, true);
switch (listBean.getType()) {
case 1:
case 2:
case 5:
marker.remove();
break;
case 3:
case 4:
case 6:
break;
}
} else {
poiEntityArrayList.add(poiListEntity);
}
} else {
Toast.makeText(getActivity(), "数据为空", Toast.LENGTH_SHORT).show();
} }
return false;
} }
}; }
@Override @Override
@ -1655,8 +1727,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} else { } else {
Objects.requireNonNull(getActivity()).finish(); Objects.requireNonNull(getActivity()).finish();
} }
return true; return true;
} }
@ -1664,18 +1734,121 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
* 获取屏幕中心点位置 * 获取屏幕中心点位置
*/ */
public LatLng getMapCenterPoint() { public LatLng getMapCenterPoint() {
// int left = treasureMap.getLeft();
// int top = treasureMap.getTop();
// int right = treasureMap.getRight();
// int bottom = treasureMap.getBottom();
// // 获得屏幕点击的位置
// int x = (int) (treasureMap.getX() + (right - left) / 2);
// int y = (int) (treasureMap.getY() + (bottom - top) / 2);
// Projection projection = tangentMap.getProjection();
// LatLng pt = projection.fromScreenLocation(new Point(x, y));
return tencentMap.getCameraPosition().target; return tencentMap.getCameraPosition().target;
} }
/**
* 自定义dialog
*/
public void customDialog(List<PoiEntity> list, Marker marker) {
AlertDialog.Builder builder = new AlertDialog.Builder(Objects.requireNonNull(getActivity()));
final AlertDialog dialog = builder.create();
View dialogView = View.inflate(getActivity(), R.layout.layout_marker_dialog, null);
dialog.setView(dialogView);
Window win = dialog.getWindow();
assert win != null;
win.setGravity(Gravity.BOTTOM); // 这里控制弹出的位置
win.getDecorView().setPadding(0, 0, 0, 0);
WindowManager.LayoutParams lp = win.getAttributes();
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
dialog.getWindow().setBackgroundDrawable(null);
win.setAttributes(lp);
dialog.show();
RecyclerView recyclerView = dialogView.findViewById(R.id.rv_marker_view);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL));
MarkerAdapter markerAdapter = new MarkerAdapter(list, getActivity());
recyclerView.setAdapter(markerAdapter);
markerAdapter.setOnBankClick(new MarkerAdapter.OnBankClick() {
@Override
public void onClick(PoiEntity poiEntity) {
FragmentTransaction fragmentTransaction = supportFragmentManager.beginTransaction();
if (poiEntity.getTaskStatus() == 0) {//网络未领取
initMarker(poiEntity, true);
switch (poiEntity.getType()) {
case 1:
case 2:
case 5:
marker.remove();
break;
case 3:
case 4:
case 6:
break;
}
} else if (poiEntity.getTaskStatus() == 1 || poiEntity.getTaskStatus() == 2 || poiEntity.getTaskStatus() == 3 || poiEntity.getTaskStatus() == 4) {//本地数据 或已领取的数据
frameLayout.setVisibility(View.GONE);
if (gatherGetFragment != null) {
fragmentTransaction.remove(gatherGetFragment);
}
if (bigMarker != null) {
bigMarker.setVisible(false);
}
for (int i = 0; i < removableScreenMarker.size(); i++) {
removableScreenMarker.get(i).remove();
}
removableScreenMarker.clear();
if (poiEntity.getTaskStatus() == 1) {//已领取
initMarker(poiEntity, true);
switch (poiEntity.getType()) {
case 1:
case 2:
case 5:
marker.remove();
break;
case 3:
case 4:
case 6:
break;
}
} else {
Bundle bundle = new Bundle();
bundle.putSerializable("poiEntity", poiEntity);
switch (poiEntity.getType()) {
case 1:
initMarker(poiEntity, false);
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
showSlidingFragment(poiFragment);
marker.remove();
break;
case 2:
initMarker(poiEntity, false);
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
showSlidingFragment(chargingStationFragment);
marker.remove();
break;
case 3:
initMarker(poiEntity, false);
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
showSlidingFragment(poiVideoFragment);
marker.remove();
break;
case 4:
initMarker(poiEntity, false);
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
showSlidingFragment(roadFragment);
marker.remove();
break;
case 5:
initMarker(poiEntity, false);
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
showSlidingFragment(otherFragment);
marker.remove();
break;
case 6:
initMarker(poiEntity, true);
break;
}
}
}
dialog.dismiss();
}
});
}
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);

View File

@ -7,6 +7,8 @@ public class HttpInterface {
public static final String DATA_IP = "http://172.23.139.4:9999/m4";//接口 public static final String DATA_IP = "http://172.23.139.4:9999/m4";//接口
public static final String TEST_IP = "http://dtxbmaps.navinfo.com/dtxb_test/m4";//测试接口 public static final String TEST_IP = "http://dtxbmaps.navinfo.com/dtxb_test/m4";//测试接口
public static final String TEST_GUIDANCE_IP = "http://172.21.98.90:9999/m4";//引导页完成接口 public static final String TEST_GUIDANCE_IP = "http://172.21.98.90:9999/m4";//引导页完成接口
public static final String APKIP = "http://172.23.139.4:8001/";
public static final String USER_PATH = "/user/";//我的 public static final String USER_PATH = "/user/";//我的
@ -19,22 +21,27 @@ public class HttpInterface {
*/ */
//dtxbmaps.navinfo.com/dtxb/m4/user/appVersion/checkVersion?version=155&operationType=android //dtxbmaps.navinfo.com/dtxb/m4/user/appVersion/checkVersion?version=155&operationType=android
//172.23.139.4:8001/appVersion/checkVersion?version=155&operationType=android version是版本 operationType固定值 安卓 get //172.23.139.4:8001/appVersion/checkVersion?version=155&operationType=android version是版本 operationType固定值 安卓 get
public static String APKIP = "http://172.23.139.4:8001/"; public static String APP_CHECK_VERSION ; //版本升级
public static final String APP_CHECK_VERSION = IP + USER_PATH + "appVersion/1/checkVersion"; //版本升级
public static void initAppPath(String userId) {
APP_CHECK_VERSION = TEST_IP + USER_PATH + "appVersion/"+userId+"/checkVersion"; //版本升级
}
/** /**
* 我的 * 我的
* Path=/m4/user/* * Path=/m4/user/*
*/ */
//172.23.139.4:8001/m4/user/update //172.23.139.4:8001/m4/user/update
public static String USER_UPDATE ;//用户资料 public static String USER_UPDATE;//用户资料
//172.23.139.4:8001/m4/userBankcard/update //172.23.139.4:8001/m4/userBankcard/update
public static String USER_BANKCARD_UP_DATA ; //绑定银行卡 public static String USER_BANKCARD_UP_DATA; //绑定银行卡
//172.23.139.4:8001/m4/userAuth/add //172.23.139.4:8001/m4/userAuth/add
public static String USER_AUTH_ADD; //实名认证 public static String USER_AUTH_ADD; //实名认证
//172.23.139.4:9999/m4/user/userLocation/1/userLocation post 参数 geom:geohash加密 //172.23.139.4:9999/m4/user/userLocation/1/userLocation post 参数 geom:geohash加密
public static String USER_LOCATION ; //上传用户坐标 public static String USER_LOCATION; //上传用户坐标
//dtxbmaps.navinfo.com/dtxb/m4/user/user/1/getUserDetailByUserid/1?datetime=1628749294718 //dtxbmaps.navinfo.com/dtxb/m4/user/user/1/getUserDetailByUserid/1?datetime=1628749294718
public static String USER_DETAIL_BY_USER_ID ; //获取用户信息 public static String USER_DETAIL_BY_USER_ID; //获取用户信息
//http://172.21.98.90:9999/m4/user/userGuide/1/insertUserGuide //http://172.21.98.90:9999/m4/user/userGuide/1/insertUserGuide
public static String INSERT_USER_GUIDE;//引导页完成接口 public static String INSERT_USER_GUIDE;//引导页完成接口
/** /**
@ -42,26 +49,26 @@ public class HttpInterface {
* Path=/m4/msgList/** * Path=/m4/msgList/**
*/ */
// public static String IP1 = "http://dtxbmaps.navinfo.com/dtxb/msg/"; // public static String IP1 = "http://dtxbmaps.navinfo.com/dtxb/msg/";
public static String MSG_CONTENT ;//发现 -富文本详情页请求 public static String MSG_CONTENT;//发现 -富文本详情页请求
public static String LIST_TASK ;//任务专区 public static String LIST_TASK;//任务专区
public static String LIST_EVENT;//活动专区 public static String LIST_EVENT;//活动专区
public static String LIST_TASK_EXPLAIN ;//任务说明 public static String LIST_TASK_EXPLAIN;//任务说明
//http://172.23.139.4:8002/findAndMessage/1/msg_list?fid=1&pageNum=1&pageSize=2 //http://172.23.139.4:8002/findAndMessage/1/msg_list?fid=1&pageNum=1&pageSize=2
public static String MSG_LISt ;//发现查询接口 public static String MSG_LISt;//发现查询接口
//http://172.23.139.4:8002/findAndMessage/1/exam_content?id=11 //http://172.23.139.4:8002/findAndMessage/1/exam_content?id=11
public static String EXAM_CONTENT;//发现 -能力测评获取试题接口 public static String EXAM_CONTENT;//发现 -能力测评获取试题接口
//http://172.23.139.4:8002/findAndMessage/1/submitExam //http://172.23.139.4:8002/findAndMessage/1/submitExam
public static String EXAM_SUBMIT ;//发现 -能力测评提交试卷 post public static String EXAM_SUBMIT;//发现 -能力测评提交试卷 post
/** /**
* 登录 * 登录
* Path=/m4/userlogin/** * Path=/m4/userlogin/**
*/ */
//http://172.23.139.4:9999/m4/userlogin/oauth/token //http://172.23.139.4:9999/m4/userlogin/oauth/token
public static String USER_LOGIN_OAUTH_TOKEN= TEST_IP + USER_LOGIN_PATH + "oauth/token" ; //登录接口 public static String USER_LOGIN_OAUTH_TOKEN = TEST_IP + USER_LOGIN_PATH + "oauth/token"; //登录接口
///m4/user/user/register ///m4/user/user/register
public static String USER_REGISTER= TEST_IP + USER_PATH + "user/register" ;//注册接口 public static String USER_REGISTER = TEST_IP + USER_PATH + "user/register";//注册接口
///m4/user/ phone/message ///m4/user/ phone/message
public static String USER_MESSAGE= TEST_IP + USER_PATH + "phone/message" ;//获取验证码 type 1注册获取 2更新 public static String USER_MESSAGE = TEST_IP + USER_PATH + "phone/message";//获取验证码 type 1注册获取 2更新
///m4/user/user/forgetPassword ///m4/user/user/forgetPassword
public static String USER_FORGET_PASSWORD = TEST_IP + USER_PATH + "user/forgetPassword";//忘记密码 public static String USER_FORGET_PASSWORD = TEST_IP + USER_PATH + "user/forgetPassword";//忘记密码
@ -72,62 +79,63 @@ public class HttpInterface {
* Path=/m4/price/** * Path=/m4/price/**
*/ */
//http://172.23.139.4:8004/userPrice/1/getPrice //http://172.23.139.4:8004/userPrice/1/getPrice
public static String GET_PRICE ;//我的-总资产 public static String GET_PRICE;//我的-总资产
//http://172.23.139.4:8004/userPrice/1/userPriceExchange?exchangeMoney=10&payType=1 //http://172.23.139.4:8004/userPrice/1/userPriceExchange?exchangeMoney=10&payType=1
public static String USER_PRICE_EXCHANGE ;//我的-财务信息-提现 public static String USER_PRICE_EXCHANGE;//我的-财务信息-提现
//dtxbmaps.navinfo.com/dtxb/m4/price/priceExchange/1/getList?datetime=1628647356815 //dtxbmaps.navinfo.com/dtxb/m4/price/priceExchange/1/getList?datetime=1628647356815
public static String PRICE_EXCHANGE ;//提现记录 public static String PRICE_EXCHANGE;//提现记录
/** /**
* 任务 * 任务
* Path=/m4/task/** * Path=/m4/task/**
*/ */
//172.23.139.4:8003/m4/task/1/getList //172.23.139.4:8003/m4/task/1/getList
public static String TASK_LIST ; //任务搜索 public static String TASK_LIST; //任务搜索
//172.23.139.4:8003/othertask/1/receivedOthertask //172.23.139.4:8003/othertask/1/receivedOthertask
public static String RECEIVED_OTHER_TASK ;//其他-领取任务 public static String RECEIVED_OTHER_TASK;//其他-领取任务
//172.23.139.4:8003/poitask/1/receivedPoitask/1 //172.23.139.4:8003/poitask/1/receivedPoitask/1
public static String RECEIVED_POI_TASK ;//poi-领取任务 public static String RECEIVED_POI_TASK;//poi-领取任务
//172.23.139.4:8003/poitask/1/submitPoitask?taskId=5001&name=测试修改名称&address=测试修改地址&existence=1&geo=1rn7exd5uhxy&memo=测试备注...33. //172.23.139.4:8003/poitask/1/submitPoitask?taskId=5001&name=测试修改名称&address=测试修改地址&existence=1&geo=1rn7exd5uhxy&memo=测试备注...33.
public static String SUBMIT_POI_TASK ;//poi-保存本地 public static String SUBMIT_POI_TASK;//poi-保存本地
//172.23.139.4:8003/othertask/1/submitOhtertask?taskId=5001&name=测试修改名称&address=测试修改地址&existence=1&geo=1rn7exd5uhxy&memo=测试备注 //172.23.139.4:8003/othertask/1/submitOhtertask?taskId=5001&name=测试修改名称&address=测试修改地址&existence=1&geo=1rn7exd5uhxy&memo=测试备注
public static String SUBMIT_OTHER_TASK ;//其他-保存本地 public static String SUBMIT_OTHER_TASK;//其他-保存本地
//172.23.139.4:8003/othertask/1/uploadpic //172.23.139.4:8003/othertask/1/uploadpic
public static String OTHER_TASK_UPLOAD_PIC;//其他-上传 public static String OTHER_TASK_UPLOAD_PIC;//其他-上传
//172.23.139.4:8003/ctask/1/receivedCtask/8608 //172.23.139.4:8003/ctask/1/receivedCtask/8608
public static String RECEIVED_CTASK ;//充电站-领取任务 public static String RECEIVED_CTASK;//充电站-领取任务
//172.23.139.4:8003/ctask/1/submitCtask?id=8608&name=充电站&address=地址&telephone=18812345678|14712345678&geo=1rn7exd5uhxy&memo=测试备注&sptype=1 //172.23.139.4:8003/ctask/1/submitCtask?id=8608&name=充电站&address=地址&telephone=18812345678|14712345678&geo=1rn7exd5uhxy&memo=测试备注&sptype=1
public static String SUBMIT_CTASK ;//充电站-保存本地 public static String SUBMIT_CTASK;//充电站-保存本地
//172.23.139.4:8003/cstask/1/submitCstask?taskId=0&name=充电站&geo=1rn7exd5uhxy&memo=测试备注&sptype=1&ffid=104&existence=1&detail={"cp_openType":"1,2","cp_floor":1,"cp_availableState":0,"sign_exist":0} //172.23.139.4:8003/cstask/1/submitCstask?taskId=0&name=充电站&geo=1rn7exd5uhxy&memo=测试备注&sptype=1&ffid=104&existence=1&detail={"cp_openType":"1,2","cp_floor":1,"cp_availableState":0,"sign_exist":0}
public static String SUBMIT_CSTASK ;//充电桩保存 public static String SUBMIT_CSTASK;//充电桩保存
//172.23.139.4:8003/poitask/1/uploadpic //172.23.139.4:8003/poitask/1/uploadpic
public static String POI_TASK_UPLOAD_PIC ;//poi-上传 public static String POI_TASK_UPLOAD_PIC;//poi-上传
//172.23.139.4:8003/roadtask/1/receivedRoadtask/8569 //172.23.139.4:8003/roadtask/1/receivedRoadtask/8569
public static String RECEIVED_ROAD_TASK ;//道路任务获取 public static String RECEIVED_ROAD_TASK;//道路任务获取
//172.23.139.4:8003/poivideotask/1/receivedPoivideotask/8569 //172.23.139.4:8003/poivideotask/1/receivedPoivideotask/8569
public static String RECEIVED_POI_VIDEO_TASK ;//poi录像任务获取 public static String RECEIVED_POI_VIDEO_TASK;//poi录像任务获取
// 172.23.139.4:8003/poivideotask/1/submitPoivideotask // 172.23.139.4:8003/poivideotask/1/submitPoivideotask
public static String INSIDE_API_LIST ;//poi录像 保存 public static String INSIDE_API_LIST;//poi录像 保存
//172.23.139.4:8003/poivideotask/1/uploadpic //172.23.139.4:8003/poivideotask/1/uploadpic
public static String POI_VIDEO_UPLOAD_PIC;//poi录像-上传 public static String POI_VIDEO_UPLOAD_PIC;//poi录像-上传
//172.23.139.4:8003/roadtask/1/submitRoadtask?taskId=0&name=段哥&address=二娃&memo=1rn7exd5uhxy&workType=2 //172.23.139.4:8003/roadtask/1/submitRoadtask?taskId=0&name=段哥&address=二娃&memo=1rn7exd5uhxy&workType=2
public static String ROAD_TASK_SUBMIT ;//道路录像-保存本地 public static String ROAD_TASK_SUBMIT;//道路录像-保存本地
//172.23.139.4:8003/roadtask/1/uploadpic //172.23.139.4:8003/roadtask/1/uploadpic
public static String ROAD_TASK_UPLOAD_PIC ;//道路录像上传 public static String ROAD_TASK_UPLOAD_PIC;//道路录像上传
//http://172.23.139.4:8003/m4/task/1/getPhone?geo=1rn7exd5uhxy //http://172.23.139.4:8003/m4/task/1/getPhone?geo=1rn7exd5uhxy
public static String GET_PHONES ;//电话区号和电话位数 public static String GET_PHONES;//电话区号和电话位数
//172.23.139.4:8003/cstask/1/uploadpic //172.23.139.4:8003/cstask/1/uploadpic
public static String CS_TASK_UP_LOAD_PIC;//充电桩-上传 public static String CS_TASK_UP_LOAD_PIC;//充电桩-上传
//172.23.139.4:8003/ctask/1/uploadpic //172.23.139.4:8003/ctask/1/uploadpic
public static String C_TASK_UP_LOAD_PIC ;//充电站-上传 public static String C_TASK_UP_LOAD_PIC;//充电站-上传
//172.23.139.4:8003/m4/task/1/taskName?geo=1rn7exd5uhxy&name=四维 //172.23.139.4:8003/m4/task/1/taskName?geo=1rn7exd5uhxy&name=四维
public static String TASK_NAME ;//poi-查重 public static String TASK_NAME;//poi-查重
//172.23.139.4:8003/m4/task/1/getCommitList?type=2&pageSize=10&pageNum=1 //172.23.139.4:8003/m4/task/1/getCommitList?type=2&pageSize=10&pageNum=1
public static String GET_COMMIT_LIST ;//紀錄已提交 public static String GET_COMMIT_LIST;//紀錄已提交
public static String RECEIVED_POLYGON_TASK ; //面状任务任务领取 public static String RECEIVED_POLYGON_TASK; //面状任务任务领取
//172.23.139.4:8003/m4/task/1/unReceivedTask?taskIds=&auditIds=214,278 取消领取的接口 //172.23.139.4:8003/m4/task/1/unReceivedTask?taskIds=&auditIds=214,278 取消领取的接口
public static String UNRECEIVED_POLYGON_TASK ;//所有類型结束领取 public static String UNRECEIVED_POLYGON_TASK;//所有類型结束领取
public static String COMPLETE ;//面状任务结束领取 public static String COMPLETE;//面状任务结束领取
public static String SUBMIT_POLYGON_TASK ;//面状任务开始采集 public static String SUBMIT_POLYGON_TASK;//面状任务开始采集
public static void initHttpInter(String USERID) { public static void initHttpInter(String USERID) {
/** /**
* 我的 * 我的
@ -144,7 +152,7 @@ public class HttpInterface {
//dtxbmaps.navinfo.com/dtxb/m4/user/user/1/getUserDetailByUserid/1?datetime=1628749294718 //dtxbmaps.navinfo.com/dtxb/m4/user/user/1/getUserDetailByUserid/1?datetime=1628749294718
USER_DETAIL_BY_USER_ID = TEST_IP + USER_PATH + "user/" + USERID + "/getUserDetailByUserid/" + USERID; //获取用户信息 USER_DETAIL_BY_USER_ID = TEST_IP + USER_PATH + "user/" + USERID + "/getUserDetailByUserid/" + USERID; //获取用户信息
//http://172.21.98.90:9999/m4/user/userGuide/1/insertUserGuide //http://172.21.98.90:9999/m4/user/userGuide/1/insertUserGuide
INSERT_USER_GUIDE=TEST_IP +USER_PATH+"userGuide/"+USERID+"/insertUserGuide";//引导页完成接口 INSERT_USER_GUIDE = TEST_IP + USER_PATH + "userGuide/" + USERID + "/insertUserGuide";//引导页完成接口
/** /**
* 发现 * 发现
* Path=/m4/msgList/** * Path=/m4/msgList/**
@ -225,7 +233,6 @@ public class HttpInterface {
} }
/** /**
* public static String IPm8 = "http://172.23.139.4:8003/m4/"; * public static String IPm8 = "http://172.23.139.4:8003/m4/";
* http://172.23.139.4:8003/m4/task/1/unReceivedTask?taskIds=&auditIds=214,278 * http://172.23.139.4:8003/m4/task/1/unReceivedTask?taskIds=&auditIds=214,278

View File

@ -555,6 +555,21 @@ public class GeometryTools {
return list; return list;
} }
public static List<LatLng> getLatList(Geometry geo){
List<LatLng> list = null;
Coordinate[] coordinates = geo.getCoordinates();
if (coordinates != null && coordinates.length > 0) {
list = new ArrayList<LatLng>();
for (Coordinate coor : coordinates) {
list.add(new LatLng(coor.y, coor.x));
}
}
return list;
}
public static Coordinate[] getLatLngs2(String str) { public static Coordinate[] getLatLngs2(String str) {
Coordinate[] coordinates = null; Coordinate[] coordinates = null;
if (str == null || str.trim().equals("")) if (str == null || str.trim().equals(""))

View File

@ -0,0 +1,28 @@
<?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"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_margin="10dp">
<ImageView
android:id="@+id/iv_icon"
android:layout_width="15dp"
android:layout_height="45dp"
android:layout_marginStart="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.26"
app:layout_constraintStart_toEndOf="@+id/iv_icon"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,18 @@
<?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"
android:layout_width="match_parent"
android:background="@color/white"
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_marker_view"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_margin="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>