-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathfeaturetip.js
57 lines (52 loc) · 1.49 KB
/
featuretip.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**
* Copyright (c) 2008-2012 The Open Source Geospatial Foundation
*
* Published under the BSD license.
* See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text
* of the license.
*/
/** api: example[featuretip]
* Feature Tip
* -------------
* Display a tip tied to the location of a feature.
*/
var mapPanel, featureTip;
Ext.onReady(function() {
// create a vector layer, add a feature into it
var vectorLayer = new OpenLayers.Layer.Vector("vector");
var feature = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point(-45, 5)
);
vectorLayer.addFeatures(feature);
// create Ext window including a map panel
var mapwin = new Ext.Window({
layout: "fit",
title: "Map",
closeAction: "hide",
width: 650,
height: 356,
x: 50,
y: 100,
items: {
xtype: "gx_mappanel",
region: "center",
layers: [
new OpenLayers.Layer.WMS(
"OpenLayers WMS",
"http://vmap0.tiles.osgeo.org/wms/vmap0",
{layers: 'basic'} ),
vectorLayer
]
}
});
mapwin.show();
mapPanel = mapwin.items.get(0);
var bogusMarkup = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.";
featureTip = new GeoExt.FeatureTip({
location: feature,
width: 100,
map: mapPanel.map,
html: bogusMarkup
});
featureTip.show();
});