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

Revision 2194, 1.4 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#
6################################################################################
7
8import string
9
10from _OGGeometryCollection import OGGeometryCollection
11from _OGPoint import OGPoint, OGpointFromSequence
12
13
14class OGMultiPoint(OGGeometryCollection):
15
16    def _og_str(self):
17        s = string.join([ point.__repr__() for point in self.getGeometries() ],',')
18
19        return "MULTIPOINT (%s)" % (s,)
20
21    def __repr__(self):
22        s = string.join([ point.__repr__() for point in self.getGeometries() ],',')
23
24        return "(%s)" % (s,)
25
26
27# factory methods
28
29def OGmultiPointFromOGPoints(*points):
30    """
31    Return a OGMultipoint.
32
33    (arg *points) any number of OGPoints that make up the OGMultiPoint.
34
35    """
36    multipoint = OGMultiPoint()
37    for point in points:
38        multipoint.append(point)
39
40    return multipoint
41
42def OGmultiPointFromSequence(seq):
43    """
44    Return a OGMultiPoint.
45
46    (arg *seq) a sequence of the form ((x,y),...,(x,y)) that make up the OGMultiPoint,
47    where x and y are floats.
48
49    """
50
51    multipoint = OGMultiPoint()
52    for point in seq:
53        multipoint.append(OGpointFromSequence(point))
54
55    return multipoint
Note: See TracBrowser for help on using the repository browser.