OpenLayers实现覆盖物选择信息提示
var map; function init() {
map = new OpenLayers.Map("map",{projection:"EPSG:3857"}); var osm = new OpenLayers.Layer.OSM();
var toMercator = OpenLayers.Projection.transforms['EPSG:4326']['EPSG:3857'];
var center = toMercator({x:-0.05,y:51.5}); /**
* Create 5 random vector features. Your features would typically be fetched
* from the server. The features are given an attribute named "foo".
* The value of this attribute is an integer that ranges from 0 to 100.
*/
var features = [];
for(var i = 0; i < 5; i++) {
features[i] = new OpenLayers.Feature.Vector(
toMercator(new OpenLayers.Geometry.Point(
-0.040 - 0.05*Math.random(),
51.49 + 0.02*Math.random())),
{
foo : 100 * Math.random() | 0
}, {
fillColor : '#008040',
fillOpacity : 0.8,
strokeColor : "#ee9900",
strokeOpacity : 1,
strokeWidth : 1,
pointRadius : 8
});
} // create the layer with listeners to create and destroy popups
var vector = new OpenLayers.Layer.Vector("Points",{
eventListeners:{
'featureselected':function(evt){
var feature = evt.feature;
var popup = new OpenLayers.Popup.FramedCloud("popup",
OpenLayers.LonLat.fromString(feature.geometry.toShortString()),
null,
"<div style='font-size:.8em'>Feature: " + feature.id +"<br>Foo: " + feature.attributes.foo+"</div>",
null,
true
);
feature.popup = popup;
map.addPopup(popup);
},
'featureunselected':function(evt){
var feature = evt.feature;
map.removePopup(feature.popup);
feature.popup.destroy();
feature.popup = null;
}
}
});
vector.addFeatures(features); // create the select feature control
var selector = new OpenLayers.Control.SelectFeature(vector,{
hover:true,
autoActivate:true
}); map.addLayers([osm, vector]);
map.addControl(selector);
map.setCenter(new OpenLayers.LonLat(center.x,center.y), 13);
}
OpenLayers实现覆盖物选择信息提示的更多相关文章
- jQuery制作信息提示弹出层插件【推荐】
给大家分享一款非常实用的弹窗提示窗口插件,包含多种模式.带有回执函数值的功能.1. [代码][JavaScript]代码 <script type="text/javascript& ...
- jNotify:操作结果信息提示条
我们在提交表单后,通过Ajax响应后台返回结果,并在前台显示返回信息,jNotify能非常优雅的显示操作结果信息.jNotify是一款基于jQuery的信息提示插件,它支持操作成功.操作失败和操作提醒 ...
- HubSpot – 网站开发必备的 jQuery 信息提示库
HubSpot 一款功能丰富的 jQuery 消息提示插件.它可以帮助你个性化显示您的应用程序的事务性消息.您可以轻松地包裹 Ajax 请求进度,成功和错误消息,还可以添加操作链接到您的消息中. Hu ...
- jQuery信息提示工具jquery.poshytip (转载)
转载地址:http://www.helloweba.com/view-blog-123.html Poshy Tip是一款非常友好的信息提示工具,它基于jQuery,当鼠标滑向链接时,会出现一个信息提 ...
- php--validate错误信息提示样式
//validate 错误信息提示样式 可以提示错误信息 可以使用jq 自带的属性改变错误的显示的位置,其中element是验证未通过的当前表单元素,error为错误后的提示信息 [注意]:放的位 ...
- 在ecshop顶部会员信息提示区显示会员等级
会员登陆后,在顶部会员信息提示区显示会员等级会员登陆后会在顶部出现这样的提示:您好,test2, 欢迎您回来 ! 进入用户中心 |退出现在设想在会员名后面加上“会员等级”效果如下:您好,test2, ...
- 一款jQuery打造的滚动条在底部滑出信息提示层
一款jQuery打造的滚动条在底部滑出信息提示层, 当滚动鼠标滚轮,或者滚动条往下拉的时候,在右下角,弹出一个信息提示框. 有一点仿的是一个插件工具,就是网页中大家都长用到的友荐. 这款特效算一款简单 ...
- IIS 之 HTTP错误信息提示
一.HTTP返回码 [1]1xx - 信息提示 这些状态代码表示临时的响应.客户端在收到常规响应之前,应准备接收一个或多个 1xx 响应. a. 100 - 继续. b. 101 - 切换协议. [2 ...
- Ext信息提示对话框
Ext.window.MessageBox是一个工具类,他继承自Ext.window.Windoe对象,用来生成各种风格的信息提示对话框,其实例对象可以通过Ext.MessageBox或Ext.Msg ...
随机推荐
- 【转】ARM交叉编译工具链
原文网址:http://www.veryarm.com/cross-tools 为什么要用交叉编译器? 交叉编译通俗地讲就是在一种平台上编译出能运行在体系结构不同的另一种平台上的程序,比如在PC平台( ...
- C语言中指针的指针是如何工作的?
我们有时看到这样地饿代码: int *ptr = &x; 这里,ptr是一个指向x在内存中的地址的指针. 假设有另外一条语句是这样地的: int **ptr2 = &ptr; 我们 ...
- Curvy unity
想获得当前物体在路径的进度 1. 利用CurvySpline.GetNearestPointTF(); 2. 利用CurvyController.RelativePosition;
- java面试题集1
一:单选题 下列哪一种叙述是正确的(D )A. abstract修饰符可修饰字段.方法和类B. 抽象方法的body部分必须用一对大括号{ }包住C. 声明抽象方法,大括号可有可无D. 声明抽象方法不可 ...
- Java程序员面试题集(136-150)(转)
转:http://blog.csdn.net/jackfrued/article/details/17740651 Java程序员面试题集(136-150) 摘要:这一部分主要是数据结构和算法相关的面 ...
- Swift继承的用法
一个类可以继承另一个类的方法,属性和其它特性.当一个类继承其它类,继承类叫子类,被继承类叫超类(或父类).在Swift中,继承是区分「类」与其它类型的一个基本特征. 在Swift中,类可以调用和访问超 ...
- hdu 4930 Fighting the Landlords--2014 Multi-University Training Contest 6
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4930 Fighting the Landlords Time Limit: 2000/1000 MS ...
- 分类: LINUX apache 访问设置配置
分类: LINUX 在一次面试的时候被问到apache访问控制的问题.由于以前对apache的访问控制都是通过iptalbes来实现的,没有实际在apache上操作过访问控制.所以只知道个大概: 在主 ...
- 消除多余的row
tableviewName.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero];
- 使用SignalR和SQLTableDependency跟踪数据库中记录的变动
原文地址:查看 SqlTableDependency是一个组件用来接收数据库的通知,包含在数据表上该记录的值的Inserted.Deleted或者Update操作. 备注:原文提供示例代码下载,但是j ...