<HTML><HEAD>
<META content="text/html; charset=ISO-8859-1" http-equiv=Content-Type></HEAD>
<BODY dir=ltr bgColor=#ffffff text=#000000>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
<DIV>Hi</DIV>
<DIV> </DIV>
<DIV>The code is below.</DIV>
<DIV> </DIV>
<DIV>The problem is that after a pan or zoom the onSelect function of the
SelectFeature is no longer called. DragFeature still works.</DIV>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV style="FONT: 10pt tahoma">
<DIV><FONT size=3 face=Calibri></FONT> </DIV>
<DIV><FONT size=3 face=Calibri></FONT> </DIV>
<DIV><script
src="@Url.Content("~/Scripts/OpenLayers/OpenLayers.debug.js")"></script></DIV>
<DIV> </DIV>
<DIV><script></DIV>
<DIV> </DIV>
<DIV> var map;</DIV>
<DIV> var groundPLan;</DIV>
<DIV> var icon;</DIV>
<DIV> var markers;</DIV>
<DIV> var clickedMarker = null;</DIV>
<DIV> </DIV>
<DIV> function init() {</DIV>
<DIV> </DIV>
<DIV> groundPLan = new
OpenLayers.Layer.XYZ(</DIV>
<DIV>
'GroundPlan',</DIV>
<DIV>
'@Url.Content("~/Maps/" + ViewBag.Id)/${z}/${x}/${y}.jpg',</DIV>
<DIV> {</DIV>
<DIV>
attribution: "© Limotec",</DIV>
<DIV>
sphericalMercator: false,</DIV>
<DIV>
wrapDateLine: false,</DIV>
<DIV>
transitionEffect: 'resize',</DIV>
<DIV>
buffer: 1,</DIV>
<DIV>
numZoomLevels: 5</DIV>
<DIV> }</DIV>
<DIV> );</DIV>
<DIV> </DIV>
<DIV> map = new
OpenLayers.Map('map_canvas', { controls: [] });</DIV>
<DIV> map.addLayer(groundPLan);</DIV>
<DIV> map.addControl(new
OpenLayers.Control.Attribution());</DIV>
<DIV> map.addControl(new
OpenLayers.Control.Navigation({ dragPanOptions: { enableKinetic: true}
}));</DIV>
<DIV> map.setCenter(new
OpenLayers.LonLat(0, 0), 2);</DIV>
<DIV> </DIV>
<DIV> map.div.oncontextmenu = function
noContextMenu(e) {</DIV>
<DIV> var
lonlat = map.getLonLatFromPixel(new OpenLayers.Pixel(e.layerX, e.layerY));</DIV>
<DIV>
$("#lat").val(lonlat.lon);</DIV>
<DIV>
$("#lng").val(lonlat.lat);</DIV>
<DIV>
$("#detList").dialog("open");</DIV>
<DIV> return
false;</DIV>
<DIV> };</DIV>
<DIV> </DIV>
<DIV> var renderer =
OpenLayers.Util.getParameters(window.location.href).renderer;</DIV>
<DIV> renderer = (renderer) ?
[renderer] : OpenLayers.Layer.Vector.prototype.renderers; </DIV>
<DIV> </DIV>
<DIV> markers = new
OpenLayers.Layer.Vector("Markers",</DIV>
<DIV> {</DIV>
<DIV>
renderOptions: { yOrdering: true },</DIV>
<DIV>
renderers: renderer</DIV>
<DIV> }</DIV>
<DIV> );</DIV>
<DIV> map.addLayer(markers);</DIV>
<DIV> </DIV>
<DIV> var dragFeature = new
OpenLayers.Control.DragFeature(markers);</DIV>
<DIV> dragFeature.onComplete =
function (feature, pixel) {</DIV>
<DIV> var id =
feature.geometry.id;</DIV>
<DIV> id =
id.replace('Det_', '');</DIV>
<DIV> </DIV>
<DIV> var
lonLat = map.getLonLatFromPixel(pixel);</DIV>
<DIV>
$.post(</DIV>
<DIV>
'@Url.Action( "MoveDet", "Api" )',</DIV>
<DIV>
{ id: id, lat: lonLat.lon, lng: lonLat.lat }</DIV>
<DIV> );</DIV>
<DIV> }</DIV>
<DIV>
map.addControl(dragFeature);</DIV>
<DIV> dragFeature.activate();</DIV>
<DIV> </DIV>
<DIV> var clickFeature = new
OpenLayers.Control.SelectFeature(markers);</DIV>
<DIV>
clickFeature.handlers.feature.stopDown = false;</DIV>
<DIV> clickFeature.onSelect = function
(feature) {</DIV>
<DIV> var id =
feature.geometry.id;</DIV>
<DIV> id =
id.replace('Det_', '');</DIV>
<DIV>
$.post('@Url.Action("GetDetectorById", "Api")',</DIV>
<DIV>
{ detId: id },</DIV>
<DIV>
function (data) {</DIV>
<DIV>
if (data.Id != null) {</DIV>
<DIV>
clickedMarker = feature;</DIV>
<DIV>
$("#lat").val(data.X);</DIV>
<DIV>
$("#lng").val(data.Y);</DIV>
<DIV>
OpenDetector(data.Id, data.InTest, data.InService, data.Name);</DIV>
<DIV>
} else {</DIV>
<DIV>
alert(data);</DIV>
<DIV>
}</DIV>
<DIV>
}</DIV>
<DIV> );</DIV>
<DIV> }</DIV>
<DIV> </DIV>
<DIV>
map.addControl(clickFeature);</DIV>
<DIV> clickFeature.activate();</DIV>
<DIV> }</DIV>
<DIV> </DIV>
<DIV> function SetMarkerIcon(det, type) {</DIV>
<DIV> var lat =
parseFloat(det.Lat);</DIV>
<DIV> var lng =
parseFloat(det.Lng);</DIV>
<DIV> var id = "";</DIV>
<DIV> if (type != "optical") {</DIV>
<DIV> id =
"fire_" + det.Id;</DIV>
<DIV> } else {</DIV>
<DIV> id =
"detIcon_" + det.Id;</DIV>
<DIV> }</DIV>
<DIV> </DIV>
<DIV> var marker = new
OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(lat, lng));</DIV>
<DIV> marker.style = {</DIV>
<DIV>
externalGraphic: '@Url.Content("~/Images/Icons/Optical.png")',</DIV>
<DIV>
graphicOpacity: 1.0,</DIV>
<DIV>
graphicWidth: 30,</DIV>
<DIV>
graphicHeight: 30,</DIV>
<DIV>
graphicYOffset: -15,</DIV>
<DIV>
graphicXOffset: -15,</DIV>
<DIV> cursor:
'pointer',</DIV>
<DIV> </DIV>
<DIV>
backgroundGraphic: '@Url.Content("~/Images/Icons/Optical_Shadow.png")',</DIV>
<DIV>
backgroundXOffset: -12,</DIV>
<DIV>
backgroundYOffset: -12,</DIV>
<DIV> </DIV>
<DIV>
graphicZIndex: 11,</DIV>
<DIV>
backgroundGraphicZIndex: 10</DIV>
<DIV> }</DIV>
<DIV> marker.url =
'@Url.Action("MoveDet", "Api")';</DIV>
<DIV> marker.geometry.id = "Det_" +
det.Id;</DIV>
<DIV>
markers.addFeatures(marker); </DIV>
<DIV> }</DIV>
<DIV> </DIV>
<DIV> $(document).ready(function () {</DIV>
<DIV> init();</DIV>
<DIV> });</DIV>
<DIV> </DIV>
<DIV></script></DIV>
<DIV> </DIV>
<DIV><FONT size=3 face=Calibri>greetings</FONT></DIV>
<DIV><FONT size=3 face=Calibri>Ruben</FONT></DIV>
<DIV><FONT size=3 face=Calibri></FONT> </DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=adube@mapgears.com
href="mailto:adube@mapgears.com">Alexandre Dubé</A> </DIV>
<DIV><B>Sent:</B> Friday, August 17, 2012 2:53 PM</DIV>
<DIV><B>To:</B> <A title=openlayers-users@lists.osgeo.org
href="mailto:openlayers-users@lists.osgeo.org">openlayers-users@lists.osgeo.org</A>
</DIV>
<DIV><B>Subject:</B> Re: [OpenLayers-Users] SelectFeature and
navigation</DIV></DIV></DIV>
<DIV> </DIV></DIV>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV class=moz-cite-prefix>Hi Ruben,<BR><BR> Would you please provide more
details, like a live short demo showing the issue or paste some code ? The
SelectFeature control doesn't deactivates itself after a pan or zoom, so we need
to find out why it does in your case.<BR><BR> To help you find out what
the issue is, you can minimize your code step by step. This nice article
mentions a lot about this, I'd suggest you read it first :<BR>
<A class=moz-txt-link-freetext
href="http://docs.openlayers.org/help/minimize.html">http://docs.openlayers.org/help/minimize.html</A><BR><BR>Best
regards,<BR><BR>Alexandre<BR><BR><BR>On 12-08-17 04:27 AM, <A
class=moz-txt-link-abbreviated
href="mailto:ontwerp@limotec.be">ontwerp@limotec.be</A> wrote:<BR></DIV>
<BLOCKQUOTE cite=mid:7E7EA4AA322E4F38BFA5BD78582E305E@OntwerpPC021
type="cite"><DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
<DIV>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">Hello</DIV>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
<DIV style="FONT-FAMILY: ; COLOR: ">
<DIV> </DIV>
<DIV>When the map is loaded the selectfeature works, but after a pan or zoom
it doesn’t. It seems that the selectfeature is deactivated after pan or
zoom.</DIV>
<DIV>Is there a way to reactivate the selectfeature after a pan or zoom?</DIV>
<DIV> </DIV>
<DIV>greetings</DIV>
<DIV>Ruben</DIV></DIV></DIV></DIV></DIV></DIV></DIV><BR>
<FIELDSET class=mimeAttachmentHeader></FIELDSET> <BR><PRE wrap="">_______________________________________________
Users mailing list
<A class=moz-txt-link-abbreviated href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</A>
<A class=moz-txt-link-freetext href="http://lists.osgeo.org/mailman/listinfo/openlayers-users">http://lists.osgeo.org/mailman/listinfo/openlayers-users</A>
</PRE></BLOCKQUOTE><BR><BR><PRE class=moz-signature cols="72">--
Alexandre Dubé
Mapgears
<A class=moz-txt-link-abbreviated href="http://www.mapgears.com">www.mapgears.com</A>
</PRE>
<P>
<HR>
_______________________________________________<BR>Users mailing
list<BR>Users@lists.osgeo.org<BR>http://lists.osgeo.org/mailman/listinfo/openlayers-users<BR></DIV></DIV></DIV></BODY></HTML>