|
|
第34行: |
第34行: |
| <div class="left-qrCode"> | | <div class="left-qrCode"> |
| <!-- 安卓二维码位置 --> | | <!-- 安卓二维码位置 --> |
− | <div class="qrCode-and">1590746640|//mapopen-website-wiki.bj.bcebos.com/demos/qrcodes/flutter.png</div> | + | <div class="qrCode-and">1590746640|//mapopen-website-wiki.bj.bcebos.com/demos/newqrcodes/fultter.png</div> |
| <div>扫码体验</div> | | <div>扫码体验</div> |
| </div> | | </div> |
2020年6月8日 (一) 16:43的版本
定位Flutter
功能场景
本示例介绍了如何快速集成百度定位Flutter插件,实现两端基本定位需求。
//mapopen-website-wiki.bj.bcebos.com/demos/flutter.mp4
1590746640|//mapopen-website-wiki.bj.bcebos.com/demos/newqrcodes/fultter.png
扫码体验
使用产品
定位Flutter插件|/index.php?title=flutter/loc
下载源码
//mapopen-website-wiki.bj.bcebos.com/demos/baidu_location_flutter.zip
bdmap_location_flutter_plugin
bdmap_location_flutter_plugin
Future<bool> setApiKey(String key)
bdmap_location_flutter_plugin
void prepareLoc(Map androidMap, Map iosMap)
bdmap_location_flutter_plugin
bdmap_location_flutter_plugin
bdmap_location_flutter_plugin
Stream<Map<String, Object>> onResultCallback()
原生端以键值对map的形式回传定位结果到Flutter端
详细配置和使用文档请参照
定位Flutter插件开发文档|/index.php?title=flutter/loc
//mapopen-website-wiki.bj.bcebos.com/demos/iostest.MP4
//mapopen-website-wiki.bj.bcebos.com/demos/play.png
扫码手机观看
使用产品
产品1|/index.php?title=test
>
产品2|/index.php?title=test
下载源码
//mapopen-website-wiki.bj.bcebos.com/demos/xs%20max.png
- (void)clearClusterItems;
- (NSArray<BMKCluster *> *)getClusters:(CGFloat)zoomLevel;
1.第一步
1
/** 更新标注展示. */
- (void)updateClusters {
_clusterZoom = (NSInteger)_mapView.zoomLevel;
@synchronized(_clusterManager.clusterCaches) {
NSMutableArray *clusters = [_clusterManager.clusterCaches objectAtIndex:(_clusterZoom - 3)];
if (clusters.count > 0) {
// 移除一组标注
[_mapView removeAnnotations:_mapView.annotations];
//将一组标注添加到当前地图View中
[_mapView addAnnotations:clusters];
} else {
__weak typeof(self) weakSelf = self;
dispatch_async(dispatch_get_global_queue(0, 0), ^{
// 获取聚合后的标注
__block NSArray *array = [weakSelf.clusterManager getClusters:weakSelf.clusterZoom];
dispatch_async(dispatch_get_main_queue(), ^{
for (BMKCluster *item in array) {
ClusterAnnotation *annotation = [[ClusterAnnotation alloc] init];
// 设置标注的经纬度坐标
annotation.coordinate = item.coordinate;
annotation.size = item.size;
// 设置标注的标题
annotation.title = [NSString stringWithFormat:@"我是%lu个", (unsigned long)item.size];
[clusters addObject:annotation];
}
// 移除一组标注
[weakSelf.mapView removeAnnotations:weakSelf.mapView.annotations];
// 将一组标注添加到当前地图View中
[weakSelf.mapView addAnnotations:clusters];
});
});
}
}
}
复制成功
2.第二步
2
/** 更新标注展示. */
- (void)updateClusters {
_clusterZoom = (NSInteger)_mapView.zoomLevel;
@synchronized(_clusterManager.clusterCaches) {
NSMutableArray *clusters = [_clusterManager.clusterCaches objectAtIndex:(_clusterZoom - 3)];
if (clusters.count > 0) {
// 移除一组标注
[_mapView removeAnnotations:_mapView.annotations];
//将一组标注添加到当前地图View中
[_mapView addAnnotations:clusters];
} else {
__weak typeof(self) weakSelf = self;
dispatch_async(dispatch_get_global_queue(0, 0), ^{
// 获取聚合后的标注
__block NSArray *array = [weakSelf.clusterManager getClusters:weakSelf.clusterZoom];
dispatch_async(dispatch_get_main_queue(), ^{
for (BMKCluster *item in array) {
ClusterAnnotation *annotation = [[ClusterAnnotation alloc] init];
// 设置标注的经纬度坐标
annotation.coordinate = item.coordinate;
annotation.size = item.size;
// 设置标注的标题
annotation.title = [NSString stringWithFormat:@"我是%lu个", (unsigned long)item.size];
[clusters addObject:annotation];
}
// 移除一组标注
[weakSelf.mapView removeAnnotations:weakSelf.mapView.annotations];
// 将一组标注添加到当前地图View中
[weakSelf.mapView addAnnotations:clusters];
});
});
}
}
}
复制成功
3.名字
3
/** 更新标注展示. */
- (void)updateClusters {
_clusterZoom = (NSInteger)_mapView.zoomLevel;
@synchronized(_clusterManager.clusterCaches) {
NSMutableArray *clusters = [_clusterManager.clusterCaches objectAtIndex:(_clusterZoom - 3)];
if (clusters.count > 0) {
// 移除一组标注
[_mapView removeAnnotations:_mapView.annotations];
//将一组标注添加到当前地图View中
[_mapView addAnnotations:clusters];
} else {
__weak typeof(self) weakSelf = self;
dispatch_async(dispatch_get_global_queue(0, 0), ^{
// 获取聚合后的标注
__block NSArray *array = [weakSelf.clusterManager getClusters:weakSelf.clusterZoom];
dispatch_async(dispatch_get_main_queue(), ^{
for (BMKCluster *item in array) {
ClusterAnnotation *annotation = [[ClusterAnnotation alloc] init];
// 设置标注的经纬度坐标
annotation.coordinate = item.coordinate;
annotation.size = item.size;
// 设置标注的标题
annotation.title = [NSString stringWithFormat:@"我是%lu个", (unsigned long)item.size];
[clusters addObject:annotation];
}
// 移除一组标注
[weakSelf.mapView removeAnnotations:weakSelf.mapView.annotations];
// 将一组标注添加到当前地图View中
[weakSelf.mapView addAnnotations:clusters];
});
});
}
}
}
复制成功
点标记动画|/index.php?title=test
点融合|/index.php?title=test
添加文字和信息窗|/index.php?title=test