修改充电桩和充电站的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 { android {
compileSdkVersion 29 compileSdkVersion 29
buildToolsVersion '29.0.2' buildToolsVersion '29.0.2'
ndkVersion '23.0.7123448' // ndkVersion '23.0.7123448'
defaultConfig { defaultConfig {
applicationId "com.navinfo.outdoor" 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.room.PoiEntity;
import com.navinfo.outdoor.util.FragmentBackHandler; import com.navinfo.outdoor.util.FragmentBackHandler;
import com.navinfo.outdoor.util.GPSUtils; import com.navinfo.outdoor.util.GPSUtils;
import com.navinfo.outdoor.util.MapManager;
import com.sothree.slidinguppanel.SlidingUpPanelLayout; 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 com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
@ -31,8 +36,11 @@ public abstract class BaseDrawerFragment extends BaseFragment {
public boolean isSliding = true; // fragment被销毁时true-抽屉收回false-抽屉状态不变 public boolean isSliding = true; // fragment被销毁时true-抽屉收回false-抽屉状态不变
protected PoiEntity showPoiEntity; protected PoiEntity showPoiEntity;
public SlidingUpPanelLayout slidingPaneLayout; public SlidingUpPanelLayout slidingPaneLayout;
public TencentMap tencentMap;
@Override @Override
protected void initData() { protected void initData() {
tencentMap = MapManager.getInstance().getTencentMap();
super.initData(); super.initData();
int mockGps = Constant.currentLocation.isMockGps(); int mockGps = Constant.currentLocation.isMockGps();
//1为是0为否-1为无法判断 //1为是0为否-1为无法判断
@ -55,6 +63,14 @@ public abstract class BaseDrawerFragment extends BaseFragment {
EventBus.getDefault().post(obtain); 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 @Override
public boolean onBackPressed() { public boolean onBackPressed() {

View File

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

View File

@ -260,9 +260,14 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
@Override @Override
public void item(ChargingPileEntity chargingPileEntity) { public void item(ChargingPileEntity chargingPileEntity) {
Message obtains = Message.obtain(); Message obtains = Message.obtain();
obtains.what = Constant.CHARGING_STATION_ITEM; obtains.what = Constant.CHARGING_STATION_PILE;
obtains.obj = chargingPileEntity; obtains.obj = chargingPileEntity;
EventBus.getDefault().post(obtains); 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) { if (showPoiEntity.getTaskStatus() == 3) {
disables(); disables();
} }
initPile();
} }
private void initPile() { private void initPile() {
@ -588,17 +594,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
obtain.what = Constant.CHARGING_STATION; obtain.what = Constant.CHARGING_STATION;
obtain.obj = showStation; obtain.obj = showStation;
EventBus.getDefault().post(obtain); 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); startActivityForResult(intentScutcheon, 105);
break; break;
case R.id.linear_charging_pile: case R.id.linear_charging_pile:
initPile(); initChargingPile();
break; 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 List<Integer> upload;
private Point screenPilePositions; private Point screenPilePositions;
private List<Removable> pileLocality; 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) { public static TreasureFragment newInstance(Bundle bundle) {
TreasureFragment fragment = new TreasureFragment(); TreasureFragment fragment = new TreasureFragment();
@ -493,14 +497,13 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
List<LatLng> latLineString = GeometryTools.getLatLngs(geo); List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
// 构造 PolylineOpitons // 构造 PolylineOpitons
PolylineOptions polylineOptions = new PolylineOptions() PolylineOptions polylineOptions = new PolylineOptions()
.addAll(latLineString) .addAll(latLineString)
// 折线设置圆形线头 // 折线设置圆形线头
.lineCap(true) .lineCap(true)
// 折线的颜色为绿色 // 折线的颜色为绿色
.color(0xff00ff00) .color(0xff00ff00)
// 折线宽度为5像素 // 折线宽度为5像素
.width(35) .width(10)
.arrow(true) .arrow(true)
.arrowSpacing(100) .arrowSpacing(100)
.arrowTexture(bitmapLine); .arrowTexture(bitmapLine);
@ -510,7 +513,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
//.borderWidth(1); //.borderWidth(1);
// 绘制折线 // 绘制折线
Polyline polyline = tencentMap.addPolyline(polylineOptions); Polyline polyline = tencentMap.addPolyline(polylineOptions);
polyline.setZIndex(3); polyline.setZIndex(MARKER_LINE);
removables.add(polyline); removables.add(polyline);
if (latLineString != null && latLineString.size() > 0) { if (latLineString != null && latLineString.size() > 0) {
latLng = latLineString.get(0); latLng = latLineString.get(0);
@ -526,7 +529,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
strokeColor(0xff000000). strokeColor(0xff000000).
//边线宽度15像素 //边线宽度15像素
strokeWidth(5)); strokeWidth(5));
polygon.setZIndex(1); 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();
double x = centroid.getX(); 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) Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.9f)
.flat(true) .flat(true)
.clockwise(false)); .clockwise(false));
poiMarker.setZIndex(2); poiMarker.setZIndex(MARKER_DOT);
poiMarker.setTag(listBean); poiMarker.setTag(listBean);
removables.add(poiMarker); removables.add(poiMarker);
poiMarker.setClickable(true); 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) Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor).alpha(0.9f)
.flat(true) .flat(true)
.clockwise(false)); .clockwise(false));
stationMarker.setZIndex(MARKER_DOT);
stationMarker.setTag(listBean); stationMarker.setTag(listBean);
removables.add(stationMarker); removables.add(stationMarker);
stationMarker.setClickable(true); stationMarker.setClickable(true);
stationMarker.setZIndex(2);
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);
@ -568,40 +572,40 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.flat(true) .flat(true)
.clockwise(false)); .clockwise(false));
poiVideoMarker.setTag(listBean); poiVideoMarker.setTag(listBean);
poiVideoMarker.setZIndex(MARKER_DOT);
removables.add(poiVideoMarker); removables.add(poiVideoMarker);
poiVideoMarker.setClickable(true); poiVideoMarker.setClickable(true);
poiVideoMarker.setZIndex(2);
break; break;
case 4://道路录像 case 4://道路录像
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bg); BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bg);
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).alpha(0.9f) Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).alpha(0.9f)
.flat(true) .flat(true)
.clockwise(false)); .clockwise(false));
roadMarker.setZIndex(MARKER_DOT);
roadMarker.setTag(listBean); roadMarker.setTag(listBean);
removables.add(roadMarker); removables.add(roadMarker);
roadMarker.setClickable(true); roadMarker.setClickable(true);
roadMarker.setZIndex(2);
break; break;
case 5://其他 case 5://其他
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg1); BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg1);
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).alpha(0.9f) Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).alpha(0.9f)
.flat(true) .flat(true)
.clockwise(false)); .clockwise(false));
otherMarker.setZIndex(MARKER_DOT);
otherMarker.setTag(listBean); otherMarker.setTag(listBean);
removables.add(otherMarker); removables.add(otherMarker);
otherMarker.setClickable(true); otherMarker.setClickable(true);
otherMarker.setZIndex(2);
break; break;
case 6://面状任务 case 6://面状任务
BitmapDescriptor Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_bg); BitmapDescriptor Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_bg);
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor).alpha(0.9f) Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor).alpha(0.9f)
.flat(true) .flat(true)
.clockwise(false)); .clockwise(false));
Log.d("面状任务", "onSuccess: " + planarMarker); planarMarker.setZIndex(MARKER_DOT);
planarMarker.setTag(listBean); planarMarker.setTag(listBean);
removables.add(planarMarker); removables.add(planarMarker);
planarMarker.setClickable(true); planarMarker.setClickable(true);
planarMarker.setZIndex(2);
break; break;
} }
} }
@ -660,7 +664,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.borderWidth(1);*/ .borderWidth(1);*/
// 绘制折线 // 绘制折线
Polyline polyline = tencentMap.addPolyline(polylineOptions); Polyline polyline = tencentMap.addPolyline(polylineOptions);
polyline.setZIndex(3); polyline.setZIndex(MARKER_LINE);
removablesMarker.add(polyline); removablesMarker.add(polyline);
if (latLineString != null && latLineString.size() > 0) { if (latLineString != null && latLineString.size() > 0) {
latLng = latLineString.get(0); latLng = latLineString.get(0);
@ -677,7 +681,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
//边线宽度15像素 //边线宽度15像素
strokeWidth(25)); strokeWidth(25));
polygon.setZIndex(1); polygon.setZIndex(MARKER_FACE);
removablesMarker.add(polygon); removablesMarker.add(polygon);
com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid(); com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid();
double x = centroid.getX(); double x = centroid.getX();
@ -714,8 +718,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
bigMarker.setIcon(descriptor); bigMarker.setIcon(descriptor);
} }
bigMarker.setVisible(true); bigMarker.setVisible(true);
bigMarker.setZIndex(MARKER_BIG);
bigMarker.setClickable(false); bigMarker.setClickable(false);
bigMarker.setZIndex(4);
frameLayout.setVisibility(View.VISIBLE); frameLayout.setVisibility(View.VISIBLE);
setMainButtonVisiable(View.GONE); setMainButtonVisiable(View.GONE);
fragmentTransaction = supportFragmentManager.beginTransaction(); fragmentTransaction = supportFragmentManager.beginTransaction();
@ -777,7 +782,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.borderWidth(1);*/ .borderWidth(1);*/
// 绘制折线 // 绘制折线
Polyline polyline = tencentMap.addPolyline(polylineOptions); Polyline polyline = tencentMap.addPolyline(polylineOptions);
polyline.setZIndex(3); polyline.setZIndex(MARKER_LINE);
removablesLocality.add(polyline); removablesLocality.add(polyline);
if (latLineString != null && latLineString.size() > 0) { if (latLineString != null && latLineString.size() > 0) {
latLng = latLineString.get(0); latLng = latLineString.get(0);
@ -793,7 +798,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
strokeColor(0xff00ff00). strokeColor(0xff00ff00).
//边线宽度15像素 //边线宽度15像素
strokeWidth(5)); strokeWidth(5));
polygon.setZIndex(1); polygon.setZIndex(MARKER_FACE);
removablesLocality.add(polygon); removablesLocality.add(polygon);
com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid(); com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid();
double x = centroid.getX(); double x = centroid.getX();
@ -824,7 +829,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.flat(true) .flat(true)
.clockwise(false)); .clockwise(false));
poiMarker.setClickable(true); poiMarker.setClickable(true);
poiMarker.setZIndex(2); poiMarker.setZIndex(MARKER_DOT);
poiMarker.setTitle(poiEntity.getName() + ""); poiMarker.setTitle(poiEntity.getName() + "");
poiMarker.setTag(poiEntity); poiMarker.setTag(poiEntity);
removablesLocality.add(poiMarker); removablesLocality.add(poiMarker);
@ -840,7 +845,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.flat(true) .flat(true)
.clockwise(false)); .clockwise(false));
stationMarker.setClickable(true); stationMarker.setClickable(true);
stationMarker.setZIndex(2); stationMarker.setZIndex(MARKER_DOT);
stationMarker.setTitle(poiEntity.getName() + ""); stationMarker.setTitle(poiEntity.getName() + "");
stationMarker.setTag(poiEntity); stationMarker.setTag(poiEntity);
removablesLocality.add(stationMarker); removablesLocality.add(stationMarker);
@ -856,7 +861,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.flat(true) .flat(true)
.clockwise(false)); .clockwise(false));
poiVideoMarker.setClickable(true); poiVideoMarker.setClickable(true);
poiVideoMarker.setZIndex(2); poiVideoMarker.setZIndex(MARKER_DOT);
poiVideoMarker.setTitle(poiEntity.getName() + ""); poiVideoMarker.setTitle(poiEntity.getName() + "");
poiVideoMarker.setTag(poiEntity); poiVideoMarker.setTag(poiEntity);
removablesLocality.add(poiVideoMarker); removablesLocality.add(poiVideoMarker);
@ -872,7 +877,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.flat(true) .flat(true)
.clockwise(false)); .clockwise(false));
roadMarker.setClickable(true); roadMarker.setClickable(true);
roadMarker.setZIndex(2); roadMarker.setZIndex(MARKER_DOT);
roadMarker.setTitle(poiEntity.getName() + ""); roadMarker.setTitle(poiEntity.getName() + "");
roadMarker.setTag(poiEntity); roadMarker.setTag(poiEntity);
removablesLocality.add(roadMarker); removablesLocality.add(roadMarker);
@ -888,7 +893,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.flat(true) .flat(true)
.clockwise(false)); .clockwise(false));
otherMarker.setClickable(true); otherMarker.setClickable(true);
otherMarker.setZIndex(2); otherMarker.setZIndex(MARKER_DOT);
otherMarker.setTitle(poiEntity.getName() + ""); otherMarker.setTitle(poiEntity.getName() + "");
otherMarker.setTag(poiEntity); otherMarker.setTag(poiEntity);
removablesLocality.add(otherMarker); removablesLocality.add(otherMarker);
@ -904,7 +909,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.clockwise(false) .clockwise(false)
.flat(true)); .flat(true));
planarMarker.setClickable(true); planarMarker.setClickable(true);
planarMarker.setZIndex(2); planarMarker.setZIndex(MARKER_DOT);
planarMarker.setTitle(poiEntity.getName() + ""); planarMarker.setTitle(poiEntity.getName() + "");
planarMarker.setTag(poiEntity); planarMarker.setTag(poiEntity);
removablesLocality.add(planarMarker); removablesLocality.add(planarMarker);
@ -1128,13 +1133,14 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
if ((boolean) data.obj) { if ((boolean) data.obj) {
initCheckedMarker(Constant.CHARGING_STATION_WORD); 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); initPileMarker((LatLng) data.obj);
} else if (data.what == Constant.MAIN_CHARGING_CHECKED_PILE) {//充电桩采集-确定位置 } else if (data.what == Constant.MAIN_CHARGING_CHECKED_PILE) {//充电桩采集-确定位置
if ((boolean) data.obj) { if ((boolean) data.obj) {
initCheckedPileMarker(Constant.CHARGING_PILE_WORD); initCheckedPileMarker(Constant.CHARGING_PILE_WORD);
} }
} else if (data.what == Constant.MAIN_OTHER) {//其他采集-移动位置 }*/
else if (data.what == Constant.MAIN_OTHER) {//其他采集-移动位置
initPoiMarker((LatLng) data.obj); initPoiMarker((LatLng) data.obj);
} else if (data.what == Constant.MAIN_CHECKED_OTHER) {//其他采集-确定位置 } else if (data.what == Constant.MAIN_CHECKED_OTHER) {//其他采集-确定位置
if ((boolean) data.obj) { if ((boolean) data.obj) {
@ -1188,6 +1194,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putBoolean("isSliding", false); // 通知抽屉不收回 bundle.putBoolean("isSliding", false); // 通知抽屉不收回
bundle.putString("station", (String) data.obj); bundle.putString("station", (String) data.obj);
if (chargingPileEntity != null) { if (chargingPileEntity != null) {
bundle.putSerializable("chargingPileEntity", chargingPileEntity); 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) { private void initCheckedMarker(int poiWord) {
if (screenPosition != null) { if (screenPosition != null) {
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
@ -1495,6 +1460,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} }
break; break;
case R.id.iv_submit://弹窗 case R.id.iv_submit://弹窗
if (upload == null) {
Toast.makeText(getActivity(), "网络请求失败", Toast.LENGTH_SHORT).show();
return;
}
//分享 //分享
CharSequence title = "请选择上报类型"; CharSequence title = "请选择上报类型";
@ -1588,15 +1557,15 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
private void showPoiMarkerByType(int type, LatLng latLng) { private void showPoiMarkerByType(int type, LatLng latLng) {
if (type == 1) { 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) { } 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) { } 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) { } 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) { } 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));
} }
} }