[Dev] [OpenLayers-Dev] Re: Vectors in OpenLayers?

Pierre GIRAUD bluecarto at gmail.com
Sat Oct 14 16:02:42 EDT 2006


I wanna propose you some peace of code for this.
Hope you'll be able to have a quick look and check if I'm the good way.

I tried to follow the "factory" pattern, but I'm not sure I
implemented it right considering the rest of the architecture.

Regards and nice week-end

Pierre

ps : this code might be useable in the current vector sandbox

On 10/13/06, Pierre GIRAUD <bluecarto at gmail.com> wrote:
> I don't know if this is a needed functionnality, but it can probably
> help. I was trying to think about and implement a way to add a feature
> by its WKT string writing.
>
> Something like :
>
> OpenLayers.Vector.WKT
>
> p4 = new OpenLayers.Vector.WKT('POINT(-40 30)');
>
> Regards
>
> Pierre
>
> On 10/13/06, Paul Spencer <pspencer at dmsolutions.ca> wrote:
> > Thanks Chris :)
> >
> > Performance really sucks if you add a lot of features.  I wrote a
> > quick loop to add a 1 degree box every 10 degrees and brought my
> > firefox to a halt.  Profiling reveals a number of problematic areas,
> > the biggest of which is getPx (of course).
> >
> > I've done some optimization that improves performance in this case:
> >
> > * remove the call to Pixel.add(x,y) and directly modify the pixel
> > position - this was a big savings ...
> >
> > * cached px location in the Point object based on the bounds of the
> > containing vectorLayer so getPx is only called when the bounds have
> > actually changed.
> >
> > attached is a patch against the sandbox to incorporate these changes.
> >
> > Next steps for me are:
> >
> > * fix rendering in IE and Safari (that was the whole point of using
> > excanvas)
> >
> > * further optimizations, including:
> >
> >    o try caching the bounds of each vector and test for intersection
> > with layer bounds before rendering
> >
> >    o tighten inner loops and remove deep call chains (possibly
> > putting some of the pixel conversion stuff right into convertToPx)
> >
> >   o anything else you can think of
> >
> > * convenience functions for constructing polygons and lines from
> > points without having to construct intermediate objects
> >
> > Other things that need to be done at some point, but not necessarily
> > for 2.3:
> >
> > * refactor the code (what, already?) so that the Vector architecture
> > can support multiple rendering types (Canvas, SVG, VML, possibly
> > others in the future) by introducing Layer.Vector subclasses and a
> > new Rendering class that knows how to render into the sub-classed
> > layer types
> >
> > * refactor styling support to make it less specific to Canvas
> > rendering stuff
> >
> > * add some Controls for digitizing and possibly editing
> >
> > Cheers
> >
> > Paul
> >
> > On 12-Oct-06, at 7:55 PM, Christopher Schmidt wrote:
> >
> > > On Thu, Oct 12, 2006 at 05:02:00PM -0400, Paul Spencer wrote:
> > >> Schuyler, et al
> > >>
> > >> attached is a first cut at the vector stuff.  It extracts over an
> > >> existing openlayers folder and contains only the new files I've added
> > >> plus a change to OpenLayers.js to load the extra files by default
> > >> (except for excanvas for some reason ;)).
> > >>
> > >> There is a vector.html in the examples folder.
> > >
> > > This code, with some improvements from Schuyler and I, is now in place
> > > in a sandbox in the OpenLayers SVN. You can check out with:
> > >
> > > svn co http://svn.openlayers.org/sandbox/sderle/vector/
> > >
> > > You can try it out at:
> > >
> > > http://openlayers.org/~crschmidt/vector/examples/vector.html
> > >
> > > Click once to start drawing a line -- click again to end it.
> > >
> > > FF only at the moment.
> > >
> > > Cool stuff, Paul, thanks for getting the ball rolling on this.
> > > --
> > > Christopher Schmidt
> > > Web Developer
> >
> > +-----------------------------------------------------------------+
> > |Paul Spencer                          pspencer at dmsolutions.ca    |
> > +-----------------------------------------------------------------+
> > |Chief Technology Officer                                         |
> > |DM Solutions Group Inc                http://www.dmsolutions.ca/ |
> > +-----------------------------------------------------------------+
> >
> >
> >
> >
> >
> >
> >
> > _______________________________________________
> > Dev mailing list
> > Dev at openlayers.org
> > http://openlayers.org/mailman/listinfo/dev
> >
> >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20061014/4bd8905b/wkt.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WKT.js
Type: application/x-javascript
Size: 2477 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20061014/4bd8905b/WKT.js


More information about the Dev mailing list