#9204: Google Maps Marker to change the Icon
-------------------------------+--------------------------------------------
          Reporter:  qingfeng  |         Owner:  jbronn                         
            Status:  new       |     Milestone:  1.1                            
         Component:  GIS       |       Version:  1.0                            
        Resolution:            |      Keywords:  geodjango google map icon gicon
             Stage:  Accepted  |     Has_patch:  1                              
        Needs_docs:  0         |   Needs_tests:  0                              
Needs_better_patch:  0         |  
-------------------------------+--------------------------------------------
Comment (by prairiedogg):

 My last patch is an attempt to bring GIcon up to date after jbronn's most
 update to trunk.  I didn't have a lot of time to work on it, so there's a
 compromise as a result of the recent addition of js modules and map dom_id
 namespaces.

 Since the addition of modules to the js, markers are, on the default
 template, added to the {{ js_module }}.

 This happens on the template, that is to say, the python marker object
 doesn't "know" what js namespace it belongs to, which is probably a good
 thing.

 The issue is when GIcons are put as a list into the the Gmarker.icons
 attribute, they don't "know" to what js_module the marker belongs, and
 since the marker doesn't necessarily "know" either, there doesn't seem to
 be a simple way to just call a "render" method on the GMarker and have a
 correctly namespaced GIcon variable pop out.

 The solution was to simply forgo namespacing altogether on the GIcons.  In
 the default maps template they're declared as variables (the name is
 suffixed by default with "_icon") and referenced directly by that name in
 the rest of the js template code.

 I don't really mind this per-se.  I think everyone's use cases are going
 to vary, I can't anticipate it all, and this will work for simple cases
 out of the box.  I think it makes sense to keep icons and markers
 "independent" in the python to allow folks who want to do crazy off the
 beaten path stuff the flexibility to by writing their own templates.  My
 only concern for this patch is that the js variable naming scheme is
 internally inconsistent.  I'll let the maintainers decide if it merits a
 re-think and I'd be happy to contribute if it does.

 Currently markers don't know what map they're assigned to (at least in the
 python), and that's probably good thing.  Icons are the same way (user has
 to assign them to a marker manually in their view code).  My solution was
 to forgo namespacing the icon object and just declare them as variables,
 so when the marker renders itself, it doesn't have to know its own
 ancestry to reference an icon.

 I think icons existing outside of map namespace is probably a good thing,
 because its quite conceivable that folks might want to re-use the same
 icons on different maps.  just my two cents.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/9204#comment:13>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" 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/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to