Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

更新代码 #1

Open
wants to merge 119 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
03d15bf
Android部分重构
lovebing Dec 10, 2018
e69975d
Update build.gradle
lovebing Dec 12, 2018
fb3a9d7
Update build.gradle
lovebing Dec 12, 2018
b4360b1
Correctly import modules into index.js
mmabraham Dec 28, 2018
27417d3
android example
lovebing Feb 9, 2019
34e87a7
update README.md
lovebing Feb 9, 2019
ed8b7eb
ios example
lovebing Feb 12, 2019
00849d3
Podfile.lock
lovebing Feb 12, 2019
08b0095
fix bug
lovebing Feb 12, 2019
fccb6d5
update
lovebing Feb 13, 2019
a60bebe
修复ios example的bug
lovebing Feb 13, 2019
cebe5f4
修复一些bug
lovebing Feb 13, 2019
eed37c3
修复example的bug
lovebing Feb 14, 2019
495351e
Merge branch 'master' into master
lovebing Feb 14, 2019
2dfcc88
Merge pull request #213 from mmabraham/master
lovebing Feb 14, 2019
94c9ab2
Update README.md
lovebing Feb 14, 2019
d2f70f2
Update README.md
lovebing Feb 14, 2019
a1a672c
Update MapView.js
kerlw Feb 27, 2019
3c2edf3
Merge pull request #225 from kerlw/master
lovebing Mar 3, 2019
3741d7c
react-native 0.59 版本下报错:Only one Looper may be created per thread
May 8, 2019
937c2a0
版本和react-native统一
Xiapeixu Jun 10, 2019
0f84afd
允许使用静态framework
Jun 12, 2019
32dbead
升级AndroidX
pj0579 Jul 4, 2019
27e1902
Update build.gradle
pj0579 Jul 4, 2019
b21b34d
说明
guohuihot Jul 8, 2019
29f4dcf
Merge pull request #265 from guohuihot/patch-1
lovebing Oct 2, 2019
1d2286d
Merge pull request #263 from pj0579/master
lovebing Oct 2, 2019
481f484
Merge pull request #258 from KingAmo/patch-1
lovebing Oct 2, 2019
1b518b8
Merge pull request #255 from Xiapeixu/master
lovebing Oct 2, 2019
cbbe4d1
Merge pull request #249 from zhuweideng/master
lovebing Oct 2, 2019
73c9d79
update gradle version; add mvn2.codeboot.net maven
lovebing Oct 3, 2019
f1a461e
0.61.2
lovebing Oct 5, 2019
0b05ef0
remove old child views
lovebing Oct 5, 2019
d64451a
1. 更新 sdk
lovebing Oct 5, 2019
2510b2e
更新 so
lovebing Oct 5, 2019
80b3609
0.61 example
lovebing Oct 6, 2019
bdb34a8
update js
lovebing Oct 6, 2019
07a726f
点聚合
lovebing Oct 7, 2019
16e5e56
fix bug
lovebing Oct 7, 2019
7acf43c
更新example
lovebing Oct 9, 2019
9468db3
修复bundleReleaseAar的问题
lovebing Oct 10, 2019
af092f0
Update README.md
lovebing Oct 10, 2019
4318351
统一代码风格
lovebing Oct 10, 2019
82028ea
Update README.md
lovebing Oct 10, 2019
0f17927
iOS 定位
lovebing Oct 20, 2019
189d844
iOS 支持 react-native link
lovebing Oct 21, 2019
993169b
podspec
lovebing Oct 21, 2019
5382a73
新增 GetDistance 接口模块,Js 调用方法:GetDistance.getLocationDistance([latitude…
Oct 22, 2019
385550d
README 新增使用说明
Oct 22, 2019
458bbd3
README 说明文本格式调整
Oct 22, 2019
68a7555
为 Android 版 Geolocation.getCurrentPosition 方法新增 coorType 属性,并修改为默认以 g…
Oct 22, 2019
3271980
调整 iOS 版 GeoLocation 模块相关接口的 latitude, longitude 属性输出为 double 类型
Oct 22, 2019
b75225e
Create FUNDING.yml
lovebing Oct 22, 2019
ee1cd7b
fix bug #289
lovebing Oct 22, 2019
e191fc6
Update README.md
lovebing Oct 22, 2019
60fa5f9
修改 getLocationDistance 方法参数类型为对象,如 GetDistance.getLocationDistance({l…
Oct 23, 2019
ec6f3c5
修改说明文档中的 getCurrentPosition 方法说明
Oct 23, 2019
15eff33
Merge pull request #286 from Riant/get-distance-module
lovebing Oct 24, 2019
fe9c2bc
Merge pull request #291 from Riant/custom-coordinateType
lovebing Oct 24, 2019
95fb339
增加了 允许拖放与允许手势。
yhaiquan Oct 24, 2019
a3830e7
增加了 允许拖放与允许手势。
yhaiquan Oct 24, 2019
582133c
增加了 允许拖放与允许手势,规范的命名,增加了说明。
yhaiquan Oct 24, 2019
b30853d
Merge pull request #293 from yhaiquan/master
lovebing Oct 24, 2019
cc97fbe
1.0.12
lovebing Oct 26, 2019
0aec7dd
增加BaiduMapManager.initSDK 方法
lovebing Oct 26, 2019
97bd6a6
增加BaiduMapManager.initSDK 方法
lovebing Oct 26, 2019
5c85e56
1.0.16
lovebing Oct 26, 2019
9be41a9
修正 iOS 中 onGetGeoCodeResult 坐标系错误的赋值
Oct 27, 2019
eb09976
iOS 支持 OverlayPolyline
lovebing Oct 27, 2019
7cff943
Merge pull request #294 from Riant/double-ios-LatLng
lovebing Oct 27, 2019
60905d6
显示定位
lovebing Oct 27, 2019
9c5e9da
显示定位
lovebing Oct 27, 2019
af71faa
1.0.18
lovebing Oct 27, 2019
7622d14
调起百度地图客户端
lovebing Oct 30, 2019
6a9d576
1. 支持调起驾车规划。2.Android 增加定位权限申请
lovebing Oct 31, 2019
eaffead
0.61 以下兼容性说明
lovebing Oct 31, 2019
614bb9a
fix bug
lovebing Nov 2, 2019
b67e738
androidx说明
lovebing Nov 2, 2019
eb77a00
修复一些问题
lovebing Nov 5, 2019
6c31285
修复一些问题
lovebing Nov 5, 2019
e136e83
修复安卓6.0及以下,连续或者同时存在2个及以上地图时,出现重叠的问题。
Nov 11, 2019
1af0234
enhance baidu map
lmeng987 Dec 9, 2019
ca894aa
fix ios coordType no effect
chenjim Dec 11, 2019
d28d15c
fix activiy in backgroud and killed by system,then get position crash
chenjim Dec 11, 2019
3fb1b77
fix activiy in backgroud and killed by system,then get position crash
chenjim Dec 11, 2019
69b1e02
refactor
lmeng987 Jan 5, 2020
cbf1875
refactor
lmeng987 Feb 9, 2020
5a73e1e
refactor
lmeng987 Feb 10, 2020
f503824
feat: .d.ts file
onlyling Feb 22, 2020
e96d665
fix: MapViewProps
onlyling Mar 2, 2020
8e971d4
refactor
42997455 Apr 13, 2020
0efd4d9
Merge pull request #304 from lighthx/master
lovebing May 5, 2020
7f9a9c2
Merge pull request #324 from 42997455/master
lovebing May 5, 2020
a656c6e
Merge pull request #314 from chenjim/d28d15c062
lovebing May 5, 2020
dda5cc7
Merge pull request #313 from chenjim/chenjim
lovebing May 5, 2020
c71df3f
fix bugs
lovebing May 11, 2020
a98e38b
优化
lovebing May 13, 2020
c75641d
删除example
lovebing May 13, 2020
14cce8c
1.1.1
lovebing May 13, 2020
9f524e8
iOS 支持 maker icon
lovebing May 15, 2020
835caa5
优化overlay
lovebing May 17, 2020
f797542
readme
lovebing May 17, 2020
620d7c9
v1.0.32
lovebing May 17, 2020
c3de7f4
marker增加onClick回调
lovebing May 17, 2020
479d161
marker优化
lovebing May 17, 2020
0df205d
当marker属性变化时更新annotation
lovebing May 17, 2020
9d514d2
统一处理 overlay 属性更新的问题
lovebing May 17, 2020
935adba
v1.0.35
lovebing May 17, 2020
c85a9bb
Merge pull request #325 from onlyling/master
lovebing May 22, 2020
fe1c28c
copyright 更新;android 自定义热力图
lovebing May 22, 2020
af4fa2c
android 自定义热力图
lovebing May 22, 2020
5c701ea
热力图和MarkerIcon
lovebing Jun 7, 2020
d008535
修复ios marker icon 无法响应 click 事件的bug
lovebing Jun 13, 2020
a0c8030
icon image 复用; Marker.animateType; BaiduMapManager.hasLocationPermission
lovebing Jun 14, 2020
110f468
不再视野内的marker不作绘制
supermaverickws Jun 29, 2020
9af0462
不在视野内marker不绘制,避免绘制大量marker卡顿
supermaverickws Jun 29, 2020
5323b30
代码规范
supermaverickws Jun 29, 2020
fe9efec
增加cluster的 onMapStatusChangeFinish回调事件
supermaverickws Jun 29, 2020
221271d
Merge pull request #347 from supermaverickws/master
lovebing Jul 17, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
热力图和MarkerIcon
  • Loading branch information
lovebing committed Jun 7, 2020
commit 5c701ea366d051b26986f0823bbe872d99a9dcdd
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -115,7 +115,7 @@ BaiduMapManager.initSDK('sIMQlfmOXhQmPLF1QMh4aBp8zZO9Lb2A');
| onMapPoiClick | func | undefined|

#### Overlay 覆盖物
const { Marker, Cluster, Arc, Circle, Polyline, Polygon, Text, InfoWindow } = Overlay;
const { Marker, Cluster, Arc, Circle, Polyline, Polygon, InfoWindow, HeatMap } = Overlay;

##### 颜色取值说明
6 位(RRGGBB)或 8 位(AARRGGBB)
@@ -175,20 +175,35 @@ BaiduMapManager.initSDK('sIMQlfmOXhQmPLF1QMh4aBp8zZO9Lb2A');
| rotate | float | |
| location | object|{latitude: 0, longitude: 0}


##### MarkerIcon 使用 View 作为 marker 的 icon

##### InfoWindow Props 属性
必须作为 Marker 的子组件

| Prop | Type | Default | Description
| ----------------------- |:-----:| :-------:| -------
| offsetY | int | 0 | 相对于 point 在 y 轴的偏移量,仅 Android

#### HeatMap Props 属性

| Prop | Type | Default | Description
| ----------------------- |:-----:| :-------:| -------
| points | array | |
| gradient | object| { colors: ['66FF00', 'FF0000'], startPoints: [0.2, 1.0] } | 颜色渐变对象

```jsx
<MapView>
<Marker/>
<Marker>
<InfoWindow>
<InfoWindow style={{ backgroundColor: 'red', width: 200, height: 100}}>
<View />
</InfoWindow>
<MarkerIcon style={{ backgroundColor: 'red', width: 40, height: 40}}>
<View>
<Text>ABC</Text>
</View>
</MarkerIcon>
</Marker>
<Cluster>
<Marker/>
@@ -197,7 +212,8 @@ BaiduMapManager.initSDK('sIMQlfmOXhQmPLF1QMh4aBp8zZO9Lb2A');
<Circle />
<Polyline />
<Polygon />
<Text />
<Overlay.Text>text</Overlay.Text>
<HeatMap />
</MapView>
```

Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@
import org.lovebing.reactnative.baidumap.module.GetDistanceModule;
import org.lovebing.reactnative.baidumap.module.MapAppModule;
import org.lovebing.reactnative.baidumap.uimanager.*;
import org.lovebing.reactnative.baidumap.view.OverlayMarkerIcon;


/**
@@ -53,6 +54,7 @@ public List<ViewManager> createViewManagers(
new MapViewManager(),
new OverlayClusterManager(),
new OverlayMarkerManager(),
new OverlayMarkerIconManager(),
new OverlayOverlayInfoWindowManager(),
new OverlayArcManager(),
new OverlayCircleManager(),
Original file line number Diff line number Diff line change
@@ -7,6 +7,8 @@

package org.lovebing.reactnative.baidumap.listener;

import android.util.Log;

import com.baidu.mapapi.map.BaiduMap;
import com.baidu.mapapi.map.InfoWindow;
import com.baidu.mapapi.map.MapPoi;
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2016-present, lovebing.net.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

package org.lovebing.reactnative.baidumap.uimanager;

import androidx.annotation.NonNull;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.ViewGroupManager;
import org.lovebing.reactnative.baidumap.view.OverlayMarkerIcon;

/**
* @author lovebing
* @date 2020-06-07
*/
public class OverlayMarkerIconManager extends ViewGroupManager<OverlayMarkerIcon> {

@NonNull
@Override
public String getName() {
return "BaiduMapOverlayMarkerIcon";
}

@NonNull
@Override
protected OverlayMarkerIcon createViewInstance(@NonNull ThemedReactContext reactContext) {
return new OverlayMarkerIcon(reactContext);
}
}
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@
import org.lovebing.reactnative.baidumap.util.LatLngUtil;
import org.lovebing.reactnative.baidumap.view.OverlayInfoWindow;
import org.lovebing.reactnative.baidumap.view.OverlayMarker;
import org.lovebing.reactnative.baidumap.view.OverlayMarkerIcon;

public class OverlayMarkerManager extends ViewGroupManager<OverlayMarker> {

@@ -87,6 +88,8 @@ public void setFlat(OverlayMarker overlayMarker, boolean flat) {
public void addView(OverlayMarker parent, View child, int index) {
if (child instanceof OverlayInfoWindow) {
parent.setOverlayInfoWindow((OverlayInfoWindow) child);
} else if (child instanceof OverlayMarkerIcon) {
parent.setIconView(child);
}
super.addView(parent, child, index);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright (c) 2016-present, lovebing.net.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

package org.lovebing.reactnative.baidumap.util;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.view.View;

import com.baidu.mapapi.map.BitmapDescriptor;
import com.baidu.mapapi.map.BitmapDescriptorFactory;

/**
* @author lovebing
* @date 2020-05-25
*/
public class BitmapUtil {

public static BitmapDescriptor createBitmapDescriptor(View view) {
return createBitmapDescriptor(view, 0, 0);
}

public static BitmapDescriptor createBitmapDescriptor(View view, int width, int height) {
if (width > 0 && height > 0) {
view.layout(0, 0, width, height);
} else if (view.getMeasuredWidth() == 0 || view.getMeasuredHeight() == 0) {
view.layout(0, 0, view.getMeasuredWidth() > 0 ? view.getMeasuredWidth() : 50, view.getMeasuredHeight() > 0 ? view.getMeasuredHeight() : 100);
}
view.buildDrawingCache();
BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(view.getDrawingCache());
view.destroyDrawingCache();
return bitmapDescriptor;
}

public static Bitmap resizeBitmap(Bitmap bitmap, int width, int height) {
float scaleWidth = ((float) width) / bitmap.getWidth();
float scaleHeight = ((float) height) / bitmap.getHeight();
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
}
}
Original file line number Diff line number Diff line change
@@ -69,7 +69,9 @@ public void addTopMap(BaiduMap baiduMap) {

@Override
public void removeFromMap(BaiduMap baiduMap) {
heatMap.removeHeatMap();
heatMap = null;
if (heatMap != null) {
heatMap.removeHeatMap();
heatMap = null;
}
}
}
Original file line number Diff line number Diff line change
@@ -8,13 +8,13 @@
package org.lovebing.reactnative.baidumap.view;

import android.content.Context;

import com.baidu.mapapi.map.BitmapDescriptor;
import com.baidu.mapapi.map.BitmapDescriptorFactory;
import com.baidu.mapapi.map.InfoWindow;
import com.baidu.mapapi.model.LatLng;
import com.facebook.react.views.view.ReactViewGroup;

import org.lovebing.reactnative.baidumap.util.BitmapUtil;

/**
* @author lovebing Created on Dec 09, 2018
*/
@@ -52,18 +52,11 @@ public void setOffsetY(int offsetY) {

private void updateInfoWindow(LatLng location) {
if (infoWindow == null) {
BitmapDescriptor bitmap;
if (width > 0 && height > 0) {
layout(0, 0, width, height);
} else if (getMeasuredWidth() == 0 || getMeasuredHeight() == 0) {
layout(0, 0, getMeasuredWidth() > 0 ? getMeasuredWidth() : 50, getMeasuredHeight() > 0 ? getMeasuredHeight() : 100);
}
buildDrawingCache();
bitmap = BitmapDescriptorFactory.fromBitmap(getDrawingCache());
if (bitmap == null) {
BitmapDescriptor bitmapDescriptor = BitmapUtil.createBitmapDescriptor(this, width, height);
if (bitmapDescriptor == null) {
return;
}
infoWindow = new InfoWindow(bitmap, location, offsetY, new InfoWindow.OnInfoWindowClickListener() {
infoWindow = new InfoWindow(bitmapDescriptor, location, offsetY, new InfoWindow.OnInfoWindowClickListener() {
@Override
public void onInfoWindowClick() {

Original file line number Diff line number Diff line change
@@ -10,12 +10,12 @@
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.graphics.drawable.Animatable;
import android.net.Uri;
import android.util.AttributeSet;

import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

@@ -41,6 +41,7 @@

import org.lovebing.reactnative.baidumap.R;
import org.lovebing.reactnative.baidumap.model.IconInfo;
import org.lovebing.reactnative.baidumap.util.BitmapUtil;

import java.util.Objects;

@@ -60,6 +61,7 @@ public class OverlayMarker extends ViewGroup implements OverlayView, ClusterItem
private OverlayInfoWindow overlayInfoWindow;
private volatile boolean loadingImage = false;
private InfoWindow titleInfoWindow;
private View iconView;

private final ControllerListener<ImageInfo> imageControllerListener =
new BaseControllerListener<ImageInfo>() {
@@ -157,6 +159,14 @@ public void setOverlayInfoWindow(OverlayInfoWindow overlayInfoWindow) {
this.overlayInfoWindow = overlayInfoWindow;
}

public void setIconView(View iconView) {
this.iconView = iconView;
if (marker != null) {
iconBitmapDescriptor = BitmapUtil.createBitmapDescriptor(iconView);
marker.setIcon(iconBitmapDescriptor);
}
}

public String getTitle() {
return title;
}
@@ -181,14 +191,6 @@ public void setPosition(LatLng position) {
}
}

public BitmapDescriptor getIconBitmapDescriptor() {
return iconBitmapDescriptor;
}

public void setIconBitmapDescriptor(BitmapDescriptor iconBitmapDescriptor) {
this.iconBitmapDescriptor = iconBitmapDescriptor;
}

public Float getRotate() {
return rotate;
}
@@ -200,21 +202,13 @@ public void setRotate(Float rotate) {
}
}

public Boolean getFlat() {
return flat;
}

public void setFlat(Boolean flat) {
this.flat = flat;
if (marker != null) {
marker.setFlat(flat);
}
}

public Boolean getPerspective() {
return perspective;
}

public void setPerspective(Boolean perspective) {
this.perspective = perspective;
if (marker != null) {
@@ -253,23 +247,16 @@ public void setIcon(IconInfo iconInfo) {
@Override
public BitmapDescriptor getBitmapDescriptor() {
BitmapDescriptor result;
if (getIconBitmapDescriptor() != null) {
result = getIconBitmapDescriptor();
if (iconBitmapDescriptor != null) {
result = iconBitmapDescriptor;
} else {
result = BitmapDescriptorFactory.fromResource(R.mipmap.icon_gcoding);
}
if (iconInfo != null
&& iconInfo.getWidth() > 0
&& iconInfo.getHeight() > 0) {
int height = result.getBitmap().getHeight();
int width = result.getBitmap().getWidth();
float scaleWidth = ((float) iconInfo.getWidth()) / width;
float scaleHeight = ((float) iconInfo.getHeight()) / height;
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);

Bitmap newBitmap = Bitmap.createBitmap(result.getBitmap(), 0, 0, width, height, matrix, true);
result = BitmapDescriptorFactory.fromBitmap(newBitmap);
result = BitmapDescriptorFactory.fromBitmap(BitmapUtil.resizeBitmap(result.getBitmap(),
iconInfo.getWidth(), iconInfo.getHeight()));
}
return result;
}
@@ -297,6 +284,10 @@ public void removeFromMap(BaiduMap baiduMap) {
if (marker != null) {
marker.remove();
marker = null;
overlayInfoWindow = null;
titleInfoWindow = null;
iconView = null;
iconBitmapDescriptor = null;
}
}

@@ -315,12 +306,13 @@ public int hashCode() {
}

private void addOverlay(BaiduMap baiduMap) {
BitmapDescriptor icon = getBitmapDescriptor();
if (iconView != null) {
iconBitmapDescriptor = BitmapUtil.createBitmapDescriptor(iconView);
}
MarkerOptions option = new MarkerOptions()
.position(position)
.title(getTitle())
.alpha(getAlpha())
.icon(icon);
.icon(getBitmapDescriptor());
if (rotate != null) {
option.rotate(rotate);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2016-present, lovebing.net.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

package org.lovebing.reactnative.baidumap.view;

import android.content.Context;
import com.facebook.react.views.view.ReactViewGroup;

/**
* @author lovebing
* @date 2020-06-07
*/
public class OverlayMarkerIcon extends ReactViewGroup {

public OverlayMarkerIcon(Context context) {
super(context);
}
}
Loading