src/pyams_gis/schema.py
changeset 0 c73bb834ccbe
equal deleted inserted replaced
-1:000000000000 0:c73bb834ccbe
       
     1 #
       
     2 # Copyright (c) 2008-2017 Thierry Florac <tflorac AT ulthar.net>
       
     3 # All Rights Reserved.
       
     4 #
       
     5 # This software is subject to the provisions of the Zope Public License,
       
     6 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
       
     7 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
       
     8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
       
     9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
       
    10 # FOR A PARTICULAR PURPOSE.
       
    11 #
       
    12 
       
    13 __docformat__ = 'restructuredtext'
       
    14 
       
    15 
       
    16 # import standard library
       
    17 
       
    18 # import interfaces
       
    19 from pyams_gis.interfaces import IGeoPoint, IGeoPointZ, IGeoArea
       
    20 from zope.schema.interfaces import IObject
       
    21 
       
    22 # import packages
       
    23 from zope.interface import implementer
       
    24 from zope.schema import Object
       
    25 
       
    26 
       
    27 class IGeoPointField(IObject):
       
    28     """GeoPoint schema field interface"""
       
    29 
       
    30 
       
    31 @implementer(IGeoPointField)
       
    32 class GeoPointField(Object):
       
    33     """GeoPoint field class"""
       
    34 
       
    35     def __init__(self, **kwargs):
       
    36         if 'schema' in kwargs:
       
    37             del kwargs['schema']
       
    38         super(GeoPointField, self).__init__(IGeoPoint, **kwargs)
       
    39 
       
    40 
       
    41 class IGeoPointZField(IObject):
       
    42     """GeoPointZ schema field interface"""
       
    43 
       
    44 
       
    45 @implementer(IGeoPointZField)
       
    46 class GeoPointZField(Object):
       
    47     """GeoPointZ field class"""
       
    48 
       
    49     def __init__(self, **kwargs):
       
    50         if 'schema' in kwargs:
       
    51             del kwargs['schema']
       
    52         super(GeoPointZField, self).__init__(IGeoPointZ, **kwargs)
       
    53 
       
    54 
       
    55 class IGeoAreaField(IObject):
       
    56     """GeoArea schema field interface"""
       
    57 
       
    58 
       
    59 @implementer(IGeoAreaField)
       
    60 class GeoAreaField(Object):
       
    61     """GeoArea field class"""
       
    62 
       
    63     def __init__(self, **kwargs):
       
    64         if 'schema' in kwargs:
       
    65             del kwargs['schema']
       
    66         super(GeoAreaField, self).__init__(IGeoArea, **kwargs)