修改充电桩和充电站的marker 上的bug

This commit is contained in:
wds 2021-08-13 10:08:33 +08:00
parent c51d9ebeb5
commit 3863f6e1ad
5 changed files with 215 additions and 154 deletions

View File

@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion '29.0.2'
ndkVersion '23.0.7123448'
// ndkVersion '23.0.7123448'
defaultConfig {
applicationId "com.navinfo.outdoor"

View File

@ -19,7 +19,12 @@ import com.navinfo.outdoor.room.ChargingPileEntity;
import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.FragmentBackHandler;
import com.navinfo.outdoor.util.GPSUtils;
import com.navinfo.outdoor.util.MapManager;
import com.sothree.slidinguppanel.SlidingUpPanelLayout;
import com.tencent.tencentmap.mapsdk.maps.CameraUpdate;
import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory;
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
import com.tencent.tencentmap.mapsdk.maps.model.CameraPosition;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import org.greenrobot.eventbus.EventBus;
@ -31,8 +36,11 @@ public abstract class BaseDrawerFragment extends BaseFragment {
public boolean isSliding = true; // fragment被销毁时true-抽屉收回false-抽屉状态不变
protected PoiEntity showPoiEntity;
public SlidingUpPanelLayout slidingPaneLayout;
public TencentMap tencentMap;
@Override
protected void initData() {
tencentMap = MapManager.getInstance().getTencentMap();
super.initData();
int mockGps = Constant.currentLocation.isMockGps();
//1为是0为否-1为无法判断
@ -55,6 +63,14 @@ public abstract class BaseDrawerFragment extends BaseFragment {
EventBus.getDefault().post(obtain);
}
public void moveLatlng(LatLng latLng, TencentMap.CancelableCallback cancelableCallback) {
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition(
latLng, //中心点坐标地图目标经纬度
tencentMap.getCameraPosition().zoom, //目标缩放级别
tencentMap.getCameraPosition().tilt, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
tencentMap.getCameraPosition().bearing)); //目标旋转角 0~360° (正北方为0)
tencentMap.animateCamera(cameraSigma, cancelableCallback);
}
@Override
public boolean onBackPressed() {

View File

@ -4,6 +4,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Point;
import android.net.Uri;
import android.os.Bundle;
import android.os.Message;
@ -54,11 +55,21 @@ import com.navinfo.outdoor.room.PoiDatabase;
import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.GeometryTools;
import com.navinfo.outdoor.util.MapManager;
import com.navinfo.outdoor.util.PhotoPathUtil;
import com.navinfo.outdoor.util.PhotoUtils;
import com.navinfo.outdoor.util.PictureUtil;
import com.navinfo.outdoor.util.ToastUtil;
import com.sothree.slidinguppanel.SlidingUpPanelLayout;
import com.tencent.tencentmap.mapsdk.maps.CameraUpdate;
import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory;
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
import com.tencent.tencentmap.mapsdk.maps.model.CameraPosition;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
import com.vividsolutions.jts.geom.impl.PackedCoordinateSequence;
@ -115,6 +126,8 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
private Integer chargingPileBody;
private ArrayList<File> phoneLists;
private NestedScrollView nestedScrollView;
private Marker markerPile;
private Point screenPilePositions;
public static ChargingPileFragment newInstance(Bundle bundle) {
ChargingPileFragment fragment = new ChargingPileFragment();
@ -153,7 +166,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
obtain.what = Constant.TREASURE_FRAGMENT;
obtain.obj = true;
EventBus.getDefault().post(obtain);
}else {
} else {
Message obtain = Message.obtain();
obtain.what = Constant.TREASURE_FRAGMENT;
obtain.obj = false;
@ -166,17 +179,11 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), FragmentManagement.class);
intent.putExtra("tag",8);
intent.putExtra("tag", 8);
startActivity(intent);
}
});
if (latLng!=null){
Message obtain = Message.obtain();
obtain.what = Constant.POI_DRAWER;
obtain.obj = latLng;
EventBus.getDefault().post(obtain);
}
moveLatlng(latLng,null);
}
@Override
@ -192,17 +199,27 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
if (isChecked) {
checkBoxLife.setText("保存");
checkBoxLife.setTextColor(Color.WHITE);
Message obtain = Message.obtain();
obtain.what = Constant.MAIN_CHARGING_PILE;
obtain.obj = latLng;
EventBus.getDefault().post(obtain);
moveLatlng(latLng, new TencentMap.CancelableCallback() {
@Override
public void onFinish() {
screenPilePositions = tencentMap.getProjection().toScreenLocation(latLng);
//创建Marker对象之前设置属性
if (markerPile != null) {
markerPile.setFixingPoint(screenPilePositions.x, screenPilePositions.y);
}
}
@Override
public void onCancel() {
}
});
} else {
checkBoxLife.setText("编辑");
checkBoxLife.setTextColor(Color.BLACK);
Message obtain = Message.obtain();
obtain.what = Constant.MAIN_CHARGING_CHECKED_PILE;
obtain.obj = true;
EventBus.getDefault().post(obtain);
latLng = tencentMap.getProjection().fromScreenLocation(screenPilePositions);
markerPile.setPosition(latLng);
markerPile.setFixingPointEnable(false);
}
}
});
@ -382,7 +399,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
});
setSlidingUpPanelLayout(Constant.SLIDING_LAYOUT);
nestedScrollView = findViewById(R.id.nested_scroll_view);
if (slidingPaneLayout!=null) {
if (slidingPaneLayout != null) {
slidingPaneLayout.setScrollableView(nestedScrollView);
}
rlPanorama = findViewById(R.id.rl_panorama);
@ -582,9 +599,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
PoiEntity showPoiEntity = new Gson().fromJson(station, PoiEntity.class);
pid = showPoiEntity.getId();
taskId = showPoiEntity.getTaskId();
latLng = new LatLng();
latLng.setLatitude(Double.valueOf(showPoiEntity.getY()));
latLng.setLongitude(Double.valueOf(showPoiEntity.getX()));
}
// 添加信息
ChargingPileEntity chargingPileEntity = (ChargingPileEntity) getArguments().getSerializable("chargingPileEntity");
@ -599,6 +613,10 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
// 解密geo
String decodeGeometry = Geohash.getInstance().decode(p);
latLng = GeometryTools.createLatLng(decodeGeometry);
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.mipmap.datouzhen);
markerPile = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor));
markerPile.setZIndex(4);
moveLatlng(latLng, null);
}
String memo = chargingPileEntity.getMemo();
if (memo != null && !memo.equals("")) {
@ -652,6 +670,51 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
}
}
/* private void initPileMarker(LatLng latLng) {
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.mipmap.datouzhen);
if (markerPile == null) {
markerPile = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor));
markerPile.setZIndex(MARKER_BIG);
}
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition(
latLng, //中心点坐标地图目标经纬度
tencentMap.getCameraPosition().zoom, //目标缩放级别
tencentMap.getCameraPosition().tilt, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
tencentMap.getCameraPosition().bearing)); //目标旋转角 0~360° (正北方为0)
tencentMap.animateCamera(cameraSigma, new TencentMap.CancelableCallback() {
@Override
public void onFinish() {
screenPilePositions = tencentMap.getProjection().toScreenLocation(latLng);
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
//创建Marker对象之前设置属性
if (markerPile != null) {
markerPile.setFixingPoint(screenPosition.x, screenPosition.y);
}
}
@Override
public void onCancel() {
}
});
}
private void initCheckedPileMarker(int poiWord) {
if (screenPilePositions != null) {
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
LatLng latLng = tencentMap.getProjection().fromScreenLocation(screenPilePositions);
markerPile.setPosition(latLng);
markerPile.setFixingPointEnable(false);
Constant.markerLatlng = latLng;
Message obtain = Message.obtain();
obtain.what = poiWord;
obtain.obj = latLng;
EventBus.getDefault().post(obtain);
}
}*/
public void setCList(ArrayList<String> list) {
switch (list.size()) {
case 1:
@ -768,7 +831,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
ChargingPileEntity chargingPileEntity = initChargingPileEntityByUI(new ChargingPileEntity());
PoiCheckResult poiCheckResult = checkChargingPileEntity(chargingPileEntity);
if (poiCheckResult.getCode() == 1) {
Toast.makeText(getActivity(), poiCheckResult.getMsg()+"", Toast.LENGTH_SHORT).show();
Toast.makeText(getActivity(), poiCheckResult.getMsg() + "", Toast.LENGTH_SHORT).show();
return;
}
new Thread(new Runnable() {
@ -813,7 +876,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
break;
case R.id.rl_panorama:
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
file = PhotoUtils.showPhotoFile("a",latLng);
file = PhotoUtils.showPhotoFile("a", latLng);
intentPanorama.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
startActivityForResult(intentPanorama, 101);
break;
@ -838,7 +901,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
break;
case R.id.rl_scutcheon:
Intent intentScutcheon = new Intent("android.media.action.IMAGE_CAPTURE");
file = PhotoUtils.showPhotoFile("c",latLng);
file = PhotoUtils.showPhotoFile("c", latLng);
intentScutcheon.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
startActivityForResult(intentScutcheon, 105);
break;
@ -868,7 +931,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
break;
case R.id.rl_number:
Intent intentNumber = new Intent("android.media.action.IMAGE_CAPTURE");
file = PhotoUtils.showPhotoFile("e",latLng);
file = PhotoUtils.showPhotoFile("e", latLng);
intentNumber.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
startActivityForResult(intentNumber, 110);
break;
@ -928,7 +991,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
// }
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
@ -967,11 +1029,11 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
Toast.makeText(getContext(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
return;
}else {
} else {
String s = PhotoUtils.showPhotoAndGetPath(file, ivPanorama);
tvPanorama.setTag(s);
}
file=null;
file = null;
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
@ -992,11 +1054,11 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
Toast.makeText(getContext(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
return;
}else {
} else {
String s = PhotoUtils.showPhotoAndGetPath(file, ivCoding);
tvCoding.setTag(s);
}
file=null;
file = null;
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
@ -1017,11 +1079,11 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
Toast.makeText(getContext(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
return;
}else {
} else {
String s = PhotoUtils.showPhotoAndGetPath(file, ivEquipment);
tvEquipment.setTag(s);
}
file=null;
file = null;
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
@ -1043,11 +1105,11 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
Toast.makeText(getContext(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
return;
}else {
} else {
String s = PhotoUtils.showPhotoAndGetPath(file, ivFacility);
tvFacility.setTag(s);
}
file=null;
file = null;
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
@ -1068,11 +1130,11 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
Toast.makeText(getContext(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
return;
}else {
} else {
String s = PhotoUtils.showPhotoAndGetPath(file, ivScutcheon);
tvScutcheon.setTag(s);
}
file=null;
file = null;
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
@ -1094,11 +1156,12 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
Toast.makeText(getContext(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
return;
}else {
} else {
String s = PhotoUtils.showPhotoAndGetPath(file, ivDevice);
tvDevice.setTag(s);
}
file=null;
file = null;
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
@ -1119,11 +1182,11 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
Toast.makeText(getContext(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
return;
}else {
} else {
String s = PhotoUtils.showPhotoAndGetPath(file, ivUsable);
tvUsable.setTag(s);
}
file=null;
file = null;
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
@ -1144,11 +1207,11 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
Toast.makeText(getContext(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
return;
}else {
} else {
String s = PhotoUtils.showPhotoAndGetPath(file, ivAvailable);
tvAvailable.setTag(s);
}
file=null;
file = null;
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
@ -1169,11 +1232,11 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
Toast.makeText(getContext(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
return;
}else {
} else {
String s = PhotoUtils.showPhotoAndGetPath(file, ivParking);
tvParking.setTag(s);
}
file=null;
file = null;
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
@ -1194,11 +1257,11 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
Toast.makeText(getContext(), "没有拍摄照片", Toast.LENGTH_SHORT).show();
return;
}else {
} else {
String s = PhotoUtils.showPhotoAndGetPath(file, ivNumber);
tvNumber.setTag(s);
}
file=null;
file = null;
/* int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height > width) {
@ -1223,10 +1286,12 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
if (EventBus.getDefault().isRegistered(this))//加上判断
EventBus.getDefault().unregister(this);
super.onDestroy();
if (markerPile!=null){
markerPile.remove();
}
}
@Override
protected ChargingPileEntity initChargingPileEntityByUI(ChargingPileEntity chargingPileEntity) {
ArrayList<String> photo = new ArrayList<>();
@ -1312,61 +1377,61 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
@Override
protected PoiCheckResult checkChargingPileEntity(ChargingPileEntity entity) {
PoiCheckResult poiCheckResult = new PoiCheckResult();
if (entity.getP()==null){
if (entity.getP() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请确定点位");
return poiCheckResult;
}
if (entity.getName()==null){
if (entity.getName() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请输入 名称");
return poiCheckResult;
}
if (entity.getCp_openType()==null){
if (entity.getCp_openType() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("开放状态未勾选");
return poiCheckResult;
}
if (tvPanorama.getTag()==null){
if (tvPanorama.getTag() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 全景图");
return poiCheckResult;
}
if (tvCoding.getTag()==null){
if (tvCoding.getTag() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 充电桩编码");
return poiCheckResult;
}
if (tvEquipment.getTag()==null){
if (tvEquipment.getTag() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 设备标牌");
return poiCheckResult;
}
if (sign_exist!=0){
if ( tvFacility.getTag()==null){
if (sign_exist != 0) {
if (tvFacility.getTag() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 设备标牌");
return poiCheckResult;
}
}
if (sign_exist==1){
if (tvScutcheon.getTag() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 设备标牌");
return poiCheckResult;
}
if (tvDevice.getTag() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 设备标牌");
return poiCheckResult;
}
}
if ( tvUsable.getTag() == null) {
if (sign_exist == 1) {
if (tvScutcheon.getTag() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 设备标牌");
return poiCheckResult;
}
if (tvDevice.getTag() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 设备标牌");
return poiCheckResult;
}
}
if (tvUsable.getTag() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 可用状态");
return poiCheckResult;
}
if ( tvParking.getTag() == null) {
if (tvParking.getTag() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 停车位编号");
return poiCheckResult;

View File

@ -260,9 +260,14 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
@Override
public void item(ChargingPileEntity chargingPileEntity) {
Message obtains = Message.obtain();
obtains.what = Constant.CHARGING_STATION_ITEM;
obtains.what = Constant.CHARGING_STATION_PILE;
obtains.obj = chargingPileEntity;
EventBus.getDefault().post(obtains);
String showStation = initShowStation();
Message obtain = Message.obtain();
obtain.what = Constant.CHARGING_STATION;
obtain.obj = showStation;
EventBus.getDefault().post(obtain);
}
});
@ -570,6 +575,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
if (showPoiEntity.getTaskStatus() == 3) {
disables();
}
initPile();
}
private void initPile() {
@ -588,17 +594,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
obtain.what = Constant.CHARGING_STATION;
obtain.obj = showStation;
EventBus.getDefault().post(obtain);
} else {
Message obtains = Message.obtain();
obtains.what = Constant.CHARGING_STATION_PILE;
obtains.obj = null;
EventBus.getDefault().post(obtains);
initRemovePileSharePre();
String showStation = initShowStation();
Message obtain = Message.obtain();
obtain.what = Constant.CHARGING_STATION;
obtain.obj = showStation;
EventBus.getDefault().post(obtain);
}
}
@ -805,11 +800,27 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
startActivityForResult(intentScutcheon, 105);
break;
case R.id.linear_charging_pile:
initPile();
initChargingPile();
break;
}
}
private void initChargingPile() {
Message obtains = Message.obtain();
obtains.what = Constant.CHARGING_STATION_PILE;
ChargingPileEntity chargingPileEntity = new ChargingPileEntity();
String encode = Geohash.getInstance().encode(latLng.latitude, latLng.longitude);
chargingPileEntity.setP(encode);
obtains.obj = chargingPileEntity;
EventBus.getDefault().post(obtains);
initRemovePileSharePre();
String showStation = initShowStation();
Message obtain = Message.obtain();
obtain.what = Constant.CHARGING_STATION;
obtain.obj = showStation;
EventBus.getDefault().post(obtain);
}
/**
* 根据充电站数据检查充电桩数据如果没有网络保存则批量网络保存
*/

View File

@ -138,6 +138,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
private List<Integer> upload;
private Point screenPilePositions;
private List<Removable> pileLocality;
private final int MARKER_DOT=3;
private final int MARKER_LINE=2;
private final int MARKER_FACE=1;
private final int MARKER_BIG=4;
public static TreasureFragment newInstance(Bundle bundle) {
TreasureFragment fragment = new TreasureFragment();
@ -493,14 +497,13 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
// 构造 PolylineOpitons
PolylineOptions polylineOptions = new PolylineOptions()
.addAll(latLineString)
// 折线设置圆形线头
.lineCap(true)
// 折线的颜色为绿色
.color(0xff00ff00)
// 折线宽度为5像素
.width(35)
.width(10)
.arrow(true)
.arrowSpacing(100)
.arrowTexture(bitmapLine);
@ -510,7 +513,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
//.borderWidth(1);
// 绘制折线
Polyline polyline = tencentMap.addPolyline(polylineOptions);
polyline.setZIndex(3);
polyline.setZIndex(MARKER_LINE);
removables.add(polyline);
if (latLineString != null && latLineString.size() > 0) {
latLng = latLineString.get(0);
@ -526,7 +529,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
strokeColor(0xff000000).
//边线宽度15像素
strokeWidth(5));
polygon.setZIndex(1);
polygon.setZIndex(MARKER_FACE);
removables.add(polygon);
com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid();
double x = centroid.getX();
@ -547,7 +550,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
poiMarker.setZIndex(2);
poiMarker.setZIndex(MARKER_DOT);
poiMarker.setTag(listBean);
removables.add(poiMarker);
poiMarker.setClickable(true);
@ -557,10 +560,11 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
stationMarker.setZIndex(MARKER_DOT);
stationMarker.setTag(listBean);
removables.add(stationMarker);
stationMarker.setClickable(true);
stationMarker.setZIndex(2);
break;
case 3://poi录像
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_video_bg1);
@ -568,40 +572,40 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.flat(true)
.clockwise(false));
poiVideoMarker.setTag(listBean);
poiVideoMarker.setZIndex(MARKER_DOT);
removables.add(poiVideoMarker);
poiVideoMarker.setClickable(true);
poiVideoMarker.setZIndex(2);
break;
case 4://道路录像
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bg);
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
roadMarker.setZIndex(MARKER_DOT);
roadMarker.setTag(listBean);
removables.add(roadMarker);
roadMarker.setClickable(true);
roadMarker.setZIndex(2);
break;
case 5://其他
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg1);
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
otherMarker.setZIndex(MARKER_DOT);
otherMarker.setTag(listBean);
removables.add(otherMarker);
otherMarker.setClickable(true);
otherMarker.setZIndex(2);
break;
case 6://面状任务
BitmapDescriptor Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_bg);
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
Log.d("面状任务", "onSuccess: " + planarMarker);
planarMarker.setZIndex(MARKER_DOT);
planarMarker.setTag(listBean);
removables.add(planarMarker);
planarMarker.setClickable(true);
planarMarker.setZIndex(2);
break;
}
}
@ -660,7 +664,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.borderWidth(1);*/
// 绘制折线
Polyline polyline = tencentMap.addPolyline(polylineOptions);
polyline.setZIndex(3);
polyline.setZIndex(MARKER_LINE);
removablesMarker.add(polyline);
if (latLineString != null && latLineString.size() > 0) {
latLng = latLineString.get(0);
@ -677,7 +681,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
//边线宽度15像素
strokeWidth(25));
polygon.setZIndex(1);
polygon.setZIndex(MARKER_FACE);
removablesMarker.add(polygon);
com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid();
double x = centroid.getX();
@ -714,8 +718,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
bigMarker.setIcon(descriptor);
}
bigMarker.setVisible(true);
bigMarker.setZIndex(MARKER_BIG);
bigMarker.setClickable(false);
bigMarker.setZIndex(4);
frameLayout.setVisibility(View.VISIBLE);
setMainButtonVisiable(View.GONE);
fragmentTransaction = supportFragmentManager.beginTransaction();
@ -777,7 +782,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.borderWidth(1);*/
// 绘制折线
Polyline polyline = tencentMap.addPolyline(polylineOptions);
polyline.setZIndex(3);
polyline.setZIndex(MARKER_LINE);
removablesLocality.add(polyline);
if (latLineString != null && latLineString.size() > 0) {
latLng = latLineString.get(0);
@ -793,7 +798,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
strokeColor(0xff00ff00).
//边线宽度15像素
strokeWidth(5));
polygon.setZIndex(1);
polygon.setZIndex(MARKER_FACE);
removablesLocality.add(polygon);
com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid();
double x = centroid.getX();
@ -824,7 +829,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.flat(true)
.clockwise(false));
poiMarker.setClickable(true);
poiMarker.setZIndex(2);
poiMarker.setZIndex(MARKER_DOT);
poiMarker.setTitle(poiEntity.getName() + "");
poiMarker.setTag(poiEntity);
removablesLocality.add(poiMarker);
@ -840,7 +845,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.flat(true)
.clockwise(false));
stationMarker.setClickable(true);
stationMarker.setZIndex(2);
stationMarker.setZIndex(MARKER_DOT);
stationMarker.setTitle(poiEntity.getName() + "");
stationMarker.setTag(poiEntity);
removablesLocality.add(stationMarker);
@ -856,7 +861,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.flat(true)
.clockwise(false));
poiVideoMarker.setClickable(true);
poiVideoMarker.setZIndex(2);
poiVideoMarker.setZIndex(MARKER_DOT);
poiVideoMarker.setTitle(poiEntity.getName() + "");
poiVideoMarker.setTag(poiEntity);
removablesLocality.add(poiVideoMarker);
@ -872,7 +877,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.flat(true)
.clockwise(false));
roadMarker.setClickable(true);
roadMarker.setZIndex(2);
roadMarker.setZIndex(MARKER_DOT);
roadMarker.setTitle(poiEntity.getName() + "");
roadMarker.setTag(poiEntity);
removablesLocality.add(roadMarker);
@ -888,7 +893,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.flat(true)
.clockwise(false));
otherMarker.setClickable(true);
otherMarker.setZIndex(2);
otherMarker.setZIndex(MARKER_DOT);
otherMarker.setTitle(poiEntity.getName() + "");
otherMarker.setTag(poiEntity);
removablesLocality.add(otherMarker);
@ -904,7 +909,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.clockwise(false)
.flat(true));
planarMarker.setClickable(true);
planarMarker.setZIndex(2);
planarMarker.setZIndex(MARKER_DOT);
planarMarker.setTitle(poiEntity.getName() + "");
planarMarker.setTag(poiEntity);
removablesLocality.add(planarMarker);
@ -1128,13 +1133,14 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
if ((boolean) data.obj) {
initCheckedMarker(Constant.CHARGING_STATION_WORD);
}
} else if (data.what == Constant.MAIN_CHARGING_PILE) {//充电桩采集-移动位置
}/* 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) {//其他采集-移动位置
}*/
else if (data.what == Constant.MAIN_OTHER) {//其他采集-移动位置
initPoiMarker((LatLng) data.obj);
} else if (data.what == Constant.MAIN_CHECKED_OTHER) {//其他采集-确定位置
if ((boolean) data.obj) {
@ -1188,6 +1194,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
Bundle bundle = new Bundle();
bundle.putBoolean("isSliding", false); // 通知抽屉不收回
bundle.putString("station", (String) data.obj);
if (chargingPileEntity != null) {
bundle.putSerializable("chargingPileEntity", chargingPileEntity);
}
@ -1316,48 +1323,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
});
}
private void initPileMarker(LatLng latLng) {
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.mipmap.datouzhen);
if (markerPile == null) {
markerPile = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor));
}
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition(
latLng, //中心点坐标地图目标经纬度
tencentMap.getCameraPosition().zoom, //目标缩放级别
tencentMap.getCameraPosition().tilt, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
tencentMap.getCameraPosition().bearing)); //目标旋转角 0~360° (正北方为0)
tencentMap.animateCamera(cameraSigma, new TencentMap.CancelableCallback() {
@Override
public void onFinish() {
screenPilePositions = tencentMap.getProjection().toScreenLocation(latLng);
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
//创建Marker对象之前设置属性
if (markerPile != null) {
markerPile.setFixingPoint(screenPosition.x, screenPosition.y);
}
}
@Override
public void onCancel() {
}
});
}
private void initCheckedPileMarker(int poiWord) {
if (screenPilePositions != null) {
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
LatLng latLng = tencentMap.getProjection().fromScreenLocation(screenPilePositions);
markerPile.setPosition(latLng);
markerPile.setFixingPointEnable(false);
Constant.markerLatlng = latLng;
Message obtain = Message.obtain();
obtain.what = poiWord;
obtain.obj = latLng;
EventBus.getDefault().post(obtain);
}
}
private void initCheckedMarker(int poiWord) {
if (screenPosition != null) {
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
@ -1495,6 +1460,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}
break;
case R.id.iv_submit://弹窗
if (upload == null) {
Toast.makeText(getActivity(), "网络请求失败", Toast.LENGTH_SHORT).show();
return;
}
//分享
CharSequence title = "请选择上报类型";
@ -1588,15 +1557,15 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
private void showPoiMarkerByType(int type, LatLng latLng) {
if (type == 1) {
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor1).zIndex(2));
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor1).zIndex(MARKER_BIG));
} else if (type == 2) {
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor2).zIndex(2));
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor2).zIndex(MARKER_BIG));
} else if (type == 3) {
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor3).zIndex(2));
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor3).zIndex(MARKER_BIG));
} else if (type == 4) {
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor4).zIndex(2));
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor4).zIndex(MARKER_BIG));
} else if (type == 5) {
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor5).zIndex(2));
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor5).zIndex(MARKER_BIG));
}
}