Пример #1
0
def PolygonOptions(adict):
    """Accepts a dictionary of options. If necessary, transforms "paths" from
    python list or encoded string to javascript array."""
    if adict.has_key("paths"):
        try:
            if isinstance(adict["paths"], (list, tuple)):
                adict["paths"] = listToJs(adict["paths"])
            elif isinstance(adict["paths"], basestring):  #Gmaps
                adict["paths"] = decodePoly(adict["paths"])
        except:  #isinstance throws exception for raw javascript objects.
            pass  #That means it's already good.
    return dictToJs(adict)
Пример #2
0
def PolygonOptions(adict):
    """Accepts a dictionary of options. If necessary, transforms "paths" from
    python list or encoded string to javascript array."""
    if adict.has_key("paths"):
        try:
            if isinstance(adict["paths"], (list, tuple)):
                adict["paths"] = listToJs(adict["paths"])
            elif isinstance(adict["paths"], basestring):  # Gmaps
                adict["paths"] = decodePoly(adict["paths"])
        except:  # isinstance throws exception for raw javascript objects.
            pass  # That means it's already good.
    return dictToJs(adict)
def GeocoderRequest(**params):
    return dictToJs(params)
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __pyjamas__ import JS

from pyjamas.gmaps.Utils import translateGmapsObject, dictToJs #, gmapsPyObjectToJs


GeocoderStatus = JS("$wnd.google.maps.GeocoderStatus")
GeocoderLocationType = JS("$wnd.google.maps.GeocoderLocationType")


geocoderResultsFields = dictToJs(
    {"results": 'l', "types": 'l', "address_components": 'l',
     "results[]": 'd', "address_components[]": 'd', "geometry": 'd',
     "result": 'd'})


# translates a geocoderResults structure from js to python
# and vice-versa

def translateGeocoderResults(jsResults, pyToJs=False):
    return translateGmapsObject(jsResults, "results", \
                                    geocoderResultsFields, pyToJs)


# translates just one element of the geocoderResults
# (because it is used inside directionsResults...)
def translateGeocoderResult(jsResult, pyToJs=False):
    return translateGmapsObject(jsResult, "result", \
Пример #5
0
def InfoWindowOptions(**params):
    return dictToJs(params)
Пример #6
0
def NavigationControlOptions(**params):
    return dictToJs(params)
Пример #7
0
def DirectionsRequest(**params):
    return dictToJs(params)
Пример #8
0
def MarkerOptions(**params):
    return dictToJs(params)
Пример #9
0
def DirectionsRendererOptions(**params):
    return dictToJs(params)
Пример #10
0
def ScaleControlOptions(**params):
    return dictToJs(params)
Пример #11
0
def NavigationControlOptions(**params):
    return dictToJs(params)
Пример #12
0
def MapTypeControlOptions(**params):
    return dictToJs(params)
Пример #13
0
def MapOptions(**params):
    return dictToJs(params)
Пример #14
0
def ScaleControlOptions(**params):
    return dictToJs(params)
Пример #15
0
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __pyjamas__ import JS

from pyjamas.gmaps.Utils import translateGmapsObject, dictToJs  #, gmapsPyObjectToJs

GeocoderStatus = JS("$wnd['google']['maps']['GeocoderStatus']")
GeocoderLocationType = JS("$wnd['google']['maps']['GeocoderLocationType']")

geocoderResultsFields = dictToJs({
    "results": 'l',
    "types": 'l',
    "address_components": 'l',
    "results[]": 'd',
    "address_components[]": 'd',
    "geometry": 'd',
    "result": 'd'
})

# translates a geocoderResults structure from js to python
# and vice-versa


def translateGeocoderResults(jsResults, pyToJs=False):
    return translateGmapsObject(jsResults, "results", \
                                    geocoderResultsFields, pyToJs)


# translates just one element of the geocoderResults
Пример #16
0
def GeocoderRequest(**params):
    return dictToJs(params)
Пример #17
0
from pyjamas.gmaps.Utils import translateGmapsObject, dictToJs
from pyjamas.gmaps.Geocoder import translateGeocoderResult

DirectionsStatus = JS("$wnd.google.maps.DirectionsStatus")

DirectionsTravelMode = JS("$wnd.google.maps.DirectionsTravelMode")

DirectionsUnitSystem = JS("$wnd.google.maps.DirectionsUnitSystem")

directionsResultsFields = dictToJs({
    "trips": 'l',
    "warnings": 'l',
    "routes": 'l',
    "steps": 'l',
    "results": 'd',
    "trips[]": 'd',
    "routes[]": 'd',
    "steps[]": 'd',
    "start_geocode": translateGeocoderResult,
    "end_geocode": translateGeocoderResult
})

# translates a directions results structure from js to python
# and vice-versa


def translateDirectionsResults(jsResults, pyToJs=False):
    return translateGmapsObject(jsResults, "results", \
                                    directionsResultsFields, pyToJs)

Пример #18
0
from pyjamas.gmaps.Utils import translateGmapsObject, dictToJs
from pyjamas.gmaps.Geocoder import translateGeocoderResult


DirectionsStatus = JS("$wnd.google.maps.DirectionsStatus")


DirectionsTravelMode = JS("$wnd.google.maps.DirectionsTravelMode")


DirectionsUnitSystem = JS("$wnd.google.maps.DirectionsUnitSystem")


directionsResultsFields = dictToJs(
    {"trips": 'l', "warnings": 'l', "routes": 'l', "steps": 'l',
    "results": 'd', "trips[]": 'd', "routes[]": 'd', "steps[]": 'd',

    "start_geocode": translateGeocoderResult,
    "end_geocode": translateGeocoderResult})


# translates a directions results structure from js to python
# and vice-versa


def translateDirectionsResults(jsResults, pyToJs=False):
    return translateGmapsObject(jsResults, "results", \
                                    directionsResultsFields, pyToJs)


class DirectionsService:
Пример #19
0
def DirectionsRequest(**params):
    return dictToJs(params)
Пример #20
0
def DirectionsRendererOptions(**params):
    return dictToJs(params)
Пример #21
0
def MapTypeControlOptions(**params):
    return dictToJs(params)