I was just writing this off the cuff & got some of the CSS3 values wrong.
I have an example that uses CSS3 [1] and another that uses img divs and works 
in IE6 [2]

[1] http://kestrelcomputer.com/linetest.html
[2] http://kestrelcomputer.com/linetest_ie.html

Matt Priour
Kestrel Computer Consulting

From: Matt Priour 
Sent: Tuesday, October 26, 2010 6:37 PM
To: Òscar Vidal Calbet ; [email protected] 
Subject: Re: [Users] Dynamic line between point and pop-up


This an interesting problem, one which we have explored somewhat but never 
implemented.
CSS3 supporting browsers give you some nice possibities.
1. Anchor a div on one corner to the popup and on the other corner, the vector 
feature. Use a CSS background property for the div that includes an background 
image and background size with 'stretch stretch' or the actual pixel height 
width values.
2. Use a narrow div of variable height that you stretch and rotate to stay 
anchored to the popup

However, these are really just trying to mimic something that is already easily 
accomplished in Canvas, SVG, or VML. You could code the vector graphic 
yourself, OR just use the vector drawing API already implemented in OpenLayers.
What I would do is to add a linear feature in the vector layer you are already 
using.
You could create the vector feature and make it a property of the popup in the 
popup's afterrender event handler and then just reposition it in the move event 
handler.

for example here is a totally untested afterrender event handler, the move 
event handler could be somewhat similar:

//assumes that you set a vector feature as the location config option for the 
popup
onPopupRender(popup){
    var lyr = popup.location.layer;
    var cmpBox = popup.getBox();
    var brPopPixel = new 
OpenLayers.Pixel(cmpBox.x+cmpBox.width,cmpBox.y+cmpBox.height);
    var anchor = new OpenLayers.Feature.Vector(new 
OpenLayers.Geometry.LineString([lyr.getLonLatFromViewPortPx(brPopPixel),popup.location.geometry.getCentroid()]));
    lyr.addFeatures([anchor]);
    popup.anchor = anchor;
}

Matt Priour
Kestrel Computer Consulting



From: Òscar Vidal Calbet 
Sent: Tuesday, October 26, 2010 1:07 PM
To: [email protected] 
Subject: [Users] Dynamic line between point and pop-up


Hey everybody, 


I'm looking for some help



I'm new working with GeoExt, and I have a need that I don't know if GeoExt can 
resolve.


I want show a map where you can find different entities represented by points 
and lines. The user have to be allowed to make identify for each entity and 
have open several pop-up at the same time. The aims is that the user have to be 
allowed to move all the pop-up of the screen in a free way, but I don't want 
lost the reference between the pop-up and the entity, so I need show a dynamic 
line between the pop-up and the entity


thanks in advance,
Oscar 


sorry for my poor english






--------------------------------------------------------------------------------


_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Reply via email to