[OpenLayers-Users] anchor point on circumferance of circle vector

Brad Spencer brad at cubewerx.com.au
Tue Mar 3 23:36:25 EST 2009


List,

 

OK I have done it myself so for those interested this is what I had to do:

1.       Determine the radius of the vector circle from the object (used my
own js code here)

2.       Determine the offset in pixels of point on edge of vector circle
(used my own Trig js code)

3.       Set the size and offset parameters for the framedCloud: 

var anchor = {'size': new OpenLayers.Size(0,0), 'offset': new
OpenLayers.Pixel(delX, -delY)}

4.       Add the anchor to the framedCloud on creation: 

                popup = new OpenLayers.Popup.FramedCloud("feature" 

 
,feature.geometry.getBounds().getCenterLonLat()

                                ,null,"<div style='font-size:9px;
height:auto;'><br/>"+feature.attributes.description+" <br/></div>"

                                ,anchor

 ,false ,null);

5.    Make sure all framedClouds are fixed in top right position in
Openlayers Init function:

OpenLayers.Popup.FramedCloud.prototype.fixedRelativePosition = true; 

        OpenLayers.Popup.FramedCloud.prototype.relativePosition = "tr";

 

Cheers, Brad..

 

 

From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] On
Behalf Of Brad Spencer
Sent: Wednesday, March 04, 2009 11:47 AM
To: openlayers users
Subject: [OpenLayers-Users] anchor point on circumferance of circle vector

 

List,

 

I have switched from Markers to Vectors for variable sized (attribute
driven) point symbols and this works fine. I want to drag these 'points' and
I also want to see framecloud popups on a mouseover event (hover) at the
same time. I have got this working but by default the framed cloud pointer
is anchored to the circle centre point. This interferes with the dragging
function so I think a solution is to make sure the framedCloud pointer never
enters the variable sized circle vector.

 

I can get the size of a selected vector point circle in my select feature
function but its not clear to me how to use the offset feature when building
the framedCloud popup. 

 

My onSelectFeature code that is triggered in the selectControl is as
follows:

 

function onFeatureSelect(feature) 

{

                // generate the framedCloud popup

                popup = new OpenLayers.Popup.FramedCloud("feature" 

 
,feature.geometry.getBounds().getCenterLonLat()

                                ,null

                                ,"<div style='font-size:9px;
height:auto;'><br/>"+feature.attributes.description+" <br/></div>"

                                ,null       // >>>>>>    if I have pixel
offsets, what goes in here to anchor the framed cloud???

                                ,false

                                ,null);

                feature.popup = popup;

                map.addPopup(popup);

}

 

Cheers,  Brad.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090304/ba2c07c0/attachment.html


More information about the Users mailing list