[Zope3-checkins] CVS: zopeproducts/pypgsqlda - geometric.py:1.1

Christian 'Tiran' Heimes heimes@faho.rwth-aachen.de
Tue, 18 Mar 2003 18:02:01 -0500


Update of /cvs-repository/zopeproducts/pypgsqlda
In directory cvs.zope.org:/tmp/cvs-serv6529

Added Files:
	geometric.py 
Log Message:
1st implementation of Point


=== Added File zopeproducts/pypgsqlda/geometric.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Geometric object implementation

$Id: geometric.py,v 1.1 2003/03/18 23:02:00 tiran Exp $
"""

from interfaces.geometric import Point

class Point(object):
    """Simple geometric point
    """

    __implements__ = Point

    def __init__(self, xOrTuple, y):
        # XXX
        self._x = float(xOrTuple)
        self._y = float(y)

    def getX(self):
        return self._x

    def setX(self, value):
        self._x = float(value)
    
    x = property(getX, setX, None, 'x coordinate as float')

    def getY(self):
        return self._y

    def setY(self, value):
        self._y = float(value)

    y = property(getY, setY, None, 'y coordinate as float')

    def getCoord(self):
        return (self._x, self._y)

    def setCoord(self, xOrTuple, y):
        self._x = float(xOrTuple)
        self._y = float(y)
    
    coord = property(getCoord, setCoord, None, 
                     '(x/y) coordinate as tuple of floats')