com.amap.api.services.core.LatLonPoint Java Examples
The following examples show how to use
com.amap.api.services.core.LatLonPoint.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BusLineOverlay.java From BmapLite with Apache License 2.0 | 6 votes |
/** * 添加公交线路到地图中。 * * @since V2.1.0 */ public void addToMap() { try { List<LatLonPoint> pointList = mBusLineItem.getDirectionsCoordinates(); List<LatLng> listPolyline = AMapServicesUtil.convertArrList(pointList); mBusLinePolyline = mAMap.addPolyline(new PolylineOptions() .addAll(listPolyline).color(getBusColor()) .width(getBuslineWidth())); if (mBusStations.size() < 1) { return; } for (int i = 1; i < mBusStations.size() - 1; i++) { Marker marker = mAMap.addMarker(getMarkerOptions(i)); mBusStationMarks.add(marker); } Marker markerStart = mAMap.addMarker(getMarkerOptions(0)); mBusStationMarks.add(markerStart); Marker markerEnd = mAMap .addMarker(getMarkerOptions(mBusStations.size() - 1)); mBusStationMarks.add(markerEnd); } catch (Throwable e) { e.printStackTrace(); } }
Example #2
Source File: TruckRouteColorfulOverLay.java From TraceByAmap with MIT License | 6 votes |
private void addThroughPointMarker() { if (this.throughPointList != null && this.throughPointList.size() > 0) { LatLonPoint latLonPoint = null; for (int i = 0; i < this.throughPointList.size(); i++) { latLonPoint = this.throughPointList.get(i); if (latLonPoint != null) { throughPointMarkerList.add(mAMap .addMarker((new MarkerOptions()) .position( new LatLng(latLonPoint .getLatitude(), latLonPoint .getLongitude())) .visible(throughPointMarkerVisible) .icon(getThroughPointBitDes()) .title("\u9014\u7ECF\u70B9"))); } } } }
Example #3
Source File: RouteDistanceActivity.java From TraceByAmap with MIT License | 6 votes |
/** * 开始搜索路径规划方案 */ public void searchDistanceResult(int mode) { showProgressDialog(); DistanceSearch.DistanceQuery distanceQuery = new DistanceSearch.DistanceQuery(); List<LatLonPoint> latLonPoints = new ArrayList<LatLonPoint>(); latLonPoints.add(start0); latLonPoints.add(start1); latLonPoints.add(start2); latLonPoints.add(start3); distanceQuery.setOrigins(latLonPoints); distanceQuery.setDestination(dest); distanceQuery.setType(mode); distanceSearch.calculateRouteDistanceAsyn(distanceQuery); }
Example #4
Source File: ReGeocoderActivity.java From TraceByAmap with MIT License | 6 votes |
/** * 响应逆地理编码的批量请求 */ private void getAddresses() { List<LatLonPoint> geopointlist = readLatLonPoints(); for (final LatLonPoint point : geopointlist) { ThreadUtil.getInstance().execute(new Runnable() { @Override public void run() { try { RegeocodeQuery query = new RegeocodeQuery(point, 200, GeocodeSearch.AMAP);// 第一个参数表示一个Latlng,第二参数表示范围多少米,第三个参数表示是火系坐标系还是GPS原生坐标系 RegeocodeAddress result = geocoderSearch.getFromLocation(query);// 设置同步逆地理编码请求 if (result != null && result.getFormatAddress() != null) { aMap.addMarker(new MarkerOptions() .position(new LatLng(point.getLatitude(), point.getLongitude())) .title(result.getFormatAddress())); } } catch (AMapException e) { Message msg = msgHandler.obtainMessage(); msg.arg1 = e.getErrorCode(); msgHandler.sendMessage(msg); } } }); } }
Example #5
Source File: LocationActivity.java From xmpp with Apache License 2.0 | 6 votes |
/** * 定位成功后回调函数 */ @Override public void onLocationChanged(AMapLocation aLocation) { if (mListener != null && aLocation != null && aLocation.getAMapException().getErrorCode() == 0) { mListener.onLocationChanged(aLocation);// 显示系统小蓝点 marker.setPosition(new LatLng(aLocation.getLatitude(), aLocation .getLongitude()));// 定位雷达小图标 float bearing = aMap.getCameraPosition().bearing; aMap.setMyLocationRotateAngle(bearing);// 设置小蓝点旋转角度 aMap.getMinZoomLevel(); double a = aLocation.getLatitude();// 维度 double b = aLocation.getLongitude();// 精度 lp = new LatLonPoint(a, b); doSearchQuery(); } }
Example #6
Source File: DrivingRouteOverlay.java From BmapLite with GNU General Public License v3.0 | 6 votes |
private void addThroughPointMarker() { if (this.throughPointList != null && this.throughPointList.size() > 0) { LatLonPoint latLonPoint = null; for (int i = 0; i < this.throughPointList.size(); i++) { latLonPoint = this.throughPointList.get(i); if (latLonPoint != null) { throughPointMarkerList.add(mAMap .addMarker((new MarkerOptions()) .position( new LatLng(latLonPoint .getLatitude(), latLonPoint .getLongitude())) .visible(throughPointMarkerVisible) .icon(getThroughPointBitDes()) .title("\u9014\u7ECF\u70B9"))); } } } }
Example #7
Source File: DistrictActivity.java From TraceByAmap with MIT License | 6 votes |
/** * 获取行政区划的信息字符串 * @param districtItem * @return */ private String getDistrictInfoStr(DistrictItem districtItem){ StringBuffer sb = new StringBuffer(); String name = districtItem.getName(); String adcode = districtItem.getAdcode(); String level = districtItem.getLevel(); String citycode = districtItem.getCitycode(); LatLonPoint center = districtItem.getCenter(); sb.append("区划名称:" + name + "\n"); sb.append("区域编码:" + adcode + "\n"); sb.append("城市编码:" + citycode + "\n"); sb.append("区划级别:" + level + "\n"); if (null != center) { sb.append("经纬度:(" + center.getLongitude() + ", " + center.getLatitude() + ")\n"); } return sb.toString(); }
Example #8
Source File: LocationActivity.java From xmpp with Apache License 2.0 | 5 votes |
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { LatLonPoint ll = list.get(position).getLatLonPoint(); double a = ll.getLatitude(); double b = ll.getLongitude(); aMap.moveCamera(CameraUpdateFactory.changeLatLng(new LatLng(a, b))); }
Example #9
Source File: BusRouteOverlay.java From BmapLite with Apache License 2.0 | 5 votes |
/** * @param busStep * @return */ private LatLonPoint getLastWalkPoint(BusStep busStep) { List<WalkStep> walkSteps = busStep.getWalk().getSteps(); WalkStep walkStep = walkSteps.get(walkSteps.size() - 1); List<LatLonPoint> lonPoints = walkStep.getPolyline(); return lonPoints.get(lonPoints.size() - 1); }
Example #10
Source File: AMapServicesUtil.java From BmapLite with GNU General Public License v3.0 | 5 votes |
public static ArrayList<LatLng> convertArrList(List<LatLonPoint> shapes) { ArrayList<LatLng> lineShapes = new ArrayList<LatLng>(); for (LatLonPoint point : shapes) { LatLng latLngTemp = AMapServicesUtil.convertToLatLng(point); lineShapes.add(latLngTemp); } return lineShapes; }
Example #11
Source File: BusRouteOverlay.java From BmapLite with GNU General Public License v3.0 | 5 votes |
private void addBusLineSteps(List<LatLonPoint> listPoints) { if (listPoints.size() < 1) { return; } addPolyLine(new PolylineOptions().width(getRouteWidth()) .color(getBusColor()) .addAll(AMapUtil.convertArrList(listPoints))); }
Example #12
Source File: BusRouteOverlay.java From BmapLite with GNU General Public License v3.0 | 5 votes |
private void checkRailwayToNextWalk(BusStep busStep, BusStep busStep1) { LatLonPoint railwayLastPoint = busStep.getRailway().getArrivalstop().getLocation(); LatLonPoint walkFirstPoint = getFirstWalkPoint(busStep1); if (!railwayLastPoint.equals(walkFirstPoint)) { addWalkPolyLineByLatLonPoints(railwayLastPoint, walkFirstPoint); } }
Example #13
Source File: BusRouteOverlay.java From BmapLite with GNU General Public License v3.0 | 5 votes |
/** * * checkBusToNextBusNoWalk 和这个类似 * * @param busStep * @param busStep1 */ private void checkBusEndToNextBusStart(BusStep busStep, BusStep busStep1) { LatLonPoint busLastPoint = getLastBuslinePoint(busStep); LatLng endbusLatLng = AMapUtil.convertToLatLng(busLastPoint); LatLonPoint busFirstPoint = getFirstBuslinePoint(busStep1); LatLng startbusLatLng = AMapUtil.convertToLatLng(busFirstPoint); if (!endbusLatLng.equals(startbusLatLng)) { drawLineArrow(endbusLatLng, startbusLatLng);// } }
Example #14
Source File: PlaceLocationSelectActivity.java From Fishing with GNU General Public License v3.0 | 5 votes |
@Override public void onMapClick(LatLng latLng) { if (mLastMarker != null) mLastMarker.destroy(); mPoint = latLng; MarkerOptions markerOption = new MarkerOptions(); markerOption.position(latLng); markerOption.icon(BitmapDescriptorFactory .fromResource(R.drawable.location_point_bigger_red)); mLastMarker = aMap.addMarker(markerOption); mGeocoderSearch.getFromLocationAsyn(new RegeocodeQuery(new LatLonPoint(latLng.latitude,latLng.longitude), 50,GeocodeSearch.AMAP)); }
Example #15
Source File: AmapRouteFragment.java From BmapLite with GNU General Public License v3.0 | 5 votes |
private void setDrivingOverlay(DrivePath drivePath, LatLonPoint start, LatLonPoint target) { mAmap.clear();// 清理地图上的所有覆盖物 DrivingRouteOverlay overlay = new DrivingRouteOverlay(getActivity(), mAmap, drivePath, start, target, null); overlay.setNodeIconVisibility(false);//设置节点marker是否显示 overlay.setIsColorfulline(true);//是否用颜色展示交通拥堵情况,默认true overlay.removeFromMap(); overlay.addToMap(); overlay.zoomToSpan(); }
Example #16
Source File: BusRouteOverlay.java From BmapLite with GNU General Public License v3.0 | 5 votes |
/** * 检查 步行最后一点 和 bus的起点 是否一致 * * @param busStep */ private void checkWalkToBusline(BusStep busStep) { LatLonPoint walkLastPoint = getLastWalkPoint(busStep); LatLonPoint buslineFirstPoint = getFirstBuslinePoint(busStep); if (!walkLastPoint.equals(buslineFirstPoint)) { addWalkPolyLineByLatLonPoints(walkLastPoint, buslineFirstPoint); } }
Example #17
Source File: AutoScheduleAssistFragment.java From BetterWay with Apache License 2.0 | 5 votes |
/** * 取得获得的坐标并移动地图到该坐标 * @param latLonPoint 获得的坐标 */ @Subscribe(threadMode = ThreadMode.MAIN, sticky = true) public void onLatLngPointEvent(LatLonPoint latLonPoint) { LogUtil.e(TAG, "moveToLatLngPoint()"); mLatLng = new LatLng(latLonPoint.getLatitude(), latLonPoint.getLongitude()); aMap.moveCamera(CameraUpdateFactory.changeLatLng(mLatLng)); }
Example #18
Source File: AMapUtil.java From BmapLite with Apache License 2.0 | 5 votes |
/** * 把集合体的LatLonPoint转化为集合体的LatLng */ public static ArrayList<LatLng> convertArrList(List<LatLonPoint> shapes) { ArrayList<LatLng> lineShapes = new ArrayList<LatLng>(); for (LatLonPoint point : shapes) { LatLng latLngTemp = AMapUtil.convertToLatLng(point); lineShapes.add(latLngTemp); } return lineShapes; }
Example #19
Source File: BusRouteOverlay.java From BmapLite with Apache License 2.0 | 5 votes |
private void checkRailwayToNextWalk(BusStep busStep, BusStep busStep1) { LatLonPoint railwayLastPoint = busStep.getRailway().getArrivalstop().getLocation(); LatLonPoint walkFirstPoint = getFirstWalkPoint(busStep1); if (!railwayLastPoint.equals(walkFirstPoint)) { addWalkPolyLineByLatLonPoints(railwayLastPoint, walkFirstPoint); } }
Example #20
Source File: BusRouteOverlay.java From BmapLite with Apache License 2.0 | 5 votes |
private void checkBusLineToNextRailway(BusStep busStep, BusStep busStep1) { LatLonPoint busLastPoint = getLastBuslinePoint(busStep); LatLonPoint railwayFirstPoint = busStep1.getRailway().getDeparturestop().getLocation(); if (!busLastPoint.equals(railwayFirstPoint)) { addWalkPolyLineByLatLonPoints(busLastPoint, railwayFirstPoint); } }
Example #21
Source File: AutoScheduleAssistFragment.java From BetterWay with Apache License 2.0 | 5 votes |
@Override public void onMyLocationChange(Location location) { LogUtil.e(TAG, "onMyLocationChange"); GeocodeSearch geocoderSearch = new GeocodeSearch(getContext()); geocoderSearch.setOnGeocodeSearchListener(this); LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude()); aMap.moveCamera(CameraUpdateFactory.changeLatLng(latLng)); LatLonPoint latLonPoint = new LatLonPoint(location.getLatitude(), location.getLongitude()); RegeocodeQuery query = new RegeocodeQuery(latLonPoint, 10000, GeocodeSearch.AMAP); geocoderSearch.getFromLocationAsyn(query); }
Example #22
Source File: BusRouteOverlay.java From TraceByAmap with MIT License | 5 votes |
private LatLonPoint getExitPoint(BusStep busStep) { Doorway doorway = busStep.getExit(); if (doorway == null) { return null; } return doorway.getLatLonPoint(); }
Example #23
Source File: BusRouteOverlay.java From TraceByAmap with MIT License | 5 votes |
/** * @param busStep * @return */ private LatLonPoint getLastWalkPoint(BusStep busStep) { List<WalkStep> walkSteps = busStep.getWalk().getSteps(); WalkStep walkStep = walkSteps.get(walkSteps.size() - 1); List<LatLonPoint> lonPoints = walkStep.getPolyline(); return lonPoints.get(lonPoints.size() - 1); }
Example #24
Source File: BusRouteOverlay.java From TraceByAmap with MIT License | 5 votes |
/** * */ private void addWalkPolyLineByLatLonPoints(LatLonPoint pointFrom, LatLonPoint pointTo) { LatLng latLngFrom = AMapUtil.convertToLatLng(pointFrom); LatLng latLngTo = AMapUtil.convertToLatLng(pointTo); addWalkPolyline(latLngFrom, latLngTo); }
Example #25
Source File: WritePresenter.java From Fishing with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(WriteActivity view, Bundle savedState) { super.onCreate(view, savedState); provider = new ImageProvider(getView()); mGeocoderSearch = new GeocodeSearch(getView()); mGeocoderSearch.setOnGeocodeSearchListener(this); location = LocationModel.getInstance().getCurLocation(); if (location != null) { mGeocoderSearch.getFromLocationAsyn(new RegeocodeQuery(new LatLonPoint(location.getLatitude(), location.getLongitude()), 50, GeocodeSearch.AMAP)); } }
Example #26
Source File: AMapUtil.java From BmapLite with GNU General Public License v3.0 | 5 votes |
/** * 把集合体的LatLonPoint转化为集合体的LatLng */ public static ArrayList<LatLng> convertArrList(List<LatLonPoint> shapes) { ArrayList<LatLng> lineShapes = new ArrayList<LatLng>(); for (LatLonPoint point : shapes) { LatLng latLngTemp = AMapUtil.convertToLatLng(point); lineShapes.add(latLngTemp); } return lineShapes; }
Example #27
Source File: BusRouteOverlay.java From TraceByAmap with MIT License | 5 votes |
/** * * checkBusToNextBusNoWalk 和这个类似 * * @param busStep * @param busStep1 */ private void checkBusEndToNextBusStart(BusStep busStep, BusStep busStep1) { LatLonPoint busLastPoint = getLastBuslinePoint(busStep); LatLng endbusLatLng = AMapUtil.convertToLatLng(busLastPoint); LatLonPoint busFirstPoint = getFirstBuslinePoint(busStep1); LatLng startbusLatLng = AMapUtil.convertToLatLng(busFirstPoint); if (!endbusLatLng.equals(startbusLatLng)) { drawLineArrow(endbusLatLng, startbusLatLng);// } }
Example #28
Source File: BusRouteOverlay.java From TraceByAmap with MIT License | 5 votes |
private void addBusLineSteps(List<LatLonPoint> listPoints) { if (listPoints.size() < 1) { return; } addPolyLine(new PolylineOptions().width(getRouteWidth()) .color(getBusColor()) .addAll(AMapUtil.convertArrList(listPoints))); }
Example #29
Source File: BusRouteOverlay.java From BmapLite with GNU General Public License v3.0 | 5 votes |
private LatLonPoint getEntrancePoint(BusStep busStep) { Doorway doorway = busStep.getEntrance(); if (doorway == null) { return null; } return doorway.getLatLonPoint(); }
Example #30
Source File: BusLineOverlay.java From TraceByAmap with MIT License | 5 votes |
/** * 移动镜头到当前的视角。 * * @since V2.1.0 */ public void zoomToSpan() { if (mAMap == null) return; try { List<LatLonPoint> coordin = mBusLineItem.getDirectionsCoordinates(); if (coordin != null && coordin.size() > 0) { LatLngBounds bounds = getLatLngBounds(coordin); mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 5)); } } catch (Throwable e) { e.printStackTrace(); } }