Short-circuit prepared polygon/point intersection
[geos.git] / examples / CustomCoordinateSequenceExample.h
blobd75dda75c63dbff64a4f6d2623e735e2f1591a6a
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 **********************************************************************/
17 #ifndef GEOS_EX2_H
18 #define GEOS_EX2_H
20 #include <geos/platform.h>
21 #include <geos/geom.h>
22 #include <geos/util.h>
24 using namespace std;
25 using namespace geos;
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 {
36 public:
37 CustomPointCoordinateSequence(point_3d *newPts,int newSize);
38 CustomPointCoordinateSequence(const CustomPointCoordinateSequence &cl);
39 bool isEmpty();
40 void add(Coordinate& c); //NoOp (exception)
41 void add(point_3d p); //NoOp (exception)
42 int getSize();
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();
50 string toString();
51 void setPoints(const vector<Coordinate> &v);
52 void setPoints(const vector<point_3d> &v);
53 private:
54 point_3d *pts;
55 int size;
58 class CPCLException: public GEOSException {
59 public:
60 CPCLException();
61 CPCLException(const string& msg);
62 ~CPCLException();
65 #endif