[OpenLayers-Users] Canvas demo not working?

Anselm Hook anselm at hook.org
Tue Aug 29 12:58:02 CDT 2006


I did another small improvement pass on the canvas demo:

 http://ctzn.org/open/examples/canvas.html

To use this you have to goto the right tab and switch to google maps
(canvas is popping behind the wms layer for some reason and so touching it
will pop it back to front).  Then use the mouse to pick a point on the
map, and then pick another point nearby, and then pick a color and then
say draw line, and then pick another color, and then say draw dot...  Draw
arc is not correctly taking the angle of the tangent you draw so the arc
degree is wrong... the demo needs lots more work obviously.

What I did was define a set of primitives that map to the canvas
primitives and then let you draw them.

I can see lots of ways to do this better, such as just using javascript
eval() as the way to represent draw operations rather than doing it
declaratively.

Is making a list of declarative nodes is the best way to store canvas
state?  It feels like I am reinventing svg.  I've written a lot of
commercial visualization products and it feels here like I am reinventing
the wheel yet again...  better ideas are appreciated if any.

Also I went with a more or less self contained set of drawing primitives;
rather than relying on the state engine so much.  I wanted this because I
thought it might be nice to do a video game with canvas...  where drawing
order and behavior changes frequently.  But a server could spit out a list
of drawing operations more efficiently if it assumed state was present.

Another note is that although canvas redraws every time you move the
screen, for anything that is animated it actually is a reasonable
behavior.  Although probably not suitable for say representing 10k line
segments or polygons etc.

I do actually find it quite pleasing to monkey with visually; it is more
satisfying than quikmaps and I think this could be much much better and a
more durable stable open solution for map scribbling.  I've been monkeying
around with server side persistence of user scribbling as well...  But
clearly it all needs work.

 - a


On Tue, 29 Aug 2006, Nick Whitelegg wrote:

> On Tuesday 29 Aug 2006 18:15, you wrote:
> > On Tue, Aug 29, 2006 at 05:40:51PM +0100, Nick Whitelegg wrote:
> > > I'm about to try something out using the Canvas layer. Just tried the
> > > Canvas demo and it doesn't appear to be working, namely if you click and
> > > click again, it doesn't draw a line in the correct colour. It was working
> > > the other day. Is the Canvas code in the process of modification at the
> > > moment?
> >
> > Nick:
> >
> > My current experience with it is that it works against Google, but not
> > against WMS: I'm not sure of the exact reason for that, and I don't have
> > time to debug it right now. The Canvas code hasn't changed, so it's
> > likely that something else around it has changed, but I'm not aware of
> > what.
> >
> > I probably won't have time to debug it before the week is out.
> >
> > If you find anything with it that you can solve, please feel free to let
> > us know, and we'll take care of getting it fixed in trunk.
>
> Chris,
>
> Just tested it with the Google layer (was wms before). It seems to be a
> z-index related issue: the lines are drawn if in wms, but the wms layer hides
> it. When you switch back to google again, they appear.
>
> I've got quite a lot on this week , but if I have time I will investigate
> this.
>
> Nick
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://mailman-viper.python-hosting.com/listinfo/users
>



More information about the Users mailing list