zoukankan      html  css  js  c++  java
  • 百度地图根据绘制的路线进行合理缩放

    //根据polyline设置地图范围
    - (void)mapViewFitPolyLine:(BMKPolyline *) polyLine {
        CGFloat ltX, ltY, rbX, rbY;
        if (polyLine.pointCount < 1) {
            return;
        }
        BMKMapPoint pt = polyLine.points[0];
        ltX = pt.x, ltY = pt.y;
        rbX = pt.x, rbY = pt.y;
        for (int i = 1; i < polyLine.pointCount; i++) {
            BMKMapPoint pt = polyLine.points[i];
            if (pt.x < ltX) {
                ltX = pt.x;
            }
            if (pt.x > rbX) {
                rbX = pt.x;
            }
            if (pt.y > ltY) {
                ltY = pt.y;
            }
            if (pt.y < rbY) {
                rbY = pt.y;
            }
        }
        BMKMapRect rect;
        rect.origin = BMKMapPointMake(ltX , ltY);
        rect.size = BMKMapSizeMake(rbX - ltX, rbY - ltY);
        [_historyMapView setVisibleMapRect:rect];
        _historyMapView.zoomLevel = _historyMapView.zoomLevel - 0.3;
    }

  • 相关阅读:
    第60届IMO 第5题
    第31届IMO 第2题
    洛谷【P1595 信封问题】 题解
    洛谷【P2022 有趣的数】 题解
    洛谷【P5004 专心OI
    04-----jQuery的属性操作
    03-----jQuery动画效果
    02-----jQuery的选择器
    01-----jQuery介绍
    17-----案例
  • 原文地址:https://www.cnblogs.com/yangxiaolong/p/5310199.html
Copyright © 2011-2022 走看看