[OSM-dev] Experiment: AJAX and <canvas> based online editor

Gabriel Ebner ge at gabrielebner.at
Fri Aug 18 15:07:47 BST 2006


On Fri, Aug 18, 2006 at 02:24:30PM +0100, Nick Whitelegg wrote:
> On the other hand, does anyone have any general tips on improving drawing 
> performance? This also applies to osmeditor2 which is also rather slow when 
> drawing data - even though it does not attempt to draw things outside the 
> current viewing area. The algorithm at present is more or less:

You might want to disable anti-aliasing or do some sort of double-buffering.

> loop through nodes
>     if node is in current viewing area, draw it
> end
> 
> loop through ways
>     loop through segments in way
>          if node1 or node2 in view

This will miss cases like this, where neither node is in view, but the segment
is:

	*
       /
    +-------+
    |/	    |
    |	    |
   /|	    |
  / +-------+
 *

>               draw segment
>          end if
>     end
> end

If the loop is taking too long (as compared to the drawing), you could also do
some sort of indexing to speed it up.

  Gabriel.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20060818/8f84b3c8/attachment.pgp>


More information about the dev mailing list