Skip to content

Commit 13c1fa3

Browse files
committed
added missing file
1 parent 91a0bda commit 13c1fa3

1 file changed

Lines changed: 89 additions & 0 deletions

File tree

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/*
2+
Copyright 1995-2018 Esri
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
16+
For additional information, contact:
17+
Environmental Systems Research Institute, Inc.
18+
Attn: Contracts Dept
19+
380 New York Street
20+
Redlands, California, USA 92373
21+
22+
23+
*/
24+
package com.esri.core.geometry;
25+
26+
import java.util.ArrayList;
27+
import java.util.List;
28+
29+
import com.esri.core.geometry.ogc.OGCConcreteGeometryCollection;
30+
import com.esri.core.geometry.ogc.OGCGeometry;
31+
import com.esri.core.geometry.ogc.OGCGeometryCollection;
32+
33+
//An internal helper class. Do not use.
34+
public class OGCStructureInternal {
35+
private static class EditShapeCursor extends GeometryCursor {
36+
EditShape m_shape;
37+
int m_geom;
38+
int m_index;
39+
40+
EditShapeCursor(EditShape shape, int index) {
41+
m_shape = shape;
42+
m_geom = -1;
43+
m_index = index;
44+
}
45+
@Override
46+
public Geometry next() {
47+
if (m_shape != null) {
48+
if (m_geom == -1)
49+
m_geom = m_shape.getFirstGeometry();
50+
else
51+
m_geom = m_shape.getNextGeometry(m_geom);
52+
53+
if (m_geom == -1) {
54+
m_shape = null;
55+
}
56+
else {
57+
return m_shape.getGeometry(m_geom);
58+
}
59+
60+
}
61+
62+
return null;
63+
}
64+
65+
@Override
66+
public int getGeometryID() {
67+
return m_shape.getGeometryUserIndex(m_geom, m_index);
68+
}
69+
70+
};
71+
72+
public static GeometryCursor prepare_for_ops_(GeometryCursor geoms, SpatialReference sr) {
73+
assert(geoms != null);
74+
EditShape editShape = new EditShape();
75+
int geomIndex = editShape.createGeometryUserIndex();
76+
for (Geometry g = geoms.next(); g != null; g = geoms.next()) {
77+
int egeom = editShape.addGeometry(g);
78+
editShape.setGeometryUserIndex(egeom, geomIndex, geoms.getGeometryID());
79+
}
80+
81+
Envelope2D env = editShape.getEnvelope2D();
82+
double tolerance = InternalUtils.calculateToleranceFromGeometry(sr,
83+
env, true);
84+
85+
CrackAndCluster.execute(editShape, tolerance, null, true);
86+
return OperatorSimplifyOGC.local().execute(new EditShapeCursor(editShape, geomIndex), sr, false, null);
87+
}
88+
}
89+

0 commit comments

Comments
 (0)