1 /**********************************************************************
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
6 * Copyright (C) 2001-2002 Vivid Solutions Inc.
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
13 **********************************************************************
14 **********************************************************************/
20 #include <geos/platform.h>
21 #include <geos/geom.h>
22 #include <geos/util.h>
28 * This is an example of how you can create a custom CoordinateSequence class that wraps
29 * your own way of storing lists of coordinates. Depending on your internal storage
30 * format some methods in the wrapper class might not work properly (but have to be
31 * preserved for the interface compatibility. In this example CustomPointCoordinateSequence
32 * wraps an array of point_3d. Since the array is fixed length, methods like 'add' or
33 * 'deleteAt' will not work.
35 class CustomPointCoordinateSequence
: public BasicCoordinateSequence
{
37 CustomPointCoordinateSequence(point_3d
*newPts
,int newSize
);
38 CustomPointCoordinateSequence(const CustomPointCoordinateSequence
&cl
);
40 void add(Coordinate
& c
); //NoOp (exception)
41 void add(point_3d p
); //NoOp (exception)
43 Coordinate
& getAt(int pos
);
44 point_3d
getPointAt(int pos
);
45 void setAt(Coordinate
& c
, int pos
);
46 void setAt(point_3d p
, int pos
);
47 void deleteAt(int pos
); //NoOp (exception)
48 vector
<Coordinate
>* toVector();
49 vector
<point_3d
>* toPointVector();
51 void setPoints(const vector
<Coordinate
> &v
);
52 void setPoints(const vector
<point_3d
> &v
);
58 class CPCLException
: public GEOSException
{
61 CPCLException(const string
& msg
);