diff --git a/examples/featuretip.html b/examples/featuretip.html new file mode 100644 index 00000000..6f9e91e7 --- /dev/null +++ b/examples/featuretip.html @@ -0,0 +1,29 @@ + +
+Shows an Ext.Tip which is tied to a feature's geometry. + The js is not minified so it is readable. See featuretip.js.
+ + + diff --git a/examples/featuretip.js b/examples/featuretip.js new file mode 100644 index 00000000..e22327e7 --- /dev/null +++ b/examples/featuretip.js @@ -0,0 +1,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(); +}); diff --git a/lib/GeoExt.js b/lib/GeoExt.js index 64ff68f2..192d9c46 100644 --- a/lib/GeoExt.js +++ b/lib/GeoExt.js @@ -96,6 +96,7 @@ "GeoExt/widgets/tips/SliderTip.js", "GeoExt/widgets/tips/LayerOpacitySliderTip.js", "GeoExt/widgets/tips/ZoomSliderTip.js", + "GeoExt/widgets/tips/FeatureTip.js", "GeoExt/widgets/tree/LayerNode.js", "GeoExt/widgets/tree/TreeNodeUIEventMixin.js", "GeoExt/plugins/TreeNodeComponent.js", diff --git a/lib/GeoExt/widgets/tips/FeatureTip.js b/lib/GeoExt/widgets/tips/FeatureTip.js new file mode 100644 index 00000000..e487d4e6 --- /dev/null +++ b/lib/GeoExt/widgets/tips/FeatureTip.js @@ -0,0 +1,102 @@ +/** + * 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: (define) + * module = GeoExt + * class = FeatureTip + * base_link = `Ext.Tip