arcgis for js symbol图标的变化

需求是图标有hover效果 ,如下

     

 

思路 :

1、创建图片标记,并赋值;

 
  
   args.rendererArgs = new RenderArgs();
    args.rendererArgs.type = RenderType.CLASSBREAKS;
    args.rendererArgs.attributeField = "value";


var
symbolNormal = new PictureMarkSymbolArgs(); symbolNormal.url = getMapImageIcon(remoteMeterName,"0"); symbolNormal.height = 40; symbolNormal.width = 40; symbolNormal.xoffset = 0; symbolNormal.yoffset = 0; args.rendererArgs.symbols.push(symbolNormal); var symbolNormalFocus = new PictureMarkSymbolArgs(); symbolNormalFocus.url = getMapImageIcon(remoteMeterName,"1"); symbolNormalFocus.height = 40; symbolNormalFocus.width = 40; symbolNormalFocus.xoffset = 0; symbolNormalFocus.yoffset = 0; args.rendererArgs.symbols.push(symbolNormalFocus); var symbolNormalLight = new PictureMarkSymbolArgs(); symbolNormalLight.url = getMapImageIcon(remoteMeterName, "2"); //正常高亮图标 symbolNormalLight.height = 40; symbolNormalLight.width = 40; args.rendererArgs.symbols.push(symbolNormalLight); var symbolAlarmLight = new PictureMarkSymbolArgs(); symbolAlarmLight.url = getMapImageIcon(remoteMeterName, "3"); //报警高亮图标 symbolAlarmLight.height = 40; symbolAlarmLight.width = 40; args.rendererArgs.symbols.push(symbolAlarmLight); args.rendererArgs.values.push(0); args.rendererArgs.values.push(0.9); args.rendererArgs.values.push(1.9); args.rendererArgs.values.push(2.9); args.rendererArgs.values.push(3.9);

 

2、在创建图层的时候写入mouse-over事件,并修改移入时的velue值;并刷新图层;完成。

 
  
layer.on("mouse-over", lang.hitch(this, function (evt) {
  dijitPopup.close(dialog);
  var g = evt.graphic;
if(g.attributes.value=="0"){
   g.attributes.value = "2";
   layer.refresh();
}else if(g.attributes.value=="1"){
   g.attributes.value = "3";
   layer.refresh();
}
}))

 

转载于:https://www.cnblogs.com/liyiyy/p/10419244.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值