source: TI02-CSML/trunk/services/3rdParty/GeoTypes-0.6.0/GeoTypes/_OGLinearRing.py @ 2194

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI02-CSML/trunk/services/3rdParty/GeoTypes-0.6.0/GeoTypes/_OGLinearRing.py@2194
Revision 2194, 1.2 KB checked in by lawrence, 13 years ago (diff)

Adding various specs and 3rd party code of interest for the CSML
services development.

Line 
1
2################################################################################
3# Copyright (c) QinetiQ Plc 2003
4#
5# Licensed under the LGPL. For full license details see the LICENSE file.
6################################################################################
7
8import string
9
10from _OGLineString import OGLineString
11from _OGPoint import OGpointFromSequence
12
13class OGLinearRing(OGLineString):
14    def __repr__(self):
15        s = string.join([ point.__repr__() for point in self.getPoints() ],',')
16        return "(%s)" % (s,)
17       
18
19# factory methods
20
21def OGlinearRingFromOGPoints(*points):
22    """
23    Return a OGLinearRing.
24
25    (arg *points) any number of OGPoints that make up the OGLinearRing.
26
27    """
28    linearring = OGLinearRing()
29    for point in points:
30        linearring.append(point)
31       
32    return linearring
33
34def OGlinearRingFromSequence(seq):
35    """
36    Return a OGLinearRing.
37
38    (arg *seq) a sequence of the form ((x,y),...,(x,y)) that make up the OGLinearRing,
39    where x and y are floats.
40
41    """
42
43    linearring = OGLinearRing()
44    for point in seq:
45        linearring.append(OGpointFromSequence(point))
46       
47    return linearring
Note: See TracBrowser for help on using the repository browser.