MCPcopy Create free account
hub / github.com/MapServer/MapServer / ogrGeomPoints

Function ogrGeomPoints

mapogr.cpp:128–262  ·  view source on GitHub ↗

* ogrGeomPoints() **********************************************************************/

Source from the content-addressed store, hash-verified

126 * ogrGeomPoints()
127 **********************************************************************/
128static int ogrGeomPoints(OGRGeometryH hGeom, shapeObj *outshp)
129{
130 int i;
131 int numpoints;
132
133 if (hGeom == NULL)
134 return 0;
135
136 OGRwkbGeometryType eGType = wkbFlatten( OGR_G_GetGeometryType( hGeom ) );
137
138/* -------------------------------------------------------------------- */
139/* Container types result in recursive invocation on each */
140/* subobject to add a set of points to the current list. */
141/* -------------------------------------------------------------------- */
142 switch( eGType )
143 {
144 case wkbGeometryCollection:
145 case wkbMultiLineString:
146 case wkbMultiPolygon:
147 case wkbPolygon:
148 {
149 /* Treat it as GeometryCollection */
150 for (int iGeom=0; iGeom < OGR_G_GetGeometryCount( hGeom ); iGeom++ )
151 {
152 if( ogrGeomPoints( OGR_G_GetGeometryRef( hGeom, iGeom ),
153 outshp ) == -1 )
154 return -1;
155 }
156
157 return 0;
158 }
159 break;
160
161 case wkbPoint:
162 case wkbMultiPoint:
163 case wkbLineString:
164 case wkbLinearRing:
165 /* We will handle these directly */
166 break;
167
168 default:
169 /* There shouldn't be any more cases should there? */
170 msSetError(MS_OGRERR,
171 "OGRGeometry type `%s' not supported yet.",
172 "ogrGeomPoints()",
173 OGR_G_GetGeometryName( hGeom ) );
174 return(-1);
175 }
176
177
178/* ------------------------------------------------------------------
179 * Count total number of points
180 * ------------------------------------------------------------------ */
181 if ( eGType == wkbPoint )
182 {
183 numpoints = 1;
184 }
185 else if ( eGType == wkbLineString

Callers 1

ogrConvertGeometryFunction · 0.85

Calls 3

msSetErrorFunction · 0.85
msAddLineFunction · 0.85
ogrPointsAddPointFunction · 0.85

Tested by

no test coverage detected