arcgis js api 4.X 自定义工具按钮
// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See https://js.arcgis.com/4.10/esri/copyright.txt for details.
//>>built ; ;sdfsd sd;;;
define('esri/widgets/Widget esri/widgets/support/widget'.split(' '), function(Widget, widget) {
console.log("baseButtonWedgit")
var baseButtonWedgit = Widget.createSubclass({
constructor: function(options) {
if (options) {
dojo.mixin(this, options);
}
},
cancelGo: function() {},
go: function() {
alert('go go go');
},
_go: function() {
if (this.go) {
this.go.call(this,this);
}
},
getLable: function() {
return this.lable || '标题';
},
getTitle: function() {
return this.title || 'title';
},
getDivClass :function(){
return {};
},
getIconClass :function(){
return {};
},
render: function() {
var title = this.getTitle(this);
var lable = this.getLable(this);
var divClass = this.getDivClass(this);
var iconClass = this.getIconClass(this);
return widget.tsx(
'div',
{
bind: this,
class: this.classes('esri-home esri-widget--button esri-widget',divClass),
role: 'button',
tabIndex: 0,
onclick: this._go,
onkeydown: this._go,
'aria-label': lable,
title: title,
},
widget.tsx('span', {
'aria-hidden': 'true',
class: this.classes('esri-icon', iconClass),
innerText: this.title, }),
widget.tsx(
'span',
{
class: 'esri-icon-font-fallback-text',
},
'button'
)
);
},
});
return baseButtonWedgit;
});
/**
* 添加工具按钮
*/
this.addButtonWedgit = (options = {}) => {
// options.map = map;
// options.view = view;
const button = new BaseButtonWedgit(options);
view.ui.add(button, {
position: options.position || 'bottom-right',
});
return button;
};
const btn1 = this.pmap.addButtonWedgit({
go: (e) => {
const {domNode} = e;
console.log(domNode)
if (this.maptype === '3D') {
this.maptype = '2D';
self.setState({ is3D: false });
btn1.title = '二维地图'
btn1.set("title", '二维地图');
} else {
this.maptype = '3D';
btn1.title = '三维地图'
self.setState({ is3D: true });
}
},
getTitle:()=>this.maptype === '3D'?"二维地图":"三维地图" ,
getIconClass:()=>this.maptype === '3D'?{"esri-icon-2d":true}:{"esri-icon-3d":true}
});
btn1.set("title", '三维地图');
btn1.set("maptype", '2D');
btn1.set("buttonClass", 'buttonClass');
}

arcgis js api 4.X 自定义工具按钮的更多相关文章
- ArcGIS JS API使用PrintTask打印地图问题解决汇总
环境:来源于工作过程,使用的API是 arcgis js 3.* 3系API,4.*暂时没测试: 1.数据与打印服务跨域情况下,不能打印问题. 一般情况下,我们发布的数据服务和打印服务是在一台服务 ...
- 基于ArcGIS JS API的在线专题地图实现
0 引言 专题地图是突出而深入的表示一种或几种要素或现象,即按照地图主题的要求,集中表示与主题有关内容的地图.专题地图的专题要素多种多样,分类方法也多种多样,根据专题地图表现数据的特点可分为定 ...
- geoserver图层属性查询及查询结果转换为arcgis js api能使用的格式
一个项目使用了ArcGIS JS API开发GIS展示层,但GIS服务使用了Geoserver,这时加载Geoserver数据和查询数据就和之前完全不一样了,以下介绍下我使用ArcGIS JS API ...
- 关于ueditor与arcgis js api同用会报错的问题
在ueditor与arcgis js api共用时,需要将ueditor\third-party\zeroclipboard\ZeroClipboard.js中的 if (typeof define ...
- arcgis js api 本地化配置
配置arcgis library 根目录的init.js的 "baseUrl:",使其指向正确的地址
- Arcgis js API使用wmts方式加载GeoWebCache中的切片地图(转载)
使用GeoWebCache的主要目的是其独立安装版能够发布arcgis的切片.我们知道,使用openlayer是调用geoserver最方便的方法,那么在发布完arcgis的切片后,怎么用arcgis ...
- ArcGIS JS API多线程克里金插值
最近做关于雨量插值的项目,本来使用后台的GP工具做的,但是处理时间比较长需要十几秒钟左右,所以研究怎么通过前台来计算. 参考下克里金例子,思路是生成要计算区域的100乘以100网格,然 ...
- ArcGIS js api 手动构建FeatureLayer
坐标系 var spatialReference = new SpatialReference(4326);1要素坐标点 var pointArr = [ new Point(116.94431351 ...
- ArcGIS JS Api 4.x修改三维球背景技巧
通过修改scenceview.js中tileBackground和defaultTileBackground中的png的base64编码就可以达到要求. 4.8中通过修改scenceview. ...
随机推荐
- java9模块不可见问题
问题描述 jdk.internal.reflect包不可见 问题原因 java9模块化之后,java.base只把jdk.internal.reflect暴露给了少数几个内部包而没有向当前模块暴露. ...
- flink 批量梯度下降算法线性回归参数求解(Linear Regression with BGD(batch gradient descent) )
1.线性回归 假设线性函数如下: 假设我们有10个样本x1,y1),(x2,y2).....(x10,y10),求解目标就是根据多个样本求解theta0和theta1的最优值. 什么样的θ最好的呢?最 ...
- python 之Lambda表达式
python 的 lambda 表达式 python写一些执行脚本时,使用lambda就可以省下定义函数的过程,比如说我们只是需要写个简单的脚本来管理服务器时,我们就不用专门定义函数然后再写调用,使用 ...
- [TCP/IP] TCP流和UDP数据报之间的区别
TCP流和UDP数据报之间的区别 1.TCP本身是面向连接的协议,S和C之间要使用TCP,必须先建立连接,数据就在该连接上流动,可以是双向的,没有边界.所以叫数据流 ,占系统资源多 2.UDP不是面向 ...
- Centos7安装JDK环境配置
作为一名程序员,各种环境搭建都要会. 下面介绍关于Linux操作系统之centos7(64位)安装JDK以及环境配置. 下面开始学习吧 查看并卸载CentOS自带的OpenJDK 安装好的CentOS ...
- Ubuntu14 安装过程
系统:Description: Ubuntu 14.04.6 LTS平台:Oracle VM VirtualBox 先到阿里巴巴开源镜像站 https://opsx.alibaba.com/ 下 ...
- toString的本质 以及String.valueOf()
Object可以用toString转为字符串. Object.toString(); 但char[]不行,得用valueOf. String.valueOf(char[]); 如果用toString, ...
- LeetCode24-Swap_Pairs
swapPairs public ListNode swapPairs(ListNode head) { if(head==null ||head.next==null) return head; L ...
- 20190922 「HZOJ NOIP2019 Round #7」20190922模拟
综述 这次是USACO2019JAN Gold的题目. \(\mathrm{Cow Poetry}\) 题解 因为每句诗的长度一定是\(k\),所以自然而然想到背包. 设\(opt[i][j]\)代表 ...
- [POJ3107]Godfather
题目描述 Description Last years Chicago was full of gangster fights and strange murders. The chief of th ...