Complete Note#1 in the http://wiki.osgeo.org/wiki/GEOS_Provenance_Review to get out...
[geos.git] / src / geom / MultiPoint.cpp
blobb227445c63813286d4416acbee19fdc5147c5ada
1 /**********************************************************************
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
6 * Copyright (C) 2011 Sandro Santilli <strk@keybit.net>
7 * Copyright (C) 2005-2006 Refractions Research Inc.
8 * Copyright (C) 2001-2002 Vivid Solutions Inc.
10 * This is free software; you can redistribute and/or modify it under
11 * the terms of the GNU Lesser General Public Licence as published
12 * by the Free Software Foundation.
13 * See the COPYING file for more information.
15 **********************************************************************
17 * Last port: geom/MultiPoint.java r320 (JTS-1.12)
19 **********************************************************************/
21 #include <geos/geom/MultiPoint.h>
22 #include <geos/geom/GeometryFactory.h>
23 #include <geos/geom/Dimension.h>
25 #include <vector>
27 using namespace std;
29 //using namespace geos::operation;
31 namespace geos {
32 namespace geom { // geos::geom
34 /*protected*/
35 MultiPoint::MultiPoint(vector<Geometry *> *newPoints, const GeometryFactory *factory)
37 Geometry(factory),
38 GeometryCollection(newPoints,factory)
43 MultiPoint::~MultiPoint(){}
45 Dimension::DimensionType
46 MultiPoint::getDimension() const {
47 return Dimension::P; // point
50 int MultiPoint::getBoundaryDimension() const {
51 return Dimension::False;
54 string MultiPoint::getGeometryType() const {
55 return "MultiPoint";
58 Geometry* MultiPoint::getBoundary() const {
59 return getFactory()->createGeometryCollection();
62 bool
63 MultiPoint::equalsExact(const Geometry *other, double tolerance) const
65 if (!isEquivalentClass(other)) {
66 return false;
68 return GeometryCollection::equalsExact(other,tolerance);
71 const Coordinate* MultiPoint::getCoordinateN(int n) const {
72 return ((*geometries)[n])->getCoordinate();
74 GeometryTypeId
75 MultiPoint::getGeometryTypeId() const {
76 return GEOS_MULTIPOINT;
79 } // namespace geos::geom
80 } // namespace geos
82 /**********************************************************************
83 * $Log$
84 * Revision 1.34 2006/05/04 15:49:39 strk
85 * updated all Geometry::getDimension() methods to return Dimension::DimensionType (closes bug#93)
87 * Revision 1.33 2006/04/28 10:55:39 strk
88 * Geometry constructors made protected, to ensure all constructions use GeometryFactory,
89 * which has been made friend of all Geometry derivates. getNumPoints() changed to return
90 * size_t.
92 * Revision 1.32 2006/03/22 16:58:34 strk
93 * Removed (almost) all inclusions of geom.h.
94 * Removed obsoleted .cpp files.
95 * Fixed a bug in WKTReader not using the provided CoordinateSequence
96 * implementation, optimized out some memory allocations.
98 * Revision 1.31 2006/03/09 16:46:47 strk
99 * geos::geom namespace definition, first pass at headers split
101 * Revision 1.30 2006/03/03 10:46:21 strk
102 * Removed 'using namespace' from headers, added missing headers in .cpp files, removed useless includes in headers (bug#46)
104 * Revision 1.29 2006/02/19 19:46:49 strk
105 * Packages <-> namespaces mapping for most GEOS internal code (uncomplete, but working). Dir-level libs for index/ subdirs.
107 * Revision 1.28 2006/02/08 17:18:28 strk
108 * - New WKTWriter::toLineString and ::toPoint convenience methods
109 * - New IsValidOp::setSelfTouchingRingFormingHoleValid method
110 * - New Envelope::centre()
111 * - New Envelope::intersection(Envelope)
112 * - New Envelope::expandBy(distance, [ydistance])
113 * - New LineString::reverse()
114 * - New MultiLineString::reverse()
115 * - New Geometry::buffer(distance, quadSeg, endCapStyle)
116 * - Obsoleted toInternalGeometry/fromInternalGeometry
117 * - More const-correctness in Buffer "package"
119 * Revision 1.27 2006/01/31 19:07:33 strk
120 * - Renamed DefaultCoordinateSequence to CoordinateArraySequence.
121 * - Moved GetNumGeometries() and GetGeometryN() interfaces
122 * from GeometryCollection to Geometry class.
123 * - Added getAt(int pos, Coordinate &to) funtion to CoordinateSequence class.
124 * - Reworked automake scripts to produce a static lib for each subdir and
125 * then link all subsystem's libs togheter
126 * - Moved C-API in it's own top-level dir capi/
127 * - Moved source/bigtest and source/test to tests/bigtest and test/xmltester
128 * - Fixed PointLocator handling of LinearRings
129 * - Changed CoordinateArrayFilter to reduce memory copies
130 * - Changed UniqueCoordinateArrayFilter to reduce memory copies
131 * - Added CGAlgorithms::isPointInRing() version working with
132 * Coordinate::ConstVect type (faster!)
133 * - Ported JTS-1.7 version of ConvexHull with big attention to
134 * memory usage optimizations.
135 * - Improved XMLTester output and user interface
136 * - geos::geom::util namespace used for geom/util stuff
137 * - Improved memory use in geos::geom::util::PolygonExtractor
138 * - New ShortCircuitedGeometryVisitor class
139 * - New operation/predicate package
141 * Revision 1.26 2005/11/10 10:47:09 strk
142 * Renamed MultiPoint::getCoordinate(int) to MultiPoint::getCoordinateN(int)
143 * to avoid hiding of Geometry::getCoordinate().
145 * Revision 1.25 2004/09/13 12:39:14 strk
146 * Made Point and MultiPoint subject to Validity tests.
148 * Revision 1.24 2004/09/12 03:51:27 pramsey
149 * Casting changes to allow OS/X compilation.
151 * Revision 1.23 2004/07/22 08:45:50 strk
152 * Documentation updates, memory leaks fixed.
154 * Revision 1.22 2004/07/08 19:34:49 strk
155 * Mirrored JTS interface of CoordinateSequence, factory and
156 * default implementations.
157 * Added CoordinateArraySequenceFactory::instance() function.
159 * Revision 1.21 2004/07/06 17:58:22 strk
160 * Removed deprecated Geometry constructors based on PrecisionModel and
161 * SRID specification. Removed SimpleGeometryPrecisionReducer capability
162 * of changing Geometry's factory. Reverted Geometry::factory member
163 * to be a reference to external factory.
165 * Revision 1.20 2004/07/05 10:50:20 strk
166 * deep-dopy construction taken out of Geometry and implemented only
167 * in GeometryFactory.
168 * Deep-copy geometry construction takes care of cleaning up copies
169 * on exception.
170 * Implemented clone() method for CoordinateSequence
171 * Changed createMultiPoint(CoordinateSequence) signature to reflect
172 * copy semantic (by-ref instead of by-pointer).
173 * Cleaned up documentation.
175 * Revision 1.19 2004/07/02 13:28:26 strk
176 * Fixed all #include lines to reflect headers layout change.
177 * Added client application build tips in README.
179 * Revision 1.18 2004/07/01 14:12:44 strk
181 * Geometry constructors come now in two flavors:
182 * - deep-copy args (pass-by-reference)
183 * - take-ownership of args (pass-by-pointer)
184 * Same functionality is available through GeometryFactory,
185 * including buildGeometry().
187 * Revision 1.17 2004/06/28 21:11:43 strk
188 * Moved getGeometryTypeId() definitions from geom.h to each geometry module.
189 * Added holes argument check in Polygon.cpp.
191 * Revision 1.16 2004/05/07 09:05:13 strk
192 * Some const correctness added. Fixed bug in GeometryFactory::createMultiPoint
193 * to handle NULL CoordinateSequence.
195 * Revision 1.15 2004/04/20 08:52:01 strk
196 * GeometryFactory and Geometry const correctness.
197 * Memory leaks removed from SimpleGeometryPrecisionReducer
198 * and GeometryFactory.
200 * Revision 1.14 2004/04/01 10:44:33 ybychkov
201 * All "geom" classes from JTS 1.3 upgraded to JTS 1.4
203 * Revision 1.13 2004/03/31 07:50:37 ybychkov
204 * "geom" partially upgraded to JTS 1.4
206 * Revision 1.12 2003/11/07 01:23:42 pramsey
207 * Add standard CVS headers licence notices and copyrights to all cpp and h
208 * files.
211 **********************************************************************/