修改面状任务上的bug
This commit is contained in:
parent
8a8117875f
commit
eccc2fdadb
@ -125,7 +125,4 @@ dependencies {
|
||||
implementation 'com.googlecode.mp4parser:isoparser:1.1.21'
|
||||
// Android常用库 https://github.com/l123456789jy/Lazy
|
||||
implementation 'com.github.lazylibrary:lazylibrary:1.0.2'
|
||||
//屏幕的适配百分比
|
||||
//https://www.jianshu.com/p/0c2a8db91bda?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation
|
||||
implementation 'com.android.support:percent:27.0.2'
|
||||
}
|
@ -115,6 +115,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
private String userEncode;
|
||||
private String centerEncode;
|
||||
private List<Removable> removables;
|
||||
private List<Removable> removablesMarker;
|
||||
private List<Removable> removablesLocality;
|
||||
/**
|
||||
* bitmapDescriptor1
|
||||
@ -210,6 +211,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
initThread();
|
||||
removables = new ArrayList<>();//存储网络数据的marker
|
||||
removablesLocality = new ArrayList<>(); //存储本地数据的marker
|
||||
removablesMarker = new ArrayList<>();//存储网络数据的marker
|
||||
tencentMap.addOnMapLoadedCallback(new TencentMap.OnMapLoadedCallback() {
|
||||
@Override
|
||||
public void onMapLoaded() {
|
||||
@ -400,9 +402,17 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
strokeWidth(5));
|
||||
polygon.setZIndex(1);
|
||||
removables.add(polygon);
|
||||
if (latPolygon != null && latPolygon.size() > 0) {
|
||||
latLng = latPolygon.get(0);
|
||||
com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid();
|
||||
double x = centroid.getX();
|
||||
double y = centroid.getY();
|
||||
if (centroid != null) {
|
||||
latLng = new LatLng();
|
||||
latLng.setLatitude(y);
|
||||
latLng.setLongitude(x);
|
||||
}
|
||||
/* if (latPolygon != null && latPolygon.size() > 0) {
|
||||
latLng = latPolygon.get(0);
|
||||
}*/
|
||||
}
|
||||
switch (Integer.valueOf(list.get(i).getType())) {
|
||||
case 1://poi
|
||||
@ -487,9 +497,63 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
public void initMarker(PoiEntity poiEntity) {
|
||||
sliding_layout.setPanelHeight(0);
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
|
||||
LatLng latLng = new LatLng();
|
||||
latLng.setLongitude(Double.parseDouble(poiEntity.getX()));
|
||||
latLng.setLatitude(Double.parseDouble(poiEntity.getY()));
|
||||
for (int i = 0; i < removablesMarker.size(); i++) {
|
||||
removablesMarker.get(i).remove();
|
||||
}
|
||||
removablesMarker.clear();
|
||||
String geo = poiEntity.getGeoWkt();
|
||||
Log.d("TAG", "onSuccess: " + geo);
|
||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||
LatLng latLng = null;
|
||||
if (geometry.getGeometryType().equals("Point")) {//点
|
||||
latLng = GeometryTools.createLatLng(geo);
|
||||
} else if (geometry.getGeometryType().equals("LineString")) {//线
|
||||
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
|
||||
// 构造 PolylineOpitons
|
||||
PolylineOptions polylineOptions = new PolylineOptions()
|
||||
.addAll(latLineString)
|
||||
// 折线设置圆形线头
|
||||
.lineCap(true)
|
||||
// 折线的颜色为绿色
|
||||
.color(0xff00ff00)
|
||||
// 折线宽度为5像素
|
||||
.width(25)
|
||||
// 还可以添加描边颜色
|
||||
.borderColor(0xffff0000)
|
||||
// 描边颜色的宽度,线宽还是 25 像素,不过填充的部分宽度为 `width` - 2 * `borderWidth`
|
||||
.borderWidth(1);
|
||||
// 绘制折线
|
||||
Polyline polyline = tencentMap.addPolyline(polylineOptions);
|
||||
polyline.setZIndex(3);
|
||||
removablesMarker.add(polyline);
|
||||
if (latLineString != null && latLineString.size() > 0) {
|
||||
latLng = latLineString.get(0);
|
||||
}
|
||||
} else if (geometry.getGeometryType().equals("Polygon")) {//面
|
||||
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo);
|
||||
Polygon polygon = tencentMap.addPolygon(new PolygonOptions().
|
||||
//连接封闭图形的点
|
||||
addAll(latPolygon).
|
||||
//填充颜色为红色
|
||||
fillColor(Color.parseColor("#97E0E7EC")).
|
||||
//边线颜色为黑色
|
||||
strokeColor(0xff000000).
|
||||
//边线宽度15像素
|
||||
strokeWidth(25));
|
||||
polygon.setZIndex(1);
|
||||
removablesMarker.add(polygon);
|
||||
com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid();
|
||||
double x = centroid.getX();
|
||||
double y = centroid.getY();
|
||||
if (centroid != null) {
|
||||
latLng = new LatLng();
|
||||
latLng.setLatitude(y);
|
||||
latLng.setLongitude(x);
|
||||
}
|
||||
/* if (latPolygon != null && latPolygon.size() > 0) {
|
||||
latLng = latPolygon.get(0);
|
||||
}*/
|
||||
}
|
||||
if (bigMarker == null) {
|
||||
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bag);
|
||||
bigMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.9f)
|
||||
@ -571,9 +635,17 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
strokeWidth(5));
|
||||
polygon.setZIndex(1);
|
||||
removablesLocality.add(polygon);
|
||||
if (latPolygon != null && latPolygon.size() > 0) {
|
||||
latLng = latPolygon.get(0);
|
||||
com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid();
|
||||
double x = centroid.getX();
|
||||
double y = centroid.getY();
|
||||
if (centroid != null) {
|
||||
latLng = new LatLng();
|
||||
latLng.setLatitude(y);
|
||||
latLng.setLongitude(x);
|
||||
}
|
||||
/* if (latPolygon != null && latPolygon.size() > 0) {
|
||||
latLng = latPolygon.get(0);
|
||||
}*/
|
||||
}
|
||||
} else {
|
||||
if (allTaskStatus.get(i).getX() != null && allTaskStatus.get(i).getY() != null) {
|
||||
@ -786,7 +858,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
FilterFragment filterFragment = (FilterFragment) supportFragmentManager.findFragmentByTag(FilterFragment.class.getName());
|
||||
if (filterFragment != null) {
|
||||
fragmentTransaction.remove(filterFragment);
|
||||
|
||||
}
|
||||
} else if (data.what == Constant.GATHER_GET) { //筛选item 点击开始采集
|
||||
PoiEntity poiEntity = (PoiEntity) data.obj;
|
||||
@ -889,14 +960,19 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
if (markerPile != null) {
|
||||
markerPile.remove();
|
||||
}
|
||||
|
||||
if (bigMarker != null) {
|
||||
bigMarker.setVisible(false);
|
||||
}
|
||||
for (int i = 0; i < removablesMarker.size(); i++) {
|
||||
removablesMarker.get(i).remove();
|
||||
}
|
||||
removablesMarker.clear();
|
||||
} else if (data.what == Constant.MAIN_BUTTON_VISIABLE) {//控制主界面各个按钮显隐状态的what值
|
||||
setMainButtonVisiable((Integer) data.obj);
|
||||
} else if (data.what == Constant.MAIN_HEADER) {// 控制主界面各个header
|
||||
View view = (View) data.obj;
|
||||
if (view!=null){
|
||||
if (view != null) {
|
||||
initHeader(view);
|
||||
}
|
||||
|
||||
@ -911,11 +987,16 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||
} else {
|
||||
frameLayout.setVisibility(View.GONE);
|
||||
setMainButtonVisiable(View.VISIBLE);
|
||||
fragmentTransaction.remove(gatherGetFragment);
|
||||
}
|
||||
if (bigMarker != null) {
|
||||
bigMarker.setVisible(false);
|
||||
}
|
||||
for (int i = 0; i < removablesMarker.size(); i++) {
|
||||
removablesMarker.get(i).remove();
|
||||
}
|
||||
removablesMarker.clear();
|
||||
} else if (data.what == Constant.CHARGING_STATION) {//充电站的充电桩-新增
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putBoolean("isSliding", false); // 通知抽屉不收回
|
||||
@ -958,7 +1039,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
int type = data.arg1;
|
||||
showPoiMarkerByType(type, latLng);
|
||||
} else if (data.what == Constant.EVENT_WHAT_COMPLETE_TASK) {
|
||||
// initRemoveFragment();
|
||||
// initRemoveFragment();
|
||||
PoiEntity poiEntity = (PoiEntity) data.obj;
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putBoolean("isSliding", true); // 通知抽屉不收回
|
||||
@ -997,6 +1078,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
if (bigMarker != null) {
|
||||
bigMarker.setVisible(false);
|
||||
}
|
||||
for (int i = 0; i < removablesMarker.size(); i++) {
|
||||
removablesMarker.get(i).remove();
|
||||
}
|
||||
removablesMarker.clear();
|
||||
Toast.makeText(getActivity(), "不在作业范围", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
frameLayout.setVisibility(View.VISIBLE);
|
||||
@ -1017,7 +1102,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
PoiVideoFragment poiVideoFragment = (PoiVideoFragment) supportFragmentManager.findFragmentByTag(PoiVideoFragment.class.getName());
|
||||
if (poiVideoFragment != null) {
|
||||
fragmentTransaction.remove(poiVideoFragment);
|
||||
} RoadFragment roadFragment = (RoadFragment) supportFragmentManager.findFragmentByTag(RoadFragment.class.getName());
|
||||
}
|
||||
RoadFragment roadFragment = (RoadFragment) supportFragmentManager.findFragmentByTag(RoadFragment.class.getName());
|
||||
if (roadFragment != null) {
|
||||
fragmentTransaction.remove(roadFragment);
|
||||
}
|
||||
@ -1222,6 +1308,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
if (bigMarker != null) {
|
||||
bigMarker.remove();
|
||||
}
|
||||
for (int i = 0; i < removablesMarker.size(); i++) {
|
||||
removablesMarker.get(i).remove();
|
||||
}
|
||||
removablesMarker.clear();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
|
@ -4,9 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_heightPercent="100%"
|
||||
android:background="@drawable/bg"
|
||||
|
||||
tools:context="activity.LoginActivity">
|
||||
|
||||
<TextView
|
||||
|
Loading…
x
Reference in New Issue
Block a user