百度地图(23)-GL 地图属性

摘要:
3D库演示特别将其概括为一个功能点。

1. GL 的库提供了一些针对地图属性的设置函数,我估计二维的库里也有,只不过当时写的时候,没有特意把这个总结出来。

 三维的库demo特意把这个作为一个功能点总结了一下。

2.  主要有设置级别、缩小一级、放大一级、获取当前级别、显示POI文字、隐藏POI文字,显示POI的icon,隐藏POI的icon,

显示覆盖物、隐藏覆盖物、显示3D建筑物、隐藏3D建筑物、显示图层、隐藏图层。

其中图层是 TileLayer。

3. 

function setNewZoom() {
  var zoom = document.getElementById('zoominput').value;
  map.setZoom(zoom);
}
function getMapZoom() {
  alert(map.getZoom());
}

function setNewCenter(){
  var lng = 116.514 + Math.floor(Math.random() * 589828) / 1e6;
  var lat = 39.416 + Math.floor(Math.random() * 514923) /1e6;
  var point = new BMMapGL.Point(lng,lat);
  map.setCenter(point);
}
function getMapCenter() {
  var cen = map.getCenter();
  alert('地图中心点:(' + cen.lng.toFixed(5) + ',' + cen.lat.toFixed(5) + ')');
}

function setMapZoom1() {
  map = new BMapGL.Map('allmap',{
    minZoom:5,
    maxZoom:20
  });
}

function setMapZoom2() {
  map.setMinZoom(4);
  map.setMaxZoom(20);
}

function set3DView(){
  map.setHeading(64.5);
  map.setTilt(73);
}

function showPoi() {
  map.setDisplayOptions({
    poi: true       //是否显示POI信息
  })
}

function hidePoi() {
  map.setDisplayOptions({
    poi: false       //是否显示POI信息
  })
}

function showText() {
  map.setDisplayOptions({
    poiText: true
  })
}
function hideText() {
  map.setDisplayOptions({
    poiText: false
  })
}
function showIcon() {
  map.setDisplayOptions({
    poiIcon: true
  })
}
function hideIcon() {
  map.setDisplayOptions({
    poiIcon: false
  })
}

/**
 * 显示覆盖物
 */

function showOverlay(){

  var pt = new BMapGL.Point(116.404,39.915);
  map.centerAndZoom(pt,15);
  var marker = new BMapGL.Marker(pt);
  map.addOverlay(marker);

  map.setDisplayOptions({
    overlay:true
  })
}

function hideOverlay() {
  map.setDisplayOptions({
    overlay:false
  })
}

function addTilelay() {
  tilelayer.zIndex = 110;
  tilelayer.getTilesUrl = function (point, level) {
    if(!point || level <0){
      return null;
    }

    var row = point.x;
    var col = point.y;
    var url = '//mapsv0.bdimg.com/tile/?udt=' + udtVersion + '&qt=tile&styles=' + tstyle
      + '&x=' + row + '&y=' + col + '&z=' + level;
    return url;
  }
  map.addTileLayer(this.tilelayer);
}

/**
 * 显示图层
 */
function showTilelay() {
  addTilelay();
  // map.setDisplayOptions({
  //   layer:true
  // })
}

function hideTilelay() {
  map.removeTileLayer(this.tilelayer);
  // map.setDisplayOptions({
  //   layer:false
  // })
}

var isTilePng = true;
var tileSize = 256;
var tstyle = 'pl';
var udtVersion = '20190102';
var tilelayer = new BMapGL.TileLayer({
  transparentPng:isTilePng
});

function show3Dbuild() {
  map.setDisplayOptions({
    building:true
  })
};

function hide3Dbuild() {
  map.setDisplayOptions({
    building:false
  })
}


function setMarkerVisible(){

  map.setDisplayOptions({
    overlay:false,
    layer:false,
    building:false
  })


}

function showRoadNet() {
  map.setMapType(BMAP_EARTH_MAP);
  map.setTilt(73);
  map.setDisplayOptions({
    street:true
  })
}

function hideRoadNet() {
  map.setDisplayOptions({
    street:false
  })
}

function setSkyColor() {
  map.setDisplayOptions({
    skyColors:['rgba(186,0,255,0)','rgba(186,0,255,0.2)']
  })
}

4. 页面显示

百度地图(23)-GL 地图属性第1张

5 . 代码参考

https://github.com/WhatGIS/bdMap

免责声明:文章转载自《百度地图(23)-GL 地图属性》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇Gearman分布式任务处理系统(一)基本介绍pyes-elasticsearch的python客户端使用笔记下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

POI解析word文件,并为特定规则的key替换值

转载:https://www.aliyun.com/jiaocheng/778166.html 模板替换内容key是: ${enforcername1} package com.jsy.test.pdf; import java.io.FileOutputStream;import java.io.IOException;import java.ut...

【POI】修改Excel内容

    1 package com.what21.test; 2 3 import java.io.File; 4 import java.io.FileInputStream; 5 import java.io.FileNotFoundException; 6 import java.io.FileOutputStream;...

Java 使用POI操作EXCEL及测试框架搭建、测试开发的一些想法

无论是UI自动化测试还是接口自动化测试都需要进行数据驱动,一般很常见的一种方式就是用excel来管理数据,那么就涉及到一些代码对EXCEL的操作,之前我们介绍过用CSV来处理EXCEL,但是它的功能还不够强大。比如接口自动化测试框架搭建的时候我们用excel来进行数据驱动,用excel来进行用例的管理和测试结果的统计,那么我们就需要对excel进行读取,写...

记录POI导入时单元格下拉框两种实现方式(excel数据有效性)

如果下拉选项字符少于225 使用方式1 public static HSSFSheet setHSSFValidation(HSSFSheet sheet, String[] textlist, int firstRow, int endRow, int firstCol,int endCol) { // 加载下拉列表内容...

Apache POI Java读取100万行Excel性能优化:split vs indexOf+subString,谁性能好

使用Apache POI eventmodel实现一个Excel流式读取类,目标是100万行,每行46列,文件大小152MB的Excel文件能在20s读取并处理完。一开始实现的程序需要260s,离目标差太远了,使用jvisualvm分析各方法执行时间,结果如下: 可以看到,程序中的splitLine和getRowNum方法消耗了大量时间。这两个方法都特别...

POI使用 (4.0) 常用改动

POI 升级到高版本后,原有的EXCLE导入导出工具类部分代码已不适用,目前只是对我自己写的工具类的过期代码进行更新,以后继续更新 若有问题请指出,再修改 1、数据类型 Cell.CELL_TYPE_NUMERIC ==》转换为对应 CellType.NUMERIC 同样 类似的其他类型 如 CELL_TYPE_STRING 等等 CellType 都...