hi, there you have the same problem: point-vectors stays as they are -without stretching/resizing.<div><br></div><div>i just find the solution:</div><div><br></div><div><div> function createCircle(lat, lon, radius){</div>
<div> polygonLayer.removeFeatures(polygonLayer.features);</div><div> var style = {</div><div> fillColor: '#ff0000',</div><div> strokeWidth: 1,</div><div>
pointRadius: radius, // in map coordinates</div><div> </div><div> };</div><div><br></div><div><br></div><div> var point = new OpenLayers.Geometry.Point(lat, lon);</div>
<div> var polygonFeature = OpenLayers.Geometry.Polygon.createRegularPolygon(point,radius,30,0);</div><div> var feature = new OpenLayers.Feature.Vector(polygonFeature,null, style); </div><div><br>
</div><div> </div><div> polygonLayer.addFeatures([feature]);</div><div> polygonLayer.setOpacity(0.5);</div><div><br></div><div><br></div><div> }</div><br><div class="gmail_quote">
2009/12/17 Ivan Grcic <span dir="ltr"><<a href="mailto:igrcic@gmail.com">igrcic@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi, cant you make something like this:<br>
<a href="http://openlayers.org/dev/examples/styles-context.html" target="_blank">http://openlayers.org/dev/examples/styles-context.html</a><br>
<div><div></div><div class="h5"><br>
On Thu, Dec 17, 2009 at 10:34 AM, Mehmet Sirin <<a href="mailto:m.sirin07@googlemail.com">m.sirin07@googlemail.com</a>> wrote:<br>
> hi,<br>
> since there isn't a buffer function integrated in openlayers i have to find<br>
> other ways to simulate buffering a point and displaying it:<br>
><br>
> function pointBuffer(lat, lon, radius,color){<br>
> polygonLayer.removeFeatures(polygonLayer.features);<br>
> var style = {<br>
> fillColor: '#ff0000',<br>
> strokeWidth: 1,<br>
> pointRadius: radius, // in pixels<br>
><br>
> };<br>
><br>
><br>
> var point = new OpenLayers.Geometry.Point(lat, lon);<br>
> var feature = new OpenLayers.Feature.Vector(point,null,<br>
> style);<br>
><br>
> polygonLayer.addFeatures([feature]);<br>
> polygonLayer.setOpacity(0.5);<br>
><br>
> }<br>
><br>
> ---------------------------------------------------------------------------------------------------------------<br>
> ...<br>
> var lonlat1=new<br>
> OpenLayers.LonLat(parseInt(radius),0);<br>
> var lonlat2=new<br>
> OpenLayers.LonLat(parseInt(radius*2),0);<br>
> var<br>
> pixel1=map.getLayerPxFromLonLat(lonlat1);<br>
> var<br>
> pixel2=map.getLayerPxFromLonLat(lonlat2);<br>
><br>
><br>
> var dist=<br>
> Math.abs(parseInt(pixel2.x)-parseInt(pixel1.x));<br>
><br>
><br>
> createCircle(x,y,dist);<br>
><br>
> --------------------------------------------------------------------------------------------------------------<br>
> It works fine, but now the problem:<br>
> When zooming in or out the point feature won't resize -that means it does<br>
> not changes. the pixel size/radius is the same in every zoom level.<br>
> for solving this, i thought of creating a linearring and then a polygon, of<br>
> which i know that will automatically resize with zooming.<br>
> i tried:<br>
> var linearRing = new OpenLayers.Geometry.LinearRing(point); //just one point<br>
> var polygonFeature = new OpenLayers.Feature.Vector(<br>
> new OpenLayers.Geometry.Polygon([linearRing]),null, style);<br>
> but seems not to work..<br>
><br>
><br>
> anybody can help?<br>
><br>
> regards<br>
> m.sirin<br>
</div></div>> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>
> <a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
><br>
><br>
<br>
<br>
<br>
--<br>
<font color="#888888">Ivan Grcic<br>
</font></blockquote></div><br></div>