// 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 自定义工具按钮的更多相关文章

  1. ArcGIS JS API使用PrintTask打印地图问题解决汇总

    环境:来源于工作过程,使用的API是  arcgis js 3.*  3系API,4.*暂时没测试: 1.数据与打印服务跨域情况下,不能打印问题. 一般情况下,我们发布的数据服务和打印服务是在一台服务 ...

  2. 基于ArcGIS JS API的在线专题地图实现

    0 引言     专题地图是突出而深入的表示一种或几种要素或现象,即按照地图主题的要求,集中表示与主题有关内容的地图.专题地图的专题要素多种多样,分类方法也多种多样,根据专题地图表现数据的特点可分为定 ...

  3. geoserver图层属性查询及查询结果转换为arcgis js api能使用的格式

    一个项目使用了ArcGIS JS API开发GIS展示层,但GIS服务使用了Geoserver,这时加载Geoserver数据和查询数据就和之前完全不一样了,以下介绍下我使用ArcGIS JS API ...

  4. 关于ueditor与arcgis js api同用会报错的问题

    在ueditor与arcgis js api共用时,需要将ueditor\third-party\zeroclipboard\ZeroClipboard.js中的 if (typeof define ...

  5. arcgis js api 本地化配置

    配置arcgis library 根目录的init.js的 "baseUrl:",使其指向正确的地址

  6. Arcgis js API使用wmts方式加载GeoWebCache中的切片地图(转载)

    使用GeoWebCache的主要目的是其独立安装版能够发布arcgis的切片.我们知道,使用openlayer是调用geoserver最方便的方法,那么在发布完arcgis的切片后,怎么用arcgis ...

  7. ArcGIS JS API多线程克里金插值

        最近做关于雨量插值的项目,本来使用后台的GP工具做的,但是处理时间比较长需要十几秒钟左右,所以研究怎么通过前台来计算.     参考下克里金例子,思路是生成要计算区域的100乘以100网格,然 ...

  8. ArcGIS js api 手动构建FeatureLayer

    坐标系 var spatialReference = new SpatialReference(4326);1要素坐标点 var pointArr = [ new Point(116.94431351 ...

  9. ArcGIS JS Api 4.x修改三维球背景技巧

        通过修改scenceview.js中tileBackground和defaultTileBackground中的png的base64编码就可以达到要求. 4.8中通过修改scenceview. ...

随机推荐

  1. C#关于函数重载的坑

    今天在调用被重载的函数时,发现一个问题 private ProductRegisterResponse InitResponse(int code, string message, string pw ...

  2. Java中级知识归纳(四)

    十六.Java内存模型 特点:原子性.可见性.有序性. 原子性:read.load.use.store.write.synchronized关键字保证原子性 可见性:synchronized.vola ...

  3. Delphi对Excel保护操作

    http://www.docin.com/p-378093577.html在金融系统的应用系统中经常需要与Excel交换数据或利用Excel制作报表,但在某些情况下,我们的业务系统要求生成的临时或最终 ...

  4. html跳转,获取get提交参数

    html跳转到html页面,url后面携带参数,可以通过脚本获取到url?test=value地址后的参数. 1.more.html 携带参数跳转到list.html,get提交参数 2.list.h ...

  5. sparkSQL中的example学习(1)

    SparkSQLDemo.scala import org.apache.spark.sql.{Row, SparkSession} import org.apache.spark.sql.types ...

  6. PL/SQL Developer报错 ORA-12154:tns:could not resolve the connect identifier specified

    PL/SQL Developer使用预先配置数据库报错 ORA-12154:tns:could not resolve the connect identifier specified. 情况描述:我 ...

  7. MySQL详细安装(windows)

    一.在MySQL官网上下载MySQL Community Server(目前推荐5.7版本,8.0版本在安装的时候遇到的问题比较多) 点击DOWNLOADS→Community→MySQL Commu ...

  8. Nginx02(环境配置以及基本使用)

    一:Nginx环境配置 反向代理(Reverse Proxy)方式是指以代理服务器来接受internet上的连接请求,然后将请求转发给内部网络上的服务器,并将从服务器上得到的结果返回给internet ...

  9. 关于Apache本地能访问外网不能访问的问题

    title: 关于Apache本地能访问外网不能访问的问题 date: 2018-08-05 19:22:12 tags: web --- 在配置apache和tomcat时,把它们都配置好,放到服务 ...

  10. 201871010121-王方-《面向对象程序开发设计java》第十四周实验总结

    4 项目 内容 这个作业属于哪个课程 https://www.cnblogs.com/nwnu-daizh 这个作业的要求在哪里 https://www.cnblogs.com/nwnu-daizh/ ...