[OpenLayers-Users] popup hidden when goes on sides of viewport

Eric Lemoine eric.c2c at gmail.com
Sat May 17 15:38:15 EDT 2008


Kusum,

I couldn't quite read your code, formatting was too bad. Anyway, I've
created an example showing that you can name markers and get that name
when the mouse goes over the markers. See attached file. Just drop
that file into OpenLayers' example dir and it should work.

Hope this helps,

--
Eric

On Sat, May 17, 2008 at 9:40 AM, Kusum <kusum at infobase.in> wrote:
> Dear Eric,
>
> I am into great fuss over here
>
> The pop up id does not work coz popup is made afterwards
>
> I may need to use marker name or something
>
> The clear situation is something as this:-
>
> I am making a feature in which a user can mark a point on map,add photos
>
> the user marks the point, enters name , uploads images
>
> then on mouse over the marker the images are fetched using name entered
> above from folder of that name
>
> then user marks second popup,enters name,uploads images
>
> now when user takes cursor on this pop up new images are fetched using new
> name entered
>
> Now the problem
>
> When user takes cursor to first popup , it shows images of second pop up coz
> name value is changed
> and its using changed name value to fetch images.
>
> I tried to use markers layer id instead of name but it also changes every
> time....
>
> if I try to set this.markers.name above
>
>  markers.events.register('mouseover', markers, function(evt) {
>
>
> Nd then try to use this.markers.name after this code to fetch images it says
> this.markers.name is undefined....
>
>
>
>  map.events.register("click", map, function(e) {
>                 var lonlat = map.getLonLatFromViewPortPx(e.xy);
>                 var maplat = lonlat.lat;
>                 var maplon=lonlat.lon ;
>
>                 //document.getElementById("lati").value=maplat;
>                 //document.getElementById("long").value=maplon;
>                 var markers = new OpenLayers.Layer.Markers( "Markers" );
>                 map.addLayer(markers);
>             var size = new OpenLayers.Size(33,28);
>                 var offset = new OpenLayers.Pixel(-(size.w), -size.h);
>
>                 var icon = new
> OpenLayers.Icon('http://localhost/maplab/interactive-maps/img/poi.gif',size,offset);
> var marker =new OpenLayers.Marker(new OpenLayers.LonLat(maplon,maplat),icon)
>     markers.addMarker(marker);
>
>  var name=prompt("Name","")
> marker.id=name;
>  alert(marker.id);
> var p =prompt ("Desc","")
> var answer = confirm("Do u want to upload any images?")
> if (answer){
> var pwin =
> window.open("test.php?name="+name,"test","width=300,height=180,status=no,resizable=no");
> }
> var bbc="";
>
> imagestr="<img width=100px height=100px src='images/"+name+"/";
>   markers.events.register('mouseover', markers, function(evt) {
>   var pin=new OpenLayers.Control.MousePosition({prefix: 'Lon: ', separator:
> ' Lat:'})
>   alert(pin);
>   returnimages(marker.id); //This function fetches images with name sent of
> folder but id of marker changes each time name changes above)
>
>
>    var check = document.getElementById('check_bol').value;
>    alert(check);
>
> if(check){
> var string_result = document.getElementById('string');//(final images string
> fetched)
>   bbc=string_result.value;
> alert(bbc);
>   feature = new OpenLayers.Feature(layer,new
> OpenLayers.LonLat(maplon,maplat));
> var coord = new OpenLayers.LonLat(maplon,maplat);
>     var si = new OpenLayers.Size(240,410);
> imagestr_final=bbc;
> var link ="<a href='javascript:onPopupClose(name);' >Refresh Images</a>";
> var temp ="<br><b><u>"+name+"</u></b><BR><BR><b>Description:-</b><FONT
> type=verdana
> size=3>"+p+"</font><br><br>"+imagestr_final+"<br>"+link+"<br><br><br><br>";
>               // popup = new OpenLayers.Popup("pof",coord,si,temp,true
> ,{autoSize:true},{panMapIfOutOfView:true});
>     popup = new OpenLayers.Popup.FramedCloud(name,coord,si,temp,null, true);
> popup.setContentHTML(temp);
>                 map.addPopup(popup);
> document.getElementById('check_bol').value="false";
> }
>
> });
> /*markers.events.register('mouseout', markers, function(evt)
> {markers.map.removePopup(popup);
>                 popup.destroy();
>                 popup = null;
>
> }); */
>
>
>        });
>
>
> Pls suggest something....
>
> Regards
> Kusum
>
>
> --------------------------------------------------
> From: "Eric Lemoine" <eric.c2c at gmail.com>
> Sent: Saturday, May 17, 2008 3:33 AM
> To: "Kusum" <kusum at infobase.in>
> Cc: "Christopher Schmidt" <crschmidt at metacarta.com>; "Openlayers Users"
> <users at openlayers.org>
> Subject: Re: [OpenLayers-Users] popup hidden when goes on sides of viewport
>
>> On Thu, May 15, 2008 at 2:21 PM, Kusum <kusum at infobase.in> wrote:
>>> Dear all
>>>
>>> I am caught in a very difficult situation. In my application the user
>>> marks
>>> a point on map and enters description to the point.
>>> Aslo uploads photos.
>>> a folder is made into which the uploaded photos go and then I fetch the
>>> string for all photos in folder.
>>> And then the description and photos are seen in popup.
>>> But if the user marks a second point and uploads other photos in other
>>> folder and then sees the popup.
>>> In second popup new photos are seen but then photos of first popup also
>>> change as now they start using the new fetched image string for new
>>> popup.
>>>
>>> Isn't there an id corresponding each FramedCloud popup that I can assign
>>> and
>>> later use to fetch photos corresponding to it.
>>
>> If you pass null as the first arg to the popup constructor, OL will
>> create a popup id for you which you can refer to using popup.id. Would
>> that help?
>>
>> --
>> Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080517/66adfb36/named-markers.html


More information about the Users mailing list