|
Last change
on this file since 3664 was
1,
checked in by myroslav, 20 years ago
|
|
Building directory structure
|
-
Property svn:eol-style set to
native
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 | from zope.interface import implements |
|---|
| 2 | from Products.geolocation.interfaces.geomap import IGEOMap |
|---|
| 3 | from zope.app.annotation.interfaces import IAnnotations, IAnnotatable |
|---|
| 4 | from persistent.mapping import PersistentMapping |
|---|
| 5 | |
|---|
| 6 | GEOMAP_KEY = "geolocation.adapters.geomap" |
|---|
| 7 | |
|---|
| 8 | class GEOMap(object): |
|---|
| 9 | """ geomap |
|---|
| 10 | """ |
|---|
| 11 | implements(IGEOMap) |
|---|
| 12 | |
|---|
| 13 | def __init__(self, context): |
|---|
| 14 | """ init """ |
|---|
| 15 | self.annotations = IAnnotations(context) |
|---|
| 16 | self.geomap = self.annotations.get(GEOMAP_KEY, None) |
|---|
| 17 | if self.geomap == None: |
|---|
| 18 | self.annotations[GEOMAP_KEY] = PersistentMapping() |
|---|
| 19 | self.geomap = self.annotations[GEOMAP_KEY] |
|---|
| 20 | self.geomap['mapcenter'] = None |
|---|
| 21 | self.geomap['mapzoom'] = None |
|---|
| 22 | self.geomap['maptype'] = None |
|---|
| 23 | |
|---|
| 24 | def getMapCenter(self): |
|---|
| 25 | """ return map center """ |
|---|
| 26 | return self.geomap['mapcenter'] |
|---|
| 27 | |
|---|
| 28 | def getMapZoom(self): |
|---|
| 29 | """ return map zoom """ |
|---|
| 30 | return self.geomap['mapzoom'] |
|---|
| 31 | |
|---|
| 32 | def getMapType(self): |
|---|
| 33 | """ return map type """ |
|---|
| 34 | return self.geomap['maptype'] |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | def setMap(self, mapcenter, mapzoom, maptype): |
|---|
| 38 | """ set map options """ |
|---|
| 39 | self.geomap['mapcenter'] = mapcenter |
|---|
| 40 | self.geomap['mapzoom'] = mapzoom |
|---|
| 41 | self.geomap['maptype'] = maptype |
|---|
Note: See
TracBrowser
for help on using the repository browser.