[OpenLayers-Dev] Patrch for getting vector drawing working over the 180 line going.

Andreas Hocevar ahocevar at opengeo.org
Mon Aug 16 03:37:11 EDT 2010


Hi,

On Aug 16, 2010, at 07:05 , Phil Scadden wrote:

> Okay, I have worked away at doing this in the renderer (drawfeature). I 
> have hit another problem with this approach.  Suppose you have 180 line 
> down the middle. Draw an object on the right hand side. 
> geometry.getBounds returns bounds in terms of negative no. (the 
> underlying longs are negative going into the projection). However the 
> extent of the viewport, (used in  if 
> (!bounds.intersectsBounds(this.extent)) ) has the right hand side in 
> positive coordinates. The net result is that nothing is visible until 
> you add a point on the left hand side of the date line and suddenly all 
> is visible.
> 
> Now - should I fix intersectBounds to handle a much more complicated 
> case and then get bounds in same coord.

The part of drawFeature that determines whether features should be drawn or not according to intersectBounds will have to be rewritten anyway, because it keeps point features at the edge of the viewport from being drawn if their center is outside the viewport.

> Or should I convert the bounds 
> to consistant coordinates first (my choice)?

Sounds good.

> I am still not sure that 
> doing this in the renderer rather than in path.js, polyon.js is the 
> right thing.

I am. Fixing this in the handlers won't help for features that cross the date line that come e.g. from a WFS, because there you will likely have coordinates that don't exceed the world extent.

> I also have to modify the measure controls which dont 
> handle coordinates jumping from positive to negative and back very well.

In Spherical Mercator, you get this for free if you configure the measure controls with geodesic: true.

Regards,
Andreas.

> 
> -- 
> Phil Scadden, Senior Scientist GNS Science Ltd 764 Cumberland St, 
> Private Bag 1930, Dunedin, New Zealand Ph +64 3 4799663, fax +64 3 477 5232
> 
> Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.
> 
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev

-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.




More information about the Dev mailing list