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 **********************************************************************
15 * Last port: geom/prep/PreparedGeometryFactory.java rev. 1.4 (JTS-1.10)
17 **********************************************************************/
20 #include <geos/geom/Point.h>
21 #include <geos/geom/MultiPoint.h>
22 #include <geos/geom/LineString.h>
23 #include <geos/geom/LinearRing.h>
24 #include <geos/geom/MultiLineString.h>
25 #include <geos/geom/Polygon.h>
26 #include <geos/geom/MultiPolygon.h>
27 #include <geos/geom/prep/PreparedGeometryFactory.h>
28 #include <geos/geom/prep/PreparedGeometry.h>
29 #include <geos/geom/prep/BasicPreparedGeometry.h>
30 #include <geos/geom/prep/PreparedPolygon.h>
31 #include <geos/geom/prep/PreparedLineString.h>
32 #include <geos/geom/prep/PreparedPoint.h>
33 #include <geos/util/IllegalArgumentException.h>
36 namespace geom
{ // geos.geom
37 namespace prep
{ // geos.geom.prep
39 const PreparedGeometry
*
40 PreparedGeometryFactory::create( const geom::Geometry
* g
) const
42 using geos::geom::GeometryTypeId
;
46 throw util::IllegalArgumentException("PreparedGeometry constructd with null Geometry object");
49 PreparedGeometry
* pg
= 0;
51 switch ( g
->getGeometryTypeId() )
55 pg
= new PreparedPoint( g
);
60 case GEOS_MULTILINESTRING
:
61 pg
= new PreparedLineString( g
);
65 case GEOS_MULTIPOLYGON
:
66 pg
= new PreparedPolygon( g
);
70 pg
= new BasicPreparedGeometry( g
);
75 } // namespace geos.geom.prep
76 } // namespace geos.geom
79 /**********************************************************************
82 **********************************************************************/