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. ...
随机推荐
- Python 高级特性:切片、迭代、列表生成式、生成器
切片(发现了一些新操作) 参考链接:https://www.liaoxuefeng.com/wiki/1016959663602400/1017269965565856 间隔取元素(可以取负数,负数就 ...
- vue学习指南:第五篇(详细) - vue的 computed、methods、watch 的区别?
Computed 计算属性 1. 将函数代码块中返回的结果 赋值 给前面的方法名 2. computed 中的属性有缓存功能,只要data中的数据不发生改变,计算得到的新属 性就会被缓存下 ...
- Violet音乐社区 - 总结报告
目录 一.项目概述 1.1 项目背景 1.2 编写目的 1.3 项目文档 1.4 项目源码 1.5 项目成果 二.个人工作总结 1.1 工作概览 1.1.1 作为项目组组长 1.1.2 作为项目组成员 ...
- Factorization Machine算法
参考: http://stackbox.cn/2018-12-factorization-machine/ https://baijiahao.baidu.com/s?id=1641085157432 ...
- Python从零开始——字符串String
一:Python字符串有哪些内容 二:Python字符串操作符 三:Python字符串格式化——占位符格式化 四:Python字符串格式化——format()函数 五:Python字符串常用操作函数
- pytest生成allure报告
在pytest框架中可以用很多插件来生成测试报告,本文总结下怎么生成allure报告 allure allure是一款开源的,专门用来展示测试结果的一个工具,allure可以与很多的测试框架做集成,比 ...
- 经典的卷积神经网络及其Pytorch代码实现
1.LeNet LeNet是指LeNet-5,它是第一个成功应用于数字识别的卷积神经网络.在MNIST数据集上,可以达到99.2%的准确率.LeNet-5模型总共有7层,包括两个卷积层,两个池化层,两 ...
- index.jsp
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding= ...
- 【NodeJS】Vue-d2Admin
INFO Starting development server... 10% building 2/2 modules 0 active ERROR Error: Watching remote f ...
- Golang调用Python
https://yq.aliyun.com/articles/117329 Python是时髦的机器学习御用开发语言,Golang是大红大紫的新时代后端开发语言.Python很适合让搞算法的写写模型, ...