[Zope3-checkins] CVS: Products3/pypgsqlda/interfaces - geometric.py:1.1
Christian Theune
ct@gocept.com
Tue, 18 Mar 2003 17:19:07 -0500
Update of /cvs-repository/Products3/pypgsqlda/interfaces
In directory cvs.zope.org:/tmp/cvs-serv662/interfaces
Added Files:
geometric.py
Log Message:
first draft of geometric interfaces
=== Added File Products3/pypgsqlda/interfaces/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 interfaces.
$Id: geometric.py,v 1.1 2003/03/18 22:19:07 ctheune Exp $
"""
from zope.interface import Interface, Attribute
class Point:
"""A 2 dimensional point in cartesian representation."""
x = Attribute("x coordinate as float")
y = Attribute("y coordinate as float")
class Shape:
"""An abstract interface for geometric shapes."""
def area():
pass
def circumference():
pass
class Circle(Shape):
"""A circle. It is represented as a center point and a radius."""
center = Attribute("center as point coordinate")
radius = Attribute("radius as float")
class Box(Shape):
upperRight = Attribute("Upper right point of the box as point coordinate")
lowerLeft = Attribute("Lower left point of the box as point coordinate")
class Path:
"""A path is an ordered set of points. A path can be closed, which means
that the end point is connected to the start point. A special kind of
path is the line, which only has to points and is open."""
points = Attribute("List of coordinate points")
open = Attribute("Is the last point connected to the first?")