com.amap.api.maps.model.MarkerOptions Java Examples
The following examples show how to use
com.amap.api.maps.model.MarkerOptions.
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: GeoFence_Polygon_Activity.java From Android_Location_Demo with Apache License 2.0 | 6 votes |
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_geofence_new); setTitle(R.string.polygonGeoFence); // 初始化地理围栏 fenceClient = new GeoFenceClient(getApplicationContext()); btAddFence = (Button) findViewById(R.id.bt_addFence); tvGuide = (TextView) findViewById(R.id.tv_guide); tvResult = (TextView) findViewById(R.id.tv_result); tvResult.setVisibility(View.GONE); etCustomId = (EditText) findViewById(R.id.et_customId); cbAlertIn = (CheckBox) findViewById(R.id.cb_alertIn); cbAlertOut = (CheckBox) findViewById(R.id.cb_alertOut); cbAldertStated = (CheckBox) findViewById(R.id.cb_alertStated); mMapView = (MapView) findViewById(R.id.map); mMapView.onCreate(savedInstanceState); bitmap = BitmapDescriptorFactory .defaultMarker(BitmapDescriptorFactory.HUE_YELLOW); markerOption = new MarkerOptions().icon(bitmap).draggable(true); init(); }
Example #2
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 #3
Source File: AmapFragment.java From BmapLite with GNU General Public License v3.0 | 6 votes |
private void makeMarker(MyPoiModel poi, boolean isClear) { if (isClear) { clearMarker(); } int distance = 0; if (null != BApp.MY_LOCATION) { distance = (int) AMapUtils.calculateLineDistance(new LatLng(BApp.MY_LOCATION.getLatitude(), BApp.MY_LOCATION.getLongitude()), new LatLng(poi.getLatitude(), poi.getLongitude())); } Marker marker = mAmap.addMarker(new MarkerOptions().position(new LatLng(poi.getLatitude(), poi.getLongitude())).title(poi.getName()).snippet(distance + "").icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_gcoding_2))); markerList.add(marker); ((MainActivity) getActivity()).showPoiLay(poi, distance); }
Example #4
Source File: GaoDeMapAiLineManager.java From FimiX8-RE with MIT License | 6 votes |
public void setAiLineMarkByHistory(List<X8AiLinePointLatlngInfo> points, int mapTpye) { for (X8AiLinePointLatlngInfo point : points) { int res; MapPointLatLng mp = new MapPointLatLng(); if (point.getYawMode() == 0) { res = R.drawable.x8_ai_line_point_no_angle1; } else { res = R.drawable.x8_ai_line_point_with_angle1; } BitmapDescriptor mBitmapDescriptor = new GaoDeMapCustomMarkerView().createCustomMarkerView2(this.context, res, this.mMarkerList.size() + 1); mp.altitude = (float) point.getAltitude(); mp.nPos = this.mMarkerList.size() + 1; LatLng latLng = new LatLng(point.getLatitude(), point.getLongitude()); Marker mMarker = this.aMap.addMarker(new MarkerOptions().position(latLng).icon(mBitmapDescriptor).anchor(0.5f, 0.5f).draggable(false)); mp.longitude = latLng.longitude; mp.latitude = latLng.latitude; mMarker.setObject(mp); this.mMarkerList.add(mMarker); mp.distance = 0.0f; this.mMapPointList.add(mp); setRotateAngle(mMarker, point.getYaw() / 100.0f); } if (points.size() > 0) { drawPointLine(this.mGaodeMapLocationManager.getHomeLocation()); } }
Example #5
Source File: AmapFragment.java From BmapLite with GNU General Public License v3.0 | 6 votes |
public void getFavoriteList() { if (null != mFavMarkerList && !mFavMarkerList.isEmpty()) { for (Marker o : mFavMarkerList) { o.remove(); } mFavMarkerList.clear(); } if (null != mFavoriteInteracter) { List<MyPoiModel> favoriteList = mFavoriteInteracter.getFavoriteList(); if (null != favoriteList && !favoriteList.isEmpty()) { for (MyPoiModel poi : favoriteList) { BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.ic_grade_point_2); Marker marker = mAmap.addMarker(new MarkerOptions().position(new LatLng(poi.getLatitude(), poi.getLongitude())).title(poi.getName()).snippet("").anchor(0.5f, 0.5f).icon(bitmapDescriptor)); mFavMarkerList.add(marker); } } } }
Example #6
Source File: DrivingRouteOverlay.java From BmapLite with Apache License 2.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: BusRouteOverlay.java From BmapLite with GNU General Public License v3.0 | 6 votes |
private void addRailwayMarkers(RouteRailwayItem railway) { LatLng Departureposition = AMapUtil.convertToLatLng(railway .getDeparturestop().getLocation()); String Departuretitle = railway.getDeparturestop().getName()+"上车"; String Departuresnippet = railway.getName(); addStationMarker(new MarkerOptions().position(Departureposition).title(Departuretitle) .snippet(Departuresnippet).anchor(0.5f, 0.5f).visible(nodeIconVisible) .icon(getBusBitmapDescriptor())); LatLng Arrivalposition = AMapUtil.convertToLatLng(railway .getArrivalstop().getLocation()); String Arrivaltitle = railway.getArrivalstop().getName()+"下车"; String Arrivalsnippet = railway.getName(); addStationMarker(new MarkerOptions().position(Arrivalposition).title(Arrivaltitle) .snippet(Arrivalsnippet).anchor(0.5f, 0.5f).visible(nodeIconVisible) .icon(getBusBitmapDescriptor())); }
Example #8
Source File: DrivingRouteOverlay.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 #9
Source File: BusLineOverlay.java From TraceByAmap with MIT License | 6 votes |
private MarkerOptions getMarkerOptions(int index) { MarkerOptions options = new MarkerOptions() .position( new LatLng(mBusStations.get(index).getLatLonPoint() .getLatitude(), mBusStations.get(index) .getLatLonPoint().getLongitude())) .title(getTitle(index)).snippet(getSnippet(index)); if (index == 0) { options.icon(getStartBitmapDescriptor()); } else if (index == mBusStations.size() - 1) { options.icon(getEndBitmapDescriptor()); } else { options.anchor(0.5f, 0.5f); options.icon(getBusBitmapDescriptor()); } return options; }
Example #10
Source File: MainActivity.java From Android_UsingCar_Example with Apache License 2.0 | 6 votes |
@Override public void onMapLoaded() { MarkerOptions markerOptions = new MarkerOptions(); markerOptions.setFlat(true); markerOptions.anchor(0.5f, 0.5f); markerOptions.position(new LatLng(0, 0)); markerOptions .icon(BitmapDescriptorFactory.fromBitmap(BitmapFactory .decodeResource(getResources(), R.drawable.icon_loaction_start))); mPositionMark = mAmap.addMarker(markerOptions); mPositionMark.setPositionByPixels(mMapView.getWidth() / 2, mMapView.getHeight() / 2); mLocationTask.startSingleLocate(); }
Example #11
Source File: BusLineOverlay.java From BmapLite with Apache License 2.0 | 6 votes |
private MarkerOptions getMarkerOptions(int index) { MarkerOptions options = new MarkerOptions() .position( new LatLng(mBusStations.get(index).getLatLonPoint() .getLatitude(), mBusStations.get(index) .getLatLonPoint().getLongitude())) .title(getTitle(index)).snippet(getSnippet(index)); if (index == 0) { options.icon(getStartBitmapDescriptor()); } else if (index == mBusStations.size() - 1) { options.icon(getEndBitmapDescriptor()); } else { options.anchor(0.5f, 0.5f); options.icon(getBusBitmapDescriptor()); } return options; }
Example #12
Source File: GeoFence_Polygon_Activity.java From Android_Location_Demo with Apache License 2.0 | 6 votes |
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_geofence_new); setTitle(R.string.polygonGeoFence); // 初始化地理围栏 fenceClient = new GeoFenceClient(getApplicationContext()); btAddFence = (Button) findViewById(R.id.bt_addFence); tvGuide = (TextView) findViewById(R.id.tv_guide); tvResult = (TextView) findViewById(R.id.tv_result); tvResult.setVisibility(View.GONE); etCustomId = (EditText) findViewById(R.id.et_customId); cbAlertIn = (CheckBox) findViewById(R.id.cb_alertIn); cbAlertOut = (CheckBox) findViewById(R.id.cb_alertOut); cbAldertStated = (CheckBox) findViewById(R.id.cb_alertStated); mMapView = (MapView) findViewById(R.id.map); mMapView.onCreate(savedInstanceState); bitmap = BitmapDescriptorFactory .defaultMarker(BitmapDescriptorFactory.HUE_YELLOW); markerOption = new MarkerOptions().icon(bitmap).draggable(true); init(); }
Example #13
Source File: BusRouteOverlay.java From BmapLite with Apache License 2.0 | 6 votes |
private void addRailwayMarkers(RouteRailwayItem railway) { LatLng Departureposition = AMapUtil.convertToLatLng(railway .getDeparturestop().getLocation()); String Departuretitle = railway.getDeparturestop().getName()+"上车"; String Departuresnippet = railway.getName(); addStationMarker(new MarkerOptions().position(Departureposition).title(Departuretitle) .snippet(Departuresnippet).anchor(0.5f, 0.5f).visible(nodeIconVisible) .icon(getBusBitmapDescriptor())); LatLng Arrivalposition = AMapUtil.convertToLatLng(railway .getArrivalstop().getLocation()); String Arrivaltitle = railway.getArrivalstop().getName()+"下车"; String Arrivalsnippet = railway.getName(); addStationMarker(new MarkerOptions().position(Arrivalposition).title(Arrivaltitle) .snippet(Arrivalsnippet).anchor(0.5f, 0.5f).visible(nodeIconVisible) .icon(getBusBitmapDescriptor())); }
Example #14
Source File: GeoFence_Round_Activity.java From Android_Location_Demo with Apache License 2.0 | 6 votes |
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_geofence_new); setTitle(R.string.roundGeoFence); // 初始化地理围栏 fenceClient = new GeoFenceClient(getApplicationContext()); lyOption = findViewById(R.id.ly_option); btAddFence = (Button) findViewById(R.id.bt_addFence); btOption = (Button) findViewById(R.id.bt_option); tvGuide = (TextView) findViewById(R.id.tv_guide); tvResult = (TextView) findViewById(R.id.tv_result); tvResult.setVisibility(View.GONE); etCustomId = (EditText) findViewById(R.id.et_customId); etRadius = (EditText) findViewById(R.id.et_radius); cbAlertIn = (CheckBox) findViewById(R.id.cb_alertIn); cbAlertOut = (CheckBox) findViewById(R.id.cb_alertOut); cbAldertStated = (CheckBox) findViewById(R.id.cb_alertStated); mMapView = (MapView) findViewById(R.id.map); mMapView.onCreate(savedInstanceState); markerOption = new MarkerOptions().draggable(true); init(); }
Example #15
Source File: DrivingRouteOverlay.java From BmapLite with GNU General Public License v3.0 | 5 votes |
/** * @param driveStep * @param latLng */ private void addDrivingStationMarkers(DriveStep driveStep, LatLng latLng) { addStationMarker(new MarkerOptions() .position(latLng) .title("\u65B9\u5411:" + driveStep.getAction() + "\n\u9053\u8DEF:" + driveStep.getRoad()) .snippet(driveStep.getInstruction()).visible(nodeIconVisible) .anchor(0.5f, 0.5f).icon(getDriveBitmapDescriptor())); }
Example #16
Source File: PlaceMapFragment.java From Fishing with GNU General Public License v3.0 | 5 votes |
private void initMyPoint() { MarkerOptions markerOption = new MarkerOptions(); markerOption.icon(BitmapDescriptorFactory .fromResource(R.drawable.location_marker)); mMyLocation = aMap.addMarker(markerOption); LocationModel.getInstance().registerLocationChange(location -> { JUtils.Log("latitude"+location.latitude+" longitude"+location.longitude); mMyLocation.setPosition(new LatLng(location.latitude, location.longitude)); }); }
Example #17
Source File: PlaceMapFragment.java From Fishing with GNU General Public License v3.0 | 5 votes |
public void addMarker(PlaceBrief place) { MarkerOptions markerOption = new MarkerOptions(); markerOption.position(new LatLng(place.getLat(), place.getLng())); markerOption.title(place.getName()).snippet(place.getAddressBrief()); markerOption.icon(BitmapDescriptorFactory .fromResource(place.getCostType() == 0 ? R.drawable.location_point_green : R.drawable.location_point_red)); Marker marker = aMap.addMarker(markerOption); marker.setToTop(); mMarkerMap.put(marker, place); if (mMarkerMap.size() < MIN_ZOOM_MARKER_COUNT+1) zoomMarkerList.add(place); if (mMarkerMap.size()== MIN_ZOOM_MARKER_COUNT+1) moveToAdjustPlace(zoomMarkerList); }
Example #18
Source File: MapActivity.java From TikTok with Apache License 2.0 | 5 votes |
private void initMarks() { MarkerOptions markerOption = new MarkerOptions(); markerOption.position(latlng); markerOption.title("西安市").snippet("西安市:34.341568, 108.940174"); markerOption.draggable(true);//设置Marker可拖动 markerOption.icon(BitmapDescriptorFactory.fromBitmap(BitmapFactory .decodeResource(getResources(),R.mipmap.ic_launcher))); // 将Marker设置为贴地显示,可以双指下拉地图查看效果 markerOption.setFlat(true);//设置marker平贴地图效果 mAMap.addMarker(markerOption); }
Example #19
Source File: BusRouteOverlay.java From TraceByAmap with MIT License | 5 votes |
/** * @param routeBusLineItem */ private void addBusStationMarkers(RouteBusLineItem routeBusLineItem) { BusStationItem startBusStation = routeBusLineItem .getDepartureBusStation(); LatLng position = AMapUtil.convertToLatLng(startBusStation .getLatLonPoint()); String title = routeBusLineItem.getBusLineName(); String snippet = getBusSnippet(routeBusLineItem); addStationMarker(new MarkerOptions().position(position).title(title) .snippet(snippet).anchor(0.5f, 0.5f).visible(nodeIconVisible) .icon(getBusBitmapDescriptor())); }
Example #20
Source File: RouteOverlay.java From TraceByAmap with MIT License | 5 votes |
protected void addStationMarker(MarkerOptions options) { if(options == null) { return; } Marker marker = mAMap.addMarker(options); if(marker != null) { stationMarkers.add(marker); } }
Example #21
Source File: RouteOverlay.java From TraceByAmap with MIT License | 5 votes |
protected void addStartAndEndMarker() { startMarker = mAMap.addMarker((new MarkerOptions()) .position(startPoint).icon(getStartBitmapDescriptor()) .title("\u8D77\u70B9")); // startMarker.showInfoWindow(); endMarker = mAMap.addMarker((new MarkerOptions()).position(endPoint) .icon(getEndBitmapDescriptor()).title("\u7EC8\u70B9")); // mAMap.moveCamera(CameraUpdateFactory.newLatLngZoom(startPoint, // getShowRouteZoom())); }
Example #22
Source File: BusRouteActivity.java From TraceByAmap with MIT License | 5 votes |
private void setfromandtoMarker() { aMap.addMarker(new MarkerOptions() .position(AMapUtil.convertToLatLng(mStartPoint)) .icon(BitmapDescriptorFactory.fromResource(R.drawable.start))); aMap.addMarker(new MarkerOptions() .position(AMapUtil.convertToLatLng(mEndPoint)) .icon(BitmapDescriptorFactory.fromResource(R.drawable.end))); }
Example #23
Source File: DriveRouteActivity.java From TraceByAmap with MIT License | 5 votes |
private void setfromandtoMarker() { aMap.addMarker(new MarkerOptions() .position(AMapUtil.convertToLatLng(mStartPoint)) .icon(BitmapDescriptorFactory.fromResource(R.drawable.start))); aMap.addMarker(new MarkerOptions() .position(AMapUtil.convertToLatLng(mEndPoint)) .icon(BitmapDescriptorFactory.fromResource(R.drawable.end))); }
Example #24
Source File: BusRouteOverlay.java From BmapLite with Apache License 2.0 | 5 votes |
/** * @param latLng * marker * @param title * @param snippet */ private void addWalkStationMarkers(LatLng latLng, String title, String snippet) { addStationMarker(new MarkerOptions().position(latLng).title(title) .snippet(snippet).anchor(0.5f, 0.5f).visible(nodeIconVisible) .icon(getWalkBitmapDescriptor())); }
Example #25
Source File: RouteActivity.java From TraceByAmap with MIT License | 5 votes |
private void setfromandtoMarker() { aMap.addMarker(new MarkerOptions() .position(AMapUtil.convertToLatLng(mStartPoint)) .icon(BitmapDescriptorFactory.fromResource(R.drawable.start))); aMap.addMarker(new MarkerOptions() .position(AMapUtil.convertToLatLng(mEndPoint)) .icon(BitmapDescriptorFactory.fromResource(R.drawable.end))); }
Example #26
Source File: DriveRoutePlanActivity.java From TraceByAmap with MIT License | 5 votes |
private void setfromandtoMarker() { aMap.addMarker(new MarkerOptions() .position(AMapUtil.convertToLatLng(mStartPoint)) .icon(BitmapDescriptorFactory.fromResource(R.drawable.start))); aMap.addMarker(new MarkerOptions() .position(AMapUtil.convertToLatLng(mEndPoint)) .icon(BitmapDescriptorFactory.fromResource(R.drawable.end))); }
Example #27
Source File: RouteOverlay.java From BmapLite with Apache License 2.0 | 5 votes |
protected void addStartAndEndMarker() { startMarker = mAMap.addMarker((new MarkerOptions()) .position(startPoint).icon(getStartBitmapDescriptor()) .title("\u8D77\u70B9")); // startMarker.showInfoWindow(); endMarker = mAMap.addMarker((new MarkerOptions()).position(endPoint) .icon(getEndBitmapDescriptor()).title("\u7EC8\u70B9")); // mAMap.moveCamera(CameraUpdateFactory.newLatLngZoom(startPoint, // getShowRouteZoom())); }
Example #28
Source File: NaviCustomActivity.java From Maps with GNU General Public License v2.0 | 5 votes |
public void addCameraMarkers(ArrayList<BJCamera> cameraBeans) { ArrayList<MarkerOptions> markerOptionses = new ArrayList<>(); for (BJCamera cameraBean : cameraBeans) { LatLng latLng = new LatLng(cameraBean.getLatitude(), cameraBean.getLongtitude()); MarkerOptions mo = new MarkerOptions().position(latLng).draggable(true).icon(icon); markerOptionses.add(mo); } markers = mAmap.addMarkers(markerOptionses, false); }
Example #29
Source File: BusRouteOverlay.java From BmapLite with Apache License 2.0 | 5 votes |
/** * @param routeBusLineItem */ private void addBusStationMarkers(RouteBusLineItem routeBusLineItem) { BusStationItem startBusStation = routeBusLineItem .getDepartureBusStation(); LatLng position = AMapUtil.convertToLatLng(startBusStation .getLatLonPoint()); String title = routeBusLineItem.getBusLineName(); String snippet = getBusSnippet(routeBusLineItem); addStationMarker(new MarkerOptions().position(position).title(title) .snippet(snippet).anchor(0.5f, 0.5f).visible(nodeIconVisible) .icon(getBusBitmapDescriptor())); }
Example #30
Source File: GeoFence_Keyword_Activity.java From Android_Location_Demo with Apache License 2.0 | 5 votes |
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_geofence_new); setTitle(R.string.keywordGeoFence); // 初始化地理围栏 fenceClient = new GeoFenceClient(getApplicationContext()); lyOption = findViewById(R.id.ly_option); btAddFence = (Button) findViewById(R.id.bt_addFence); btOption = (Button) findViewById(R.id.bt_option); tvResult = (TextView) findViewById(R.id.tv_result); tvResult.setVisibility(View.GONE); etCustomId = (EditText) findViewById(R.id.et_customId); etCity = (EditText) findViewById(R.id.et_city); etPoiType = (EditText) findViewById(R.id.et_poitype); etKeyword = (EditText) findViewById(R.id.et_keyword); etFenceSize = (EditText) findViewById(R.id.et_fenceSize); cbAlertIn = (CheckBox) findViewById(R.id.cb_alertIn); cbAlertOut = (CheckBox) findViewById(R.id.cb_alertOut); cbAldertStated = (CheckBox) findViewById(R.id.cb_alertStated); mMapView = (MapView) findViewById(R.id.map); mMapView.onCreate(savedInstanceState); markerOption = new MarkerOptions().draggable(true); init(); }