I'm creating different Layer to draw marker :
function Init(){ markers = new OpenLayers.Layer.Vector("Marker Layer"); selectControl = new OpenLayers.Control.SelectFeature(markers); map.addControl(selectControl); selectControl.activate(); markers.events.on({ 'featureselected': function (feature) { onFeatureSelect(feature); }, 'featureunselected': function (feature) { onFeatureUnselect(feature); } }); map.addLayer(markers); var cluster = new OpenLayers.Layer.Vector("Features"); selectClusterControl = new OpenLayers.Control.SelectFeature(cluster); map.addControl(selectClusterControl); selectClusterControl.activate(); Cluster.events.on({ 'featureselected': onClusterSelect, 'featureunselected': onClusterUnSelect }); map.addLayer(Cluster); } function AddMarker(id, LatLon, bearing, image, toolTipHtml, radius, strlabel) { var popupContentHTM = toolTipHtml ; var themarker; themarker = new OpenLayers.Feature.Vector( LatLon, null, { externalGraphic: image, pointRadius: radius, graphicOpacity: 1, rotation: bearing, label: strlabel, labelYOffset: -20, } ); themarker.PlaneID = id; themarker.data.popupContentHTML = popupContentHTM; markers.addFeatures([themarker]); }Marker created
My Problem:When I click on cluster, featureselected opens PopUp, but when I click on marker, the Popup does not open.
function onFeatureSelect(evt) { feature = evt.feature; popup = new OpenLayers.Popup.FramedCloud("featurePopup", feature.geometry.getBounds().getCenterLonLat(), new OpenLayers.Size(300, 260), feature.data.popupContentHTML, null, true, onPopupClose); feature.popup = popup; popup.feature = feature; map.addPopup(popup); } function openClusterPopup(feature, clusterMarkerList) { var allContents = ""; for (var f = 0, len = clusterMarkerList.length; f < len; f++) { allContents += clusterMarkerList[f].data.popupContentHTML + ""; } allContents += "
"; var popup = new OpenLayers.Popup.FramedCloud("featurePopup", feature.geometry.getBounds().getCenterLonLat(), new OpenLayers.Size(300, 260), allContents, null, true, onPopupClose); feature.popup = popup; popup.feature = feature; map.addPopup(popup); }
أكثر...
function Init(){ markers = new OpenLayers.Layer.Vector("Marker Layer"); selectControl = new OpenLayers.Control.SelectFeature(markers); map.addControl(selectControl); selectControl.activate(); markers.events.on({ 'featureselected': function (feature) { onFeatureSelect(feature); }, 'featureunselected': function (feature) { onFeatureUnselect(feature); } }); map.addLayer(markers); var cluster = new OpenLayers.Layer.Vector("Features"); selectClusterControl = new OpenLayers.Control.SelectFeature(cluster); map.addControl(selectClusterControl); selectClusterControl.activate(); Cluster.events.on({ 'featureselected': onClusterSelect, 'featureunselected': onClusterUnSelect }); map.addLayer(Cluster); } function AddMarker(id, LatLon, bearing, image, toolTipHtml, radius, strlabel) { var popupContentHTM = toolTipHtml ; var themarker; themarker = new OpenLayers.Feature.Vector( LatLon, null, { externalGraphic: image, pointRadius: radius, graphicOpacity: 1, rotation: bearing, label: strlabel, labelYOffset: -20, } ); themarker.PlaneID = id; themarker.data.popupContentHTML = popupContentHTM; markers.addFeatures([themarker]); }Marker created
My Problem:When I click on cluster, featureselected opens PopUp, but when I click on marker, the Popup does not open.
function onFeatureSelect(evt) { feature = evt.feature; popup = new OpenLayers.Popup.FramedCloud("featurePopup", feature.geometry.getBounds().getCenterLonLat(), new OpenLayers.Size(300, 260), feature.data.popupContentHTML, null, true, onPopupClose); feature.popup = popup; popup.feature = feature; map.addPopup(popup); } function openClusterPopup(feature, clusterMarkerList) { var allContents = ""; for (var f = 0, len = clusterMarkerList.length; f < len; f++) { allContents += clusterMarkerList[f].data.popupContentHTML + ""; } allContents += "
"; var popup = new OpenLayers.Popup.FramedCloud("featurePopup", feature.geometry.getBounds().getCenterLonLat(), new OpenLayers.Size(300, 260), allContents, null, true, onPopupClose); feature.popup = popup; popup.feature = feature; map.addPopup(popup); }
أكثر...