简体   繁体   English

esri地图显示信息窗口,没有点击地图

[英]esri map display info window without clicking on the map

I'm using the esri map javascipts API. 我正在使用esri map javascipts API。 I want to show a info window on the map. 我想在地图上显示一个信息窗口。 However, in the example given by esri, the user must need to click on the map to show the info window. 但是,在esri给出的示例中,用户必须单击地图才能显示信息窗口。 Because in the example, one of the parameter is the screenPoint, which must be obtained by clicking on the map. 因为在示例中,其中一个参数是screenPoint,必须通过单击地图获取。 Can i just click on a button to show a info window in a specific location? 我可以点击按钮在特定位置显示信息窗口吗? Thanks! 谢谢!

dojo.connect(map.graphics, "onClick", function(evt) {
      var g = evt.graphic;
      map.infoWindow.setContent(g.getContent());
      map.infoWindow.setTitle(g.getTitle());
      map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint));
    });

Yes, the first parameter to the map.infoWindow.show() method is just a screen point location. 是的,map.infoWindow.show()方法的第一个参数只是一个屏幕点位置。 Here's a link to the documentation on the Point object: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/point.htm , which is what you pass in for that parameter. 这是Point对象文档的链接: http//help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/point.htm ,这是您为该参数传递的内容。 For example: new esri.geometry.Point(-118.15, 33.80, map.spatialReference); 例如: new esri.geometry.Point(-118.15, 33.80, map.spatialReference);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM