> > If you read that docs yourself, then you know that to have a GCircle I'd > > need to implement redraw, instantiate, remove etc etc... > Yes, that's exactly right. > > The questions > > is: why the hell would I need to do it if it's all implemented in > > generic polygon and all I need is to refine its constructor. That's the > > point of my question. > You could make your own .redraw() functionality as a copy of say > GPolygon's. It won't work of course because GPolygon's .redraw() has > no idea how to draw a circle. Were you expecting it to guess > somehow? What you need, to redraw a circle on say map zooming, > doesn't exist in GPolygon.
I think we speak different languages here and don't understand each other at all. Sorry for wasting your time guys. Anyways, you say something that's completely not correct... if you implemented all that circle code yourself you would know that there is no need to have redraw method and default from GPolygon is PERFECTLY OK! (if you paid attention to my explanations and questions) GPolygon doesn't care at all what is the shape of the polygon, it just draws itself based on vertices. If zoom changes do you think that coordinates of vertices have to change? So change in zoom doesn't affect circles and therefore no need to override redraw() interface. Anyways, discussion becomes pointless if we both stick to eachothers' own point of view. To make it clear I put my code here: http://dev5.summit-tech.ca/pps/ Here's GCircle.js: http://dev5.summit-tech.ca/pps/GCircle.js (notice it wourks on the pare without overriding redraw etc) Here's sample use of the GCircle code: map.addOverlay(new GCircle(point, radius, "#3472a7", 3, 1, '#3472a7', opacity, {clickable : false})); if you check GCircle.js you will see that it doesn't override any interface methods except initialize. It adds moveTo and offsetBy prototypes to GCircle (these ptotoypes could have been added to generic GPolygon this way: enumerate vertices, create a new array with offset coordinates and recreate overlay) as you see everything works fine, if you drag around a marker like a madman you'll see that browser takes a full core. Here's another test (the reason I wanted to ask about proper way to inherit and move objects!): http://dev5.summit-tech.ca/pps/test1.html Here it should work everything identical to the previous link. The difference is the implementation. In the first page to move circles I do full recreation of a GCircle object, in the test1.html page I use moveTo method instead. It seems to work... but it's broken and I'm not sure if it's my fault or it's gmaps fault. To see why it's broken, try to drag around a marker like a madman on the second page, the problem will be obvious. Same problem happens with IE. I didn't test it with Chrome though. The thing is that initially I was working on a quad core pc and this problem never happened... just rarely I was able to see after rapidly dragging a marker around the screen. With a low end pc you'll be able to see the problem instantly. So, if moving a polygon didn't take 100% cpu this problem wouldn't show up. The source of problem is that the same overlay removed and added back right away. It's kind of the same pointer (this.map.removeOverlay(this); ... this.map.addOverlay(this)), but before adding it back I recreate it inplace. There must be something going on behind the scenes that breaks it... anyways, hopefully now it will be more obvious what I'm talking about. > > I don't need to learn js, I just wanted a quick way to > > inherit from another class. > And there's the problem. See Crockford again - "JavaScript does not > have classes" > You can either actually learn, or you can do what people tell you for > the quick fix and stop worrying about the whyfore - in this case just > create the extra methods. > Try this one - > http://javascript.crockford.com/prototypal.html > Or you can give up this approach and try the Flash based API, if you > don't like the way javascript works. There are options. > cheers, Ross K What I'm doing with gmaps is a quick demo/test and I don't really care about it and if it's broken. I'm not a javascript/html programmer and the web thing isn't important to me. But, after I tried to do it I was surprised that there is no clear way to do simple stuff and it all seems to be broken behind the scenes. Among other annoyances: 1) openInfoWindowTabsHtml is broken. http://dev5.summit-tech.ca/pps/openInfoWindowTabsHtml.html click grouped markers to see what I'm talking about. The problem is that tabbed infowindow's width is based on the content only and if the width of tab control is bigger then it becomes broken. 2) http://dev5.summit-tech.ca/pps/ click single marker (so that you have an info window popup) and now drag around the marker (like a madman! :))... in firefox you will see that the info window starts to grow for some reason. How is that even possible?! It doesn't grow on IE. and I didn't even try to do complicated stuff... I'm sure that if I went ahead I would hit more and more rad blocks and I would have to invent quircks to avoid them. If gmaps.js wasn't a set of cryptic a giberish and if they provided original not obfuscated version for development purposes so that it would be possible to inspect what's going on, then it all could have be resolved by regular developers. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en -~----------~----~----~----~------~----~------~--~---
