PictureMarkerSymbol是将点渲染成照片,效果如图:
核心代码如下:
1 featureLayer.on("mouse-over",function(evt){ 2 var point = evt.graphic.geometry; 3 var pictureSymbol; 4 switch (evt.graphic.attributes.TENDERTYPEID) { 5 case "1": 6 { 7 pictureSymbol = new PictureMarkerSymbol("/Images/blue.png", 40, 40); 8 break; 9 } 10 case "2": 11 { 12 pictureSymbol = new PictureMarkerSymbol("/Images/green.png", 40, 40); 13 break; 14 } 15 case "3": 16 { 17 pictureSymbol = new PictureMarkerSymbol("/Images/purple.png", 40, 40); 18 break; 19 } 20 case "4": 21 { 22 pictureSymbol = new PictureMarkerSymbol("/Images/red.png", 40, 40); 23 break; 24 } 25 default : 26 { 27 pictureSymbol = new PictureMarkerSymbol("/Images/yellow.png", 40, 40); 28 break; 29 } 30 } 31 var graphic = new Graphic(point,pictureSymbol); 32 pictureGraphicLayer.add(graphic); 33 });
代码显示效果为:鼠标移过图片后,显示放大图
时间: 2024-10-18 04:07:44