Revision 22583
trunk/extensions/extGraph/src-test/com/iver/cit/gvsig/graphtests/TestTriangulationPirol.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 {{Company}} {{Task}} |
|
26 |
*/ |
|
27 |
|
|
28 |
package com.iver.cit.gvsig.graphtests; |
|
29 |
|
|
30 |
import java.io.File; |
|
31 |
import java.util.List; |
|
32 |
|
|
33 |
import junit.framework.TestCase; |
|
34 |
|
|
35 |
import org.cresques.cts.IProjection; |
|
36 |
import org.gvsig.exceptions.BaseException; |
|
37 |
import org.gvsig.fmap.algorithm.triangulation.PirolTriangulator; |
|
38 |
import org.gvsig.fmap.algorithm.triangulation.Triangle; |
|
39 |
import org.gvsig.fmap.algorithm.triangulation.Vertex; |
|
40 |
|
|
41 |
import com.iver.cit.gvsig.fmap.core.FMultiPoint2D; |
|
42 |
import com.iver.cit.gvsig.fmap.core.FPoint2D; |
|
43 |
import com.iver.cit.gvsig.fmap.core.IFeature; |
|
44 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
|
45 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
|
46 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
|
47 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
|
48 |
import com.iver.cit.gvsig.fmap.layers.ReadableVectorial; |
|
49 |
|
|
50 |
public class TestTriangulationPirol extends TestCase { |
|
51 |
|
|
52 |
FLyrVect lyr; |
|
53 |
|
|
54 |
protected void setUp() throws Exception { |
|
55 |
super.setUp(); |
|
56 |
// Setup de los drivers |
|
57 |
LayerFactory |
|
58 |
.setDriversPath("../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/drivers"); |
|
59 |
|
|
60 |
// Setup del factory de DataSources |
|
61 |
|
|
62 |
IProjection prj = CRSFactory.getCRS("EPSG:23030"); |
|
63 |
File shpFile = new File("test_files/pts_pirol.shp"); |
|
64 |
lyr = (FLyrVect) LayerFactory.createLayer("Puntos", "gvSIG shp driver", |
|
65 |
shpFile, prj); |
|
66 |
|
|
67 |
} |
|
68 |
|
|
69 |
public void testCalculateDelaunayTriangulation() throws BaseException { |
|
70 |
|
|
71 |
ReadableVectorial rv = lyr.getSource(); |
|
72 |
|
|
73 |
long t1 = System.currentTimeMillis(); |
|
74 |
PirolTriangulator triangulator = new PirolTriangulator(); |
|
75 |
rv.start(); |
|
76 |
for (int i=0; i < rv.getShapeCount(); i++) { |
|
77 |
IFeature feat = rv.getFeature(i); |
|
78 |
IGeometry geom = feat.getGeometry(); |
|
79 |
Object shp = geom.getInternalShape(); |
|
80 |
if (shp instanceof FPoint2D) |
|
81 |
{ |
|
82 |
FPoint2D p = (FPoint2D) geom.getInternalShape(); |
|
83 |
// Leer la Z para hacer el contour. Para la trianqulaci?n no hace falta. |
|
84 |
triangulator.addVertex(new Vertex(p.getX(), p.getY())); |
|
85 |
} |
|
86 |
if (shp instanceof FMultiPoint2D) |
|
87 |
{ |
|
88 |
FMultiPoint2D multi = (FMultiPoint2D) shp; |
|
89 |
for (int j=0; j < multi.getNumPoints(); j++) { |
|
90 |
FPoint2D p = multi.getPoint(j); |
|
91 |
triangulator.addVertex(new Vertex(p.getX(), p.getY())); |
|
92 |
System.out.println("Vertex from feature " + i + " = " + p.getX() + " - " + p.getY()); |
|
93 |
} |
|
94 |
} |
|
95 |
|
|
96 |
} |
|
97 |
rv.stop(); |
|
98 |
|
|
99 |
triangulator.calculateTriangulation(); |
|
100 |
List <Triangle> triangles = triangulator.getTriangles(); |
|
101 |
long t2 = System.currentTimeMillis(); |
|
102 |
System.out.println("tiempo:" + (t2-t1)); |
|
103 |
|
|
104 |
// assertEquals(dist.doubleValue(), 8887, 0); |
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
} |
|
111 |
// public void testCalculateContour() throws BaseException { |
|
112 |
// |
|
113 |
// ReadableVectorial rv = lyr.getSource(); |
|
114 |
// |
|
115 |
// long t1 = System.currentTimeMillis(); |
|
116 |
//// WatsonTriangulator triangulator = new WatsonTriangulator(); |
|
117 |
//// ChewTriangulator triangulator = new ChewTriangulator(); |
|
118 |
// FJenettTriangulator triangulator = new FJenettTriangulator(); |
|
119 |
// rv.start(); |
|
120 |
// for (int i=0; i < rv.getShapeCount(); i++) { |
|
121 |
// IFeature feat = rv.getFeature(i); |
|
122 |
// IGeometry geom = feat.getGeometry(); |
|
123 |
// Object shp = geom.getInternalShape(); |
|
124 |
// if (shp instanceof FPoint2D) |
|
125 |
// { |
|
126 |
// FPoint2D p = (FPoint2D) geom.getInternalShape(); |
|
127 |
// // Leer la Z para hacer el contour. Para la trianqulaci?n no hace falta. |
|
128 |
// triangulator.addVertex(new Vertex(p.getX(), p.getY())); |
|
129 |
// } |
|
130 |
// if (shp instanceof FMultiPoint2D) |
|
131 |
// { |
|
132 |
// FMultiPoint2D multi = (FMultiPoint2D) shp; |
|
133 |
// for (int j=0; j < multi.getNumPoints(); j++) { |
|
134 |
// FPoint2D p = multi.getPoint(j); |
|
135 |
// NumericValue val = (NumericValue) feat.getAttribute(0); |
|
136 |
// triangulator.addVertex(new Vertex(p.getX(), p.getY(), val.doubleValue())); |
|
137 |
// } |
|
138 |
// } |
|
139 |
// |
|
140 |
// } |
|
141 |
// rv.stop(); |
|
142 |
// |
|
143 |
// TIN tin = triangulator.calculateTriangulation(); |
|
144 |
// ContourCalculator contourCalculator = new ContourCalculator(tin); |
|
145 |
// Collection<LineString> contour = contourCalculator.getContour(4.7); |
|
146 |
// System.out.println("Contour = " + contour.toString()); |
|
147 |
// |
|
148 |
// Collection<LineString> contour2 = contourCalculator.getContour_Complex_BAD(4.7); |
|
149 |
// System.out.println("Contour2 = " + contour2.toString()); |
|
150 |
// |
|
151 |
// List <Triangle> triangles = triangulator.getTriangles(); |
|
152 |
// |
|
153 |
// long t2 = System.currentTimeMillis(); |
|
154 |
// System.out.println("tiempo:" + (t2-t1) + ". NumTriangles = " + triangles.size()); |
|
155 |
// |
|
156 |
// // assertEquals(dist.doubleValue(), 8887, 0); |
|
157 |
// |
|
158 |
// |
|
159 |
// |
|
160 |
// |
|
161 |
// |
|
162 |
// } |
|
163 |
|
|
164 |
} |
|
165 |
|
trunk/extensions/extGraph/src-test/com/iver/cit/gvsig/graphtests/TestTriangulation.java | ||
---|---|---|
36 | 36 |
import org.cresques.cts.IProjection; |
37 | 37 |
import org.gvsig.exceptions.BaseException; |
38 | 38 |
import org.gvsig.fmap.algorithm.contouring.ContourCalculator; |
39 |
import org.gvsig.fmap.algorithm.triangulation.ChewTriangulator; |
|
40 |
import org.gvsig.fmap.algorithm.triangulation.FJenettTriangulator; |
|
39 | 41 |
import org.gvsig.fmap.algorithm.triangulation.TIN; |
40 | 42 |
import org.gvsig.fmap.algorithm.triangulation.Triangle; |
41 | 43 |
import org.gvsig.fmap.algorithm.triangulation.Vertex; |
... | ... | |
117 | 119 |
ReadableVectorial rv = lyr.getSource(); |
118 | 120 |
|
119 | 121 |
long t1 = System.currentTimeMillis(); |
120 |
WatsonTriangulator triangulator = new WatsonTriangulator(); |
|
122 |
// WatsonTriangulator triangulator = new WatsonTriangulator(); |
|
123 |
// ChewTriangulator triangulator = new ChewTriangulator(); |
|
124 |
FJenettTriangulator triangulator = new FJenettTriangulator(); |
|
121 | 125 |
rv.start(); |
122 | 126 |
for (int i=0; i < rv.getShapeCount(); i++) { |
123 | 127 |
IFeature feat = rv.getFeature(i); |
... | ... | |
151 | 155 |
System.out.println("Contour2 = " + contour2.toString()); |
152 | 156 |
|
153 | 157 |
List <Triangle> triangles = triangulator.getTriangles(); |
158 |
|
|
154 | 159 |
long t2 = System.currentTimeMillis(); |
155 |
System.out.println("tiempo:" + (t2-t1)); |
|
160 |
System.out.println("tiempo:" + (t2-t1) + ". NumTriangles = " + triangles.size());
|
|
156 | 161 |
|
157 | 162 |
// assertEquals(dist.doubleValue(), 8887, 0); |
158 | 163 |
|
trunk/extensions/extGraph/src/org/gvsig/graph/NetworkUtils.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package org.gvsig.graph; |
|
42 |
|
|
43 |
import java.awt.Color; |
|
44 |
import java.awt.geom.Point2D; |
|
45 |
import java.awt.geom.Rectangle2D; |
|
46 |
import java.io.File; |
|
47 |
import java.io.IOException; |
|
48 |
import java.util.ArrayList; |
|
49 |
import java.util.Iterator; |
|
50 |
|
|
51 |
import javax.swing.ImageIcon; |
|
52 |
|
|
53 |
import org.gvsig.graph.core.GvFlag; |
|
54 |
import org.gvsig.graph.solvers.Route; |
|
55 |
|
|
56 |
import com.iver.cit.gvsig.fmap.MapControl; |
|
57 |
import com.iver.cit.gvsig.fmap.ViewPort; |
|
58 |
import com.iver.cit.gvsig.fmap.core.IFeature; |
|
59 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
|
60 |
import com.iver.cit.gvsig.fmap.core.ShapeFactory; |
|
61 |
import com.iver.cit.gvsig.fmap.core.styles.ArrowDecoratorStyle; |
|
62 |
import com.iver.cit.gvsig.fmap.core.styles.ILineStyle; |
|
63 |
import com.iver.cit.gvsig.fmap.core.styles.SimpleLineStyle; |
|
64 |
import com.iver.cit.gvsig.fmap.core.symbols.IMarkerSymbol; |
|
65 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
|
66 |
import com.iver.cit.gvsig.fmap.core.symbols.SimpleLineSymbol; |
|
67 |
import com.iver.cit.gvsig.fmap.core.v02.FConstant; |
|
68 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
|
69 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
|
70 |
import com.iver.cit.gvsig.fmap.layers.GraphicLayer; |
|
71 |
import com.iver.cit.gvsig.fmap.rendering.FGraphic; |
|
72 |
import com.vividsolutions.jts.geom.Coordinate; |
|
73 |
import com.vividsolutions.jts.geom.Geometry; |
|
74 |
import com.vividsolutions.jts.geom.GeometryFactory; |
|
75 |
import com.vividsolutions.jts.geom.LineString; |
|
76 |
|
|
77 |
public class NetworkUtils { |
|
78 |
static int idSymbolFlag = -1; |
|
79 |
|
|
80 |
static private GeometryFactory geomFactory = new GeometryFactory(); |
|
81 |
|
|
82 |
private static IMarkerSymbol simFlag2; |
|
83 |
private static FSymbol simFlag; |
|
84 |
|
|
85 |
|
|
86 |
|
|
87 |
public static void clearBarriersFromGraphics(MapControl mc) { |
|
88 |
GraphicLayer graphics = mc.getMapContext().getGraphicsLayer(); |
|
89 |
for (int i = graphics.getNumGraphics() - 1; i >= 0; i--) { |
|
90 |
FGraphic aux = graphics.getGraphic(i); |
|
91 |
if (aux.getTag() != null) |
|
92 |
if (aux.getTag().equalsIgnoreCase("BARRIER")) |
|
93 |
graphics.removeGraphic(aux); |
|
94 |
} |
|
95 |
} |
|
96 |
|
|
97 |
public static void clearFlagsFromGraphics(MapControl mc) { |
|
98 |
GraphicLayer graphics = mc.getMapContext().getGraphicsLayer(); |
|
99 |
for (int i = graphics.getNumGraphics() - 1; i >= 0; i--) { |
|
100 |
FGraphic aux = graphics.getGraphic(i); |
|
101 |
if (aux.getTag() != null) |
|
102 |
if (aux.getTag().equalsIgnoreCase("FLAG")) |
|
103 |
graphics.removeGraphic(aux); |
|
104 |
} |
|
105 |
} |
|
106 |
|
|
107 |
public static void clearFlagFromGraphics(MapControl mc, GvFlag flag) { |
|
108 |
GraphicLayer graphics = mc.getMapContext().getGraphicsLayer(); |
|
109 |
FGraphic graphic = graphics.getGraphicByObjectTag(flag); |
|
110 |
graphics.removeGraphic(graphic); |
|
111 |
} |
|
112 |
|
|
113 |
public static void clearRouteFromGraphics(MapControl mc) { |
|
114 |
GraphicLayer graphics = mc.getMapContext().getGraphicsLayer(); |
|
115 |
for (int i = graphics.getNumGraphics() - 1; i >= 0; i--) { |
|
116 |
FGraphic aux = graphics.getGraphic(i); |
|
117 |
if (aux.getTag() != null) |
|
118 |
if (aux.getTag().equalsIgnoreCase("ROUTE")) |
|
119 |
graphics.removeGraphic(aux); |
|
120 |
} |
|
121 |
} |
|
122 |
|
|
123 |
public static void centerGraphicsOnFlags(MapControl mc, GvFlag[] flags){ |
|
124 |
ViewPort vp = mc.getViewPort(); |
|
125 |
Rectangle2D extent = vp.getAdjustedExtent(); |
|
126 |
/*double xNC = flag.getOriginalPoint().getX(); |
|
127 |
double yNC = flag.getOriginalPoint().getY();*/ |
|
128 |
double width = extent.getWidth(); |
|
129 |
double height = extent.getHeight(); |
|
130 |
|
|
131 |
Rectangle2D.Double r = null;//new Rectangle2D.Double(); |
|
132 |
|
|
133 |
/*r.width = width; |
|
134 |
r.height = height; |
|
135 |
r.x = xNC - width/2; |
|
136 |
r.y = yNC - height/2;*/ |
|
137 |
|
|
138 |
for (int i = 0; i < flags.length; i++) { |
|
139 |
if(flags[i]!=null){ |
|
140 |
Point2D p=flags[i].getOriginalPoint(); |
|
141 |
if (r==null) |
|
142 |
r=new Rectangle2D.Double(p.getX(),p.getY(),0,0); |
|
143 |
else |
|
144 |
r.add(flags[i].getOriginalPoint()); |
|
145 |
} |
|
146 |
} |
|
147 |
|
|
148 |
double realTol = mc.getViewPort().toMapDistance(15); |
|
149 |
|
|
150 |
r.height=r.height+realTol; |
|
151 |
r.width=r.width+realTol; |
|
152 |
r.x = r.x-(realTol/2.0);//r.getMaxX() - r.width/2; |
|
153 |
r.y = r.y-(realTol/2.0);//r.getMaxY() - r.height/2; |
|
154 |
|
|
155 |
vp.setExtent(r); |
|
156 |
mc.getMapContext().invalidate(); |
|
157 |
} |
|
158 |
|
|
159 |
public static void centerGraphicsOnFlag(MapControl mc, GvFlag flag){ |
|
160 |
ViewPort vp = mc.getViewPort(); |
|
161 |
Rectangle2D extent = vp.getAdjustedExtent(); |
|
162 |
double xNC = flag.getOriginalPoint().getX(); |
|
163 |
double yNC = flag.getOriginalPoint().getY(); |
|
164 |
double width = extent.getWidth(); |
|
165 |
double height = extent.getHeight(); |
|
166 |
|
|
167 |
Rectangle2D.Double r = new Rectangle2D.Double(); |
|
168 |
|
|
169 |
r.width = width; |
|
170 |
r.height = height; |
|
171 |
r.x = xNC - width/2; |
|
172 |
r.y = yNC - height/2; |
|
173 |
|
|
174 |
vp.setExtent(r); |
|
175 |
} |
|
176 |
|
|
177 |
public static void drawRouteOnGraphics(MapControl mc, Route route){ |
|
178 |
Iterator it = route.getFeatureList().iterator(); |
|
179 |
int idSymbolLine=-1; |
|
180 |
GraphicLayer graphicLayer = mc.getMapContext().getGraphicsLayer(); |
|
181 |
// if (idSymbolLine == -1) |
|
182 |
{ |
|
183 |
SimpleLineSymbol arrowSymbol = new SimpleLineSymbol(); |
|
184 |
// FSymbol arrowSymbol = new FSymbol(FConstant.SYMBOL_TYPE_LINE); |
|
185 |
arrowSymbol.setLineColor(Color.RED); |
|
186 |
arrowSymbol.setUnit(-1); //pixels |
|
187 |
arrowSymbol.setLineWidth(3.0f); |
|
188 |
ILineStyle lineStyle = new SimpleLineStyle(); |
|
189 |
|
|
190 |
ArrowDecoratorStyle arrowDecoratorStyle = new ArrowDecoratorStyle(); |
|
191 |
arrowDecoratorStyle.setArrowMarkerCount(1); |
|
192 |
lineStyle.setArrowDecorator(arrowDecoratorStyle ); |
|
193 |
lineStyle.setLineWidth(3.0f); |
|
194 |
arrowSymbol.setLineStyle(lineStyle); |
|
195 |
idSymbolLine = graphicLayer.addSymbol(arrowSymbol); |
|
196 |
|
|
197 |
} |
|
198 |
// Para evitar hacer reallocate de los elementos de la |
|
199 |
// graphicList cada vez, creamos primero la lista |
|
200 |
// y la insertamos toda de una vez. |
|
201 |
ArrayList graphicsRoute = new ArrayList(); |
|
202 |
while (it.hasNext()) { |
|
203 |
IFeature feat = (IFeature) it.next(); |
|
204 |
IGeometry gAux = feat.getGeometry(); |
|
205 |
FGraphic graphic = new FGraphic(gAux, idSymbolLine); |
|
206 |
graphic.setTag("ROUTE"); |
|
207 |
graphicsRoute.add(graphic); |
|
208 |
// graphicLayer.insertGraphic(0, graphic); |
|
209 |
} |
|
210 |
// Lo insertamos al principio de la lista para que los |
|
211 |
// pushpins se dibujen despu?s. |
|
212 |
|
|
213 |
graphicLayer.inserGraphics(0, graphicsRoute); |
|
214 |
mc.drawGraphics(); |
|
215 |
} |
|
216 |
|
|
217 |
public static File getNetworkFile(FLayer lyr) { |
|
218 |
String directoryName = System.getProperty("java.io.tmpdir"); |
|
219 |
String aux = lyr.getName().replaceAll("\\Q.shp\\E", ".net"); |
|
220 |
File newFile = new File(directoryName + File.separator + aux); |
|
221 |
return newFile; |
|
222 |
|
|
223 |
} |
|
224 |
|
|
225 |
public static void addGraphicFlag(MapControl mapControl, GvFlag flag) { |
|
226 |
addGraphicFlag(mapControl, flag, getDefaultSymbolFlag()); |
|
227 |
} |
|
228 |
|
|
229 |
/** |
|
230 |
* @return |
|
231 |
*/ |
|
232 |
public static ISymbol getDefaultSymbolFlag() { |
|
233 |
if (simFlag == null) { |
|
234 |
|
|
235 |
simFlag = new FSymbol(FConstant.SYMBOL_TYPE_ICON); |
|
236 |
ImageIcon icon = new ImageIcon(NetworkUtils.class.getClassLoader() |
|
237 |
.getResource("images/pushpin.png")); |
|
238 |
simFlag.setIcon(icon.getImage()); |
|
239 |
simFlag.setSize(24); |
|
240 |
} |
|
241 |
return simFlag; |
|
242 |
} |
|
243 |
|
|
244 |
public static void addGraphicFlag(MapControl mapControl, GvFlag flag, |
|
245 |
ISymbol sym) { |
|
246 |
GraphicLayer graphicLayer = mapControl.getMapContext() |
|
247 |
.getGraphicsLayer(); |
|
248 |
int idSymbol = graphicLayer.getSymbol(sym); |
|
249 |
if (idSymbol == -1) { // El s?mbolo no existe todav?a en la lista de |
|
250 |
// gr?ficos |
|
251 |
idSymbol = graphicLayer.addSymbol(sym); |
|
252 |
} |
|
253 |
IGeometry gAux = ShapeFactory.createPoint2D(flag.getOriginalPoint() |
|
254 |
.getX(), flag.getOriginalPoint().getY()); |
|
255 |
FGraphic graphic = new FGraphic(gAux, idSymbol); |
|
256 |
graphic.setTag("FLAG"); |
|
257 |
graphic.setObjectTag(flag); |
|
258 |
graphicLayer.addGraphic(graphic); |
|
259 |
|
|
260 |
} |
|
261 |
|
|
262 |
/** |
|
263 |
* Receives jtsgeom, percentage of desired linestring and direction. |
|
264 |
* |
|
265 |
* @param geom |
|
266 |
* @param pct |
|
267 |
* @param direction |
|
268 |
* 1=> same as geometry. 0=> Inversed |
|
269 |
* @return partial linestring |
|
270 |
*/ |
|
271 |
public static LineString getPartialLineString(Geometry geom, double pct, |
|
272 |
int direction) |
|
273 |
// Si parte vale cero, los v?lidos son los primeros. Si no, los segundos. |
|
274 |
{ |
|
275 |
int j, numVertices; |
|
276 |
double longAcum, longReal, longBuscada, distSobre, miniPorcentaje; |
|
277 |
double nuevaX, nuevaY; // Por cuestiones de claridad al programar |
|
278 |
double dist = 0; |
|
279 |
|
|
280 |
longAcum = 0; |
|
281 |
longReal = geom.getLength(); |
|
282 |
longBuscada = longReal * pct; |
|
283 |
Coordinate[] coords = geom.getCoordinates(); |
|
284 |
Coordinate c1 = null, c2 = null; |
|
285 |
ArrayList savedCoords = new ArrayList(); |
|
286 |
|
|
287 |
if (direction > 0) // Hemos entrado por el 1 hacia el 2 (al 2 no |
|
288 |
// llegamos) |
|
289 |
{ |
|
290 |
for (j = 0; j < coords.length - 1; j++) { |
|
291 |
c1 = coords[j]; |
|
292 |
c2 = coords[j + 1]; |
|
293 |
dist = c1.distance(c2); |
|
294 |
longAcum += dist; |
|
295 |
savedCoords.add(c1); |
|
296 |
if (longAcum >= longBuscada) { |
|
297 |
// Hasta aqu?. Ahora ahi que poner el punto sobre el tramo |
|
298 |
distSobre = dist - (longAcum - longBuscada); |
|
299 |
miniPorcentaje = distSobre / dist; |
|
300 |
|
|
301 |
nuevaX = c1.x + (c2.x - c1.x) * miniPorcentaje; |
|
302 |
nuevaY = c1.y + (c2.y - c1.y) * miniPorcentaje; |
|
303 |
|
|
304 |
savedCoords.add(new Coordinate(nuevaX, nuevaY)); |
|
305 |
break; |
|
306 |
} // if longAcum >= longBuscada |
|
307 |
} // for j |
|
308 |
|
|
309 |
} else // Hemos entrado por el 2 hacia el 1 |
|
310 |
{ |
|
311 |
numVertices = 0; |
|
312 |
for (j = 0; j < coords.length; j++) { |
|
313 |
// ////////////////////////////////////////////////////////////// |
|
314 |
// 13_ene_2005: Si el ?ltimo punto es el ?ltimo punto no |
|
315 |
// podemos acceder al elemento j+1 porque nos salimos del shape |
|
316 |
// /////////////////////////////////////////////////////////////// |
|
317 |
c1 = coords[j]; |
|
318 |
if (j < coords.length - 1) { |
|
319 |
c2 = coords[j + 1]; |
|
320 |
|
|
321 |
dist = c1.distance(c2); |
|
322 |
longAcum += dist; |
|
323 |
} |
|
324 |
|
|
325 |
if (longAcum >= longBuscada) { |
|
326 |
// Hasta aqu?. Empezamos a meter puntos |
|
327 |
|
|
328 |
if (numVertices == 0) { |
|
329 |
distSobre = dist - (longAcum - longBuscada); |
|
330 |
miniPorcentaje = distSobre / dist; |
|
331 |
nuevaX = c1.x + (c2.x - c1.x) * miniPorcentaje; |
|
332 |
nuevaY = c1.y + (c2.y - c1.y) * miniPorcentaje; |
|
333 |
|
|
334 |
savedCoords.add(new Coordinate(nuevaX, nuevaY)); |
|
335 |
} else { |
|
336 |
savedCoords.add(c2); |
|
337 |
} |
|
338 |
numVertices++; |
|
339 |
// break; |
|
340 |
} // if longAcum >= longBuscada |
|
341 |
} // for j |
|
342 |
|
|
343 |
// savedCoords.add(c2); |
|
344 |
|
|
345 |
} // if else |
|
346 |
|
|
347 |
return geomFactory.createLineString((Coordinate[]) savedCoords |
|
348 |
.toArray(new Coordinate[0])); |
|
349 |
} |
|
350 |
|
|
351 |
public static double[] string2doubleArray(String str, String separator) throws NumberFormatException{ |
|
352 |
str=str.replace(" ", ""); |
|
353 |
|
|
354 |
if(!str.contains(separator)){ |
|
355 |
try{ |
|
356 |
double[] result=new double[1]; |
|
357 |
result[0]=Double.parseDouble(str); |
|
358 |
return result; |
|
359 |
} |
|
360 |
catch(NumberFormatException except){ |
|
361 |
if(str.startsWith("[") && str.endsWith("]")){ |
|
362 |
String[] tokens=str.substring(1, str.length()-1).split(":"); |
|
363 |
if(tokens.length==3){ |
|
364 |
try{ |
|
365 |
Double ini=Double.valueOf(tokens[0]); |
|
366 |
Double end=Double.valueOf(tokens[1]); |
|
367 |
Double interval=Double.valueOf(tokens[2]); |
|
368 |
|
|
369 |
int length=((int)((end-ini)/interval))+1; |
|
370 |
if(length>0){ |
|
371 |
double[] result=new double[length]; |
|
372 |
|
|
373 |
for (int i = 0; i < result.length; i++) { |
|
374 |
result[i]=ini; |
|
375 |
ini+=interval; |
|
376 |
} |
|
377 |
|
|
378 |
return result; |
|
379 |
} |
|
380 |
else{ |
|
381 |
return new double[0]; |
|
382 |
} |
|
383 |
} |
|
384 |
catch(NumberFormatException except2){ |
|
385 |
throw except2; |
|
386 |
} |
|
387 |
} |
|
388 |
else{ |
|
389 |
throw except; |
|
390 |
} |
|
391 |
} |
|
392 |
else{ |
|
393 |
throw except; |
|
394 |
} |
|
395 |
} |
|
396 |
} |
|
397 |
else{ |
|
398 |
String[] parts; |
|
399 |
parts = str.split(separator); |
|
400 |
ArrayList ret=new ArrayList(); |
|
401 |
|
|
402 |
for (int i = 0; i < parts.length; i++) { |
|
403 |
try{ |
|
404 |
ret.add(Double.valueOf(parts[i])); |
|
405 |
} |
|
406 |
catch(NumberFormatException except){ |
|
407 |
if(parts[i].startsWith("[") && parts[i].endsWith("]")){ |
|
408 |
String[] tokens=parts[i].substring(1, parts[i].length()-1).split(":"); |
|
409 |
if(tokens.length==3){ |
|
410 |
try{ |
|
411 |
Double ini=Double.valueOf(tokens[0]); |
|
412 |
Double end=Double.valueOf(tokens[1]); |
|
413 |
Double interval=Double.valueOf(tokens[2]); |
|
414 |
|
|
415 |
for (double j = ini; j <= end; j+=interval) { |
|
416 |
ret.add(Double.valueOf(j)); |
|
417 |
} |
|
418 |
} |
|
419 |
catch(NumberFormatException except2){ |
|
420 |
throw except2; |
|
421 |
} |
|
422 |
} |
|
423 |
} |
|
424 |
else{ |
|
425 |
throw except; |
|
426 |
} |
|
427 |
} |
|
428 |
} |
|
429 |
|
|
430 |
double[] result=new double[ret.size()]; |
|
431 |
for (int i = 0; i < result.length; i++) { |
|
432 |
result[i]=((Double)ret.get(i)).doubleValue(); |
|
433 |
} |
|
434 |
|
|
435 |
return result; |
|
436 |
} |
|
437 |
} |
|
438 |
|
|
439 |
/** |
|
440 |
* Truco sucio para evitar la inquisici?n. Cuando funcione, habr? que hacer |
|
441 |
* una propuesta para ver si es aceptado.... |
|
442 |
* |
|
443 |
* @param mapCtrl |
|
444 |
* @param x |
|
445 |
* @param y |
|
446 |
*/ |
|
447 |
public static void flashPoint(MapControl mapCtrl, double x, double y) { |
|
448 |
flashPoint(mapCtrl, Color.RED, 5, x, y); |
|
449 |
} |
|
450 |
|
|
451 |
|
|
452 |
/** |
|
453 |
* @param mapCtrl |
|
454 |
* @param color |
|
455 |
* @param x |
|
456 |
* @param y |
|
457 |
*/ |
|
458 |
public static void flashPoint(MapControl mapCtrl, Color color, int maxCount, double x, double y){ |
|
459 |
int delay = 100; // milliseconds |
|
460 |
MyTask task = new MyTask(mapCtrl, color, maxCount, x, y); |
|
461 |
|
|
462 |
java.util.Timer timer = new java.util.Timer(); |
|
463 |
timer.schedule(task, delay, 60); |
|
464 |
|
|
465 |
} |
|
466 |
|
|
467 |
} |
trunk/extensions/extGraph/src/org/gvsig/graph/TinExtension.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
package org.gvsig.graph; |
29 | 29 |
|
30 |
import java.awt.Component; |
|
31 |
import java.io.File; |
|
32 |
import java.sql.Types; |
|
30 | 33 |
import java.util.ArrayList; |
34 |
import java.util.Arrays; |
|
31 | 35 |
import java.util.Collection; |
32 | 36 |
|
37 |
import javax.swing.JOptionPane; |
|
38 |
|
|
33 | 39 |
import org.gvsig.exceptions.BaseException; |
34 | 40 |
import org.gvsig.fmap.algorithm.contouring.ContourCalculator; |
41 |
import org.gvsig.fmap.algorithm.triangulation.ChewTriangulator; |
|
42 |
import org.gvsig.fmap.algorithm.triangulation.PirolTriangulator; |
|
35 | 43 |
import org.gvsig.fmap.algorithm.triangulation.TIN; |
44 |
import org.gvsig.fmap.algorithm.triangulation.Triangle; |
|
36 | 45 |
import org.gvsig.fmap.algorithm.triangulation.Vertex; |
37 | 46 |
import org.gvsig.fmap.algorithm.triangulation.WatsonTriangulator; |
47 |
import org.gvsig.graph.core.NetworkUtils; |
|
48 |
import org.gvsig.gui.beans.swing.JFileChooser; |
|
38 | 49 |
|
39 | 50 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
40 | 51 |
import com.hardcode.gdbms.engine.values.NumericValue; |
52 |
import com.hardcode.gdbms.engine.values.Value; |
|
53 |
import com.hardcode.gdbms.engine.values.ValueFactory; |
|
41 | 54 |
import com.iver.andami.PluginServices; |
42 | 55 |
import com.iver.andami.plugins.Extension; |
43 | 56 |
import com.iver.andami.ui.mdiManager.IWindow; |
57 |
import com.iver.cit.gvsig.fmap.MapContext; |
|
58 |
import com.iver.cit.gvsig.fmap.core.DefaultFeature; |
|
44 | 59 |
import com.iver.cit.gvsig.fmap.core.FMultiPoint2D; |
45 | 60 |
import com.iver.cit.gvsig.fmap.core.FPoint2D; |
46 | 61 |
import com.iver.cit.gvsig.fmap.core.FShape; |
47 | 62 |
import com.iver.cit.gvsig.fmap.core.IFeature; |
48 | 63 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
49 | 64 |
import com.iver.cit.gvsig.fmap.core.v02.FConverter; |
50 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
|
65 |
import com.iver.cit.gvsig.fmap.drivers.ConcreteMemoryDriver; |
|
66 |
import com.iver.cit.gvsig.fmap.drivers.FieldDescription; |
|
67 |
import com.iver.cit.gvsig.fmap.drivers.SHPLayerDefinition; |
|
68 |
import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver; |
|
69 |
import com.iver.cit.gvsig.fmap.drivers.shp.IndexedShpDriver; |
|
70 |
import com.iver.cit.gvsig.fmap.edition.DefaultRowEdited; |
|
71 |
import com.iver.cit.gvsig.fmap.edition.IRowEdited; |
|
72 |
import com.iver.cit.gvsig.fmap.edition.writers.shp.ShpWriter; |
|
51 | 73 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
52 | 74 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
53 | 75 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
54 |
import com.iver.cit.gvsig.fmap.layers.GraphicLayer;
|
|
76 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory;
|
|
55 | 77 |
import com.iver.cit.gvsig.fmap.layers.LayersIterator; |
56 | 78 |
import com.iver.cit.gvsig.fmap.layers.ReadableVectorial; |
57 |
import com.iver.cit.gvsig.fmap.rendering.FGraphic;
|
|
79 |
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource;
|
|
58 | 80 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
81 |
import com.iver.utiles.GenericFileFilter; |
|
82 |
import com.vividsolutions.jts.geom.CoordinateList; |
|
83 |
import com.vividsolutions.jts.geom.GeometryFactory; |
|
59 | 84 |
import com.vividsolutions.jts.geom.LineString; |
85 |
import com.vividsolutions.jts.geom.LinearRing; |
|
60 | 86 |
|
61 | 87 |
public class TinExtension extends Extension { |
88 |
|
|
89 |
private static String lastPath = null; |
|
90 |
private PluginServices ps=PluginServices.getPluginServices(this); |
|
62 | 91 |
|
63 |
ArrayList<FLyrVect> pointLayers = null; |
|
92 |
private ArrayList<FLyrVect> pointLayers = null; |
|
93 |
|
|
64 | 94 |
public void execute(String actionCommand) { |
65 | 95 |
for (FLyrVect lyr : pointLayers) { |
66 | 96 |
try { |
... | ... | |
76 | 106 |
private void doTIN(FLyrVect lyrVect) throws BaseException { |
77 | 107 |
ReadableVectorial rv = lyrVect.getSource(); |
78 | 108 |
|
109 |
JFileChooser fileChooser = new JFileChooser("OPEN_LAYER_FILE_CHOOSER_ID", lastPath); |
|
110 |
fileChooser.setFileFilter(new GenericFileFilter(".shp", "Shape files", true)); |
|
111 |
fileChooser.setMultiSelectionEnabled(false); |
|
112 |
fileChooser.setDialogTitle(ps.getText("choose_file_to_save_triangles")); |
|
113 |
int result = fileChooser.showSaveDialog((Component) PluginServices.getMDIManager().getActiveWindow()); |
|
114 |
if (result == JFileChooser.CANCEL_OPTION) |
|
115 |
return; |
|
116 |
File triShpFile = fileChooser.getSelectedFile(); |
|
117 |
|
|
118 |
|
|
119 |
// fileChooser.setDialogTitle(PluginServices.getPluginServices(TinExtension.class) |
|
120 |
// .getText("choose_file_to_save_contours")); |
|
121 |
// result = fileChooser.showSaveDialog((Component) PluginServices.getMDIManager()); |
|
122 |
// if (result == JFileChooser.CANCEL_OPTION) |
|
123 |
// return; |
|
124 |
// File contourShpFile = fileChooser.getSelectedFile(); |
|
125 |
SelectableDataSource rs = lyrVect.getRecordset(); |
|
126 |
String[] selecValues = rs.getFieldNames(); |
|
127 |
String strField = (String) JOptionPane.showInputDialog(null, "choose_field", "choose_field", JOptionPane.QUESTION_MESSAGE, null, selecValues, null); |
|
128 |
|
|
129 |
int idField = rs.getFieldIndexByName(strField); |
|
130 |
String aux = JOptionPane.showInputDialog("input_contour_desired_heights_separated_by_commas (;)"); |
|
131 |
if (aux == null) |
|
132 |
return; |
|
133 |
double[] heights = NetworkUtils.string2doubleArray(aux, ";"); |
|
134 |
Arrays.sort(heights); |
|
135 |
|
|
136 |
ShpWriter triShpWriter = createShapeTriangles(triShpFile); |
|
137 |
// ShpWriter contourShpWriter = createShapeContours(triShpFile); |
|
138 |
|
|
79 | 139 |
long t1 = System.currentTimeMillis(); |
80 |
WatsonTriangulator triangulator = new WatsonTriangulator(); |
|
140 |
// WatsonTriangulator triangulator = new WatsonTriangulator(); |
|
141 |
// ChewTriangulator triangulator = new ChewTriangulator(); |
|
142 |
PirolTriangulator triangulator = new PirolTriangulator(); |
|
81 | 143 |
rv.start(); |
82 | 144 |
for (int i=0; i < rv.getShapeCount(); i++) { |
83 | 145 |
IFeature feat = rv.getFeature(i); |
... | ... | |
86 | 148 |
if (shp instanceof FPoint2D) |
87 | 149 |
{ |
88 | 150 |
FPoint2D p = (FPoint2D) geom.getInternalShape(); |
89 |
NumericValue val = (NumericValue) feat.getAttribute(0);
|
|
151 |
NumericValue val = (NumericValue) feat.getAttribute(idField);
|
|
90 | 152 |
triangulator.addVertex(new Vertex(p.getX(), p.getY(), val.doubleValue())); |
91 | 153 |
} |
92 | 154 |
if (shp instanceof FMultiPoint2D) |
... | ... | |
94 | 156 |
FMultiPoint2D multi = (FMultiPoint2D) shp; |
95 | 157 |
for (int j=0; j < multi.getNumPoints(); j++) { |
96 | 158 |
FPoint2D p = multi.getPoint(j); |
97 |
NumericValue val = (NumericValue) feat.getAttribute(0);
|
|
159 |
NumericValue val = (NumericValue) feat.getAttribute(idField);
|
|
98 | 160 |
triangulator.addVertex(new Vertex(p.getX(), p.getY(), val.doubleValue())); |
99 | 161 |
} |
100 | 162 |
} |
... | ... | |
103 | 165 |
rv.stop(); |
104 | 166 |
|
105 | 167 |
TIN tin = triangulator.calculateTriangulation(); |
168 |
|
|
169 |
|
|
170 |
GeometryFactory geomFact = new GeometryFactory(); |
|
171 |
|
|
172 |
View view = (View) PluginServices.getMDIManager().getActiveWindow(); |
|
173 |
MapContext mapContext = view.getMapControl().getMapContext(); |
|
174 |
// GraphicLayer graphicLayer = view.getMapControl().getMapContext().getGraphicsLayer(); |
|
175 |
// FSymbol symbol = new FSymbol(FShape.LINE); |
|
176 |
// int idSym = graphicLayer.addSymbol(symbol); |
|
177 |
|
|
178 |
ConcreteMemoryDriver memDriver = new ConcreteMemoryDriver(); |
|
179 |
ArrayList<String> arrayFields = new ArrayList<String>(); |
|
180 |
arrayFields.add("ID"); |
|
181 |
arrayFields.add("VALUE"); |
|
182 |
|
|
183 |
memDriver.getTableModel().setColumnIdentifiers(arrayFields.toArray()); |
|
184 |
|
|
185 |
memDriver.setShapeType(FShape.LINE); |
|
186 |
Value[] row = new Value[2]; |
|
187 |
int i = 0; |
|
106 | 188 |
ContourCalculator contourCalculator = new ContourCalculator(tin); |
107 |
Collection<LineString> contour = contourCalculator.getContour(4.7); |
|
189 |
for (int indexContour = 0; indexContour < heights.length; indexContour++) { |
|
190 |
double height = heights[indexContour]; |
|
191 |
Collection<LineString> contour = contourCalculator.getContour(height); |
|
192 |
|
|
193 |
for (LineString lineString: contour) { |
|
194 |
IGeometry geom = FConverter.jts_to_igeometry(lineString); |
|
195 |
row[0] = ValueFactory.createValue(i); |
|
196 |
row[1] = ValueFactory.createValue(height); |
|
197 |
memDriver.addGeometry(geom, row); |
|
198 |
|
|
199 |
// FGraphic graf = new FGraphic(geom, idSym); |
|
200 |
// graphicLayer.addGraphic(graf); |
|
201 |
} |
|
202 |
} // indexContour |
|
203 |
FLayer lyrContour = LayerFactory.createLayer("Contours", memDriver, mapContext.getProjection()); |
|
204 |
mapContext.getLayers().addLayer(lyrContour); |
|
108 | 205 |
|
109 |
View view = (View) PluginServices.getMDIManager().getActiveWindow(); |
|
110 |
GraphicLayer graphicLayer = view.getMapControl().getMapContext().getGraphicsLayer(); |
|
111 |
FSymbol symbol = new FSymbol(FShape.LINE); |
|
112 |
int idSym = graphicLayer.addSymbol(symbol); |
|
113 |
for (LineString lineString: contour) { |
|
114 |
IGeometry geom = FConverter.jts_to_igeometry(lineString); |
|
115 |
FGraphic graf = new FGraphic(geom, idSym); |
|
116 |
graphicLayer.addGraphic(graf); |
|
206 |
Value[] att = new Value[1]; |
|
207 |
i=0; |
|
208 |
triShpWriter.preProcess(); |
|
209 |
for (Triangle tri: tin.getTriangles()) { |
|
210 |
CoordinateList auxC = new CoordinateList(); |
|
211 |
auxC.add(tri.getV1(), true); |
|
212 |
auxC.add(tri.getV2(), true); |
|
213 |
auxC.add(tri.getV3(), true); |
|
214 |
auxC.add(tri.getV1(), true); |
|
215 |
LinearRing ring = geomFact.createLinearRing(auxC.toCoordinateArray()); |
|
216 |
IGeometry geom = FConverter.jts_to_igeometry(ring); |
|
217 |
// FGraphic graf = new FGraphic(geom, idSym); |
|
218 |
// graphicLayer.addGraphic(graf); |
|
219 |
att[0] = ValueFactory.createValue(i); |
|
220 |
DefaultFeature feat = new DefaultFeature(geom, att, i + ""); |
|
221 |
|
|
222 |
triShpWriter.process(new DefaultRowEdited(feat, IRowEdited.STATUS_ADDED, i++)); |
|
223 |
|
|
224 |
|
|
117 | 225 |
} |
226 |
triShpWriter.postProcess(); |
|
118 | 227 |
|
119 |
System.out.println("Contour = " + contour.toString()); |
|
228 |
|
|
229 |
VectorialFileDriver shpDriver = new IndexedShpDriver(); |
|
230 |
FLyrVect lyrTri = (FLyrVect) LayerFactory.createLayer("Triangles", shpDriver, triShpFile, mapContext.getProjection()); |
|
231 |
mapContext.getLayers().addLayer(lyrTri); |
|
232 |
|
|
120 | 233 |
|
121 | 234 |
} |
235 |
|
|
236 |
private ShpWriter createShapeTriangles(File file) throws BaseException { |
|
237 |
|
|
238 |
|
|
239 |
FieldDescription[] fieldsDescrip = new FieldDescription[1]; |
|
240 |
|
|
241 |
FieldDescription f1 = new FieldDescription(); |
|
242 |
f1.setFieldName("Id"); |
|
243 |
f1.setFieldType(Types.INTEGER); |
|
244 |
f1.setFieldLength(8); |
|
245 |
f1.setFieldDecimalCount(0); |
|
246 |
fieldsDescrip[0] = f1; |
|
122 | 247 |
|
248 |
SHPLayerDefinition lyrDefPolygon = new SHPLayerDefinition(); |
|
249 |
lyrDefPolygon.setFieldsDesc(fieldsDescrip); |
|
250 |
|
|
251 |
lyrDefPolygon.setFile(file); |
|
252 |
lyrDefPolygon.setName(file.getName()); |
|
253 |
lyrDefPolygon.setShapeType(FShape.LINE | FShape.Z); |
|
254 |
ShpWriter writer = new ShpWriter(); |
|
255 |
writer.setFile(file); |
|
256 |
writer.initialize(lyrDefPolygon); |
|
257 |
writer.preProcess(); |
|
258 |
writer.postProcess(); |
|
259 |
return writer; |
|
260 |
} |
|
261 |
|
|
262 |
private ShpWriter createShapeContours(File file) throws BaseException { |
|
263 |
|
|
264 |
|
|
265 |
FieldDescription[] fieldsDescrip = new FieldDescription[2]; |
|
266 |
|
|
267 |
FieldDescription f1 = new FieldDescription(); |
|
268 |
f1.setFieldName("Id"); |
|
269 |
f1.setFieldType(Types.INTEGER); |
|
270 |
f1.setFieldLength(8); |
|
271 |
f1.setFieldDecimalCount(0); |
|
272 |
fieldsDescrip[0] = f1; |
|
273 |
|
|
274 |
FieldDescription f5 = new FieldDescription(); |
|
275 |
f5.setFieldName("Height"); |
|
276 |
f5.setFieldType(Types.DOUBLE); |
|
277 |
f5.setFieldDecimalCount(3); |
|
278 |
f5.setFieldLength(16); |
|
279 |
fieldsDescrip[1] = f5; |
|
280 |
|
|
281 |
|
|
282 |
|
|
283 |
SHPLayerDefinition lyrDef = new SHPLayerDefinition(); |
|
284 |
lyrDef.setFieldsDesc(fieldsDescrip); |
|
285 |
|
|
286 |
lyrDef.setFile(file); |
|
287 |
lyrDef.setName(file.getName()); |
|
288 |
lyrDef.setShapeType(FShape.LINE); |
|
289 |
ShpWriter writer = new ShpWriter(); |
|
290 |
writer.setFile(file); |
|
291 |
writer.initialize(lyrDef); |
|
292 |
writer.preProcess(); |
|
293 |
writer.postProcess(); |
|
294 |
return writer; |
|
295 |
} |
|
296 |
|
|
297 |
|
|
123 | 298 |
public void initialize() { |
124 | 299 |
// TODO Auto-generated method stub |
125 | 300 |
|
trunk/extensions/extGraph/src/org/gvsig/fmap/algorithm/contouring/ContourCalculator.java | ||
---|---|---|
65 | 65 |
gp.add(firstPoint, true); |
66 | 66 |
gp.add(lastPoint, false); |
67 | 67 |
} |
68 |
LineString lineString = geomFactory.createLineString(gp.toCoordinateArray()); |
|
69 |
segmentList.add(lineString); |
|
68 |
if (gp.size() > 1) { |
|
69 |
LineString lineString = geomFactory.createLineString(gp.toCoordinateArray()); |
|
70 |
segmentList.add(lineString); |
|
71 |
} |
|
70 | 72 |
} |
71 | 73 |
} catch (Exception e) { |
72 | 74 |
// TODO Auto-generated catch block |
trunk/extensions/extGraph/src/org/gvsig/fmap/algorithm/triangulation/paul_chew/Triangulation.java | ||
---|---|---|
161 | 161 |
triangle = this.neighborOpposite(corner, triangle); |
162 | 162 |
} |
163 | 163 |
// No luck; try brute force |
164 |
System.out.println("Warning: Checking all triangles for " + point); |
|
164 |
// System.out.println("Warning: Checking all triangles for " + point);
|
|
165 | 165 |
for (Triangle tri: this) { |
166 | 166 |
if (point.isOutside(tri.toArray(new Pnt[0])) == null) return tri; |
167 | 167 |
} |
... | ... | |
188 | 188 |
|
189 | 189 |
// Determine the cavity and update the triangulation |
190 | 190 |
Set<Triangle> cavity = getCavity(site, triangle); |
191 |
// if (cavity.size() == 0) |
|
192 |
// { |
|
193 |
// ERROR!!! |
|
194 |
// System.out.println("cavity vac?a"); |
|
195 |
// return; |
|
196 |
// } |
|
191 | 197 |
mostRecent = update(site, cavity); |
192 | 198 |
} |
193 | 199 |
|
... | ... | |
203 | 209 |
Set<Triangle> marked = new HashSet<Triangle>(); |
204 | 210 |
toBeChecked.add(triangle); |
205 | 211 |
marked.add(triangle); |
212 |
// encroached.add(triangle); |
|
206 | 213 |
while (!toBeChecked.isEmpty()) { |
207 | 214 |
triangle = toBeChecked.remove(); |
208 | 215 |
if (site.vsCircumcircle(triangle.toArray(new Pnt[0])) == 1) |
... | ... | |
275 | 282 |
dt.delaunayPlace(new Pnt(0,0)); |
276 | 283 |
dt.delaunayPlace(new Pnt(1,0)); |
277 | 284 |
dt.delaunayPlace(new Pnt(0,1)); |
285 |
dt.delaunayPlace(new Pnt(0.5,0.5)); |
|
278 | 286 |
System.out.println("After adding 3 points, we have a " + dt); |
279 | 287 |
Triangle.moreInfo = true; |
280 | 288 |
System.out.println("Triangles: " + dt.triGraph.nodeSet()); |
trunk/extensions/extGraph/src/org/gvsig/fmap/algorithm/triangulation/FJenettTriangulator.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 {Software Colaborativo (www.scolab.es)} {development} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.fmap.algorithm.triangulation; |
|
29 |
|
|
30 |
import java.util.Iterator; |
|
31 |
|
|
32 |
import org.gvsig.fmap.algorithm.triangulation.fjenett.ITRIANGLE; |
|
33 |
import org.gvsig.fmap.algorithm.triangulation.fjenett.Triangulate; |
|
34 |
import org.gvsig.fmap.algorithm.triangulation.fjenett.XYZ; |
|
35 |
|
|
36 |
|
|
37 |
/** |
|
38 |
* @author Francisco Jos? Pe?arrubia (fjp@scolab.es) |
|
39 |
* |
|
40 |
* Adapter to F Jenett algorithm |
|
41 |
* |
|
42 |
*/ |
|
43 |
public class FJenettTriangulator extends AbstractTriangulator { |
|
44 |
|
|
45 |
// class XYZWrapper extends XYZ { |
|
46 |
// private Vertex v; |
|
47 |
// |
|
48 |
// public XYZWrapper(Vertex v) { |
|
49 |
// super(v.getX(), v.getY(), v.getZ()); |
|
50 |
// this.v = v; |
|
51 |
// } |
|
52 |
// |
|
53 |
// public Vertex getVertex() { |
|
54 |
// return v; |
|
55 |
// } |
|
56 |
// } |
|
57 |
|
|
58 |
@Override |
|
59 |
public void addVertex(Vertex v) { |
|
60 |
// TODO Auto-generated method stub |
|
61 |
super.addVertex(v); |
|
62 |
} |
|
63 |
|
|
64 |
public TIN calculateTriangulation() { |
|
65 |
int nv = tin.vertices.size(); |
|
66 |
Iterator<Vertex> it = tin.vertices.iterator(); |
|
67 |
|
|
68 |
XYZ[] points = new XYZ[nv + 3]; |
|
69 |
|
|
70 |
for (int i = 0; i < nv; i++) { |
|
71 |
Vertex v = it.next(); |
|
72 |
|
|
73 |
XYZ site = new XYZ(v.getX(), v.getY(), v.getZ()); |
|
74 |
|
|
75 |
points[i] = site; // revisar la coordenada z si no funciona |
|
76 |
} |
|
77 |
|
|
78 |
// Para el big triangle |
|
79 |
for (int i=nv; i< nv+3; i++) |
|
80 |
points[i] = new XYZ(0,0,0); |
|
81 |
|
|
82 |
ITRIANGLE[] triangles = new ITRIANGLE[nv * 3]; |
|
83 |
|
|
84 |
for (int i = 0; i < triangles.length; i++) |
|
85 |
triangles[i] = new ITRIANGLE(); |
|
86 |
|
|
87 |
int ntri = Triangulate.Triangulate(nv, points, triangles); |
|
88 |
|
|
89 |
for (int tt = 0; tt < ntri; tt++) { |
|
90 |
createTriangle(triangles[tt]); |
|
91 |
} |
|
92 |
|
|
93 |
return tin; |
|
94 |
|
|
95 |
} |
|
96 |
|
|
97 |
private void createTriangle(ITRIANGLE t) { |
|
98 |
|
|
99 |
Vertex v1 = tin.vertices.get(t.getP1()); |
|
100 |
Vertex v2 = tin.vertices.get(t.getP2()); |
|
101 |
Vertex v3 = tin.vertices.get(t.getP3()); |
|
102 |
|
|
103 |
tin.addTriangle(v1, v2, v3); |
|
104 |
} |
|
105 |
|
|
106 |
} |
|
107 |
|
trunk/extensions/extGraph/src/org/gvsig/fmap/algorithm/triangulation/AbstractTriangulator.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
package org.gvsig.fmap.algorithm.triangulation; |
29 | 29 |
|
30 |
import java.awt.geom.Rectangle2D; |
|
30 | 31 |
import java.util.ArrayList; |
31 | 32 |
import java.util.List; |
32 | 33 |
|
... | ... | |
37 | 38 |
public abstract class AbstractTriangulator implements Triangulator { |
38 | 39 |
|
39 | 40 |
protected TIN tin = new TIN(); |
41 |
protected Rectangle2D.Double fullExtent = null; |
|
42 |
protected Vertex firstVertex = null; |
|
40 | 43 |
// protected List<Vertex> vertices = new ArrayList<Vertex>(); |
41 | 44 |
// protected List<Triangle> triangles = new ArrayList<Triangle>(); |
42 | 45 |
|
43 | 46 |
public void addVertex(Vertex v) { |
44 | 47 |
tin.addVertex(v); |
48 |
if (firstVertex != null) |
|
49 |
if (fullExtent == null) { |
|
50 |
fullExtent = new Rectangle2D.Double(); |
|
51 |
fullExtent.setFrameFromDiagonal(v.getX(), v.getY(), |
|
52 |
firstVertex.getX(), firstVertex.getY()); |
|
53 |
} |
|
54 |
else |
|
55 |
fullExtent.add(v.getX(), v.getY()); |
|
56 |
|
|
57 |
if (firstVertex == null) |
|
58 |
firstVertex = v; |
|
45 | 59 |
} |
46 | 60 |
|
47 | 61 |
public List<Triangle> getTriangles() { |
trunk/extensions/extGraph/src/org/gvsig/fmap/algorithm/triangulation/fjenett/XYZ.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Software Colaborativo (www.scolab.es) development |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.fmap.algorithm.triangulation.fjenett; |
|
29 |
|
|
30 |
public class XYZ { |
|
31 |
double x, y, z; |
|
32 |
|
|
33 |
XYZ() { |
|
34 |
; |
|
35 |
} |
|
36 |
|
|
37 |
public XYZ(double _x, double _y, double _z) { |
|
38 |
this.x = _x; |
|
39 |
this.y = _y; |
|
40 |
this.z = _z; |
|
41 |
} |
|
42 |
} |
|
43 |
|
trunk/extensions/extGraph/src/org/gvsig/fmap/algorithm/triangulation/fjenett/ITRIANGLE.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 Software Colaborativo (www.scolab.es) development |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.fmap.algorithm.triangulation.fjenett; |
|
29 |
|
|
30 |
public class ITRIANGLE { |
|
31 |
int p1, p2, p3; |
|
32 |
|
|
33 |
public ITRIANGLE() { |
|
34 |
; |
|
35 |
} |
|
36 |
|
|
37 |
public int getP1() { |
|
38 |
return p1; |
|
39 |
} |
|
40 |
|
|
41 |
public void setP1(int p1) { |
|
42 |
this.p1 = p1; |
|
43 |
} |
|
44 |
|
|
45 |
public int getP2() { |
|
46 |
return p2; |
|
47 |
} |
|
48 |
|
|
49 |
public void setP2(int p2) { |
|
50 |
this.p2 = p2; |
|
51 |
} |
|
52 |
|
|
53 |
public int getP3() { |
|
54 |
return p3; |
|
55 |
} |
|
56 |
|
|
57 |
public void setP3(int p3) { |
|
58 |
this.p3 = p3; |
|
59 |
} |
|
60 |
|
|
61 |
} |
trunk/extensions/extGraph/src/org/gvsig/fmap/algorithm/triangulation/fjenett/Triangulate.java | ||
---|---|---|
40 | 40 |
* |
41 | 41 |
*/ |
42 | 42 |
|
43 |
class ITRIANGLE { |
|
44 |
int p1, p2, p3; |
|
45 | 43 |
|
46 |
ITRIANGLE() { |
|
47 |
; |
|
48 |
} |
|
49 |
} |
|
50 |
|
|
51 | 44 |
class IEDGE { |
52 | 45 |
int p1, p2; |
53 | 46 |
|
... | ... | |
57 | 50 |
} |
58 | 51 |
} |
59 | 52 |
|
60 |
class XYZ { |
|
61 |
double x, y, z; |
|
62 | 53 |
|
63 |
XYZ() { |
|
64 |
; |
|
65 |
} |
|
66 |
|
|
67 |
XYZ(double _x, double _y, double _z) { |
|
68 |
this.x = _x; |
|
69 |
this.y = _y; |
|
70 |
this.z = _z; |
|
71 |
} |
|
72 |
} |
|
73 |
|
|
74 | 54 |
public class Triangulate { |
75 | 55 |
|
76 | 56 |
public static double EPSILON = 0.000001; |
... | ... | |
150 | 130 |
* return(0); } |
151 | 131 |
*/ |
152 | 132 |
|
153 |
static int Triangulate(int nv, XYZ pxyz[], ITRIANGLE v[]) { |
|
133 |
static public int Triangulate(int nv, XYZ pxyz[], ITRIANGLE v[]) {
|
|
154 | 134 |
boolean complete[] = null; |
155 | 135 |
IEDGE edges[] = null; |
156 | 136 |
int nedge = 0; |
trunk/extensions/extGraph/src/org/gvsig/fmap/algorithm/triangulation/PirolTriangulator.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 {Software Colaborativo (www.scolab.es)} {development} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.fmap.algorithm.triangulation; |
|
29 |
|
|
30 |
import java.util.ArrayList; |
|
31 |
import java.util.Iterator; |
|
32 |
|
|
33 |
import org.gvsig.fmap.algorithm.triangulation.pirol.DelaunayCalculator; |
|
34 |
import org.gvsig.fmap.algorithm.triangulation.pirol.DelaunayPunkt; |
|
35 |
import org.gvsig.fmap.algorithm.triangulation.pirol.PolygonCreator; |
|
36 |
|
|
37 |
import com.vividsolutions.jts.geom.Coordinate; |
|
38 |
import com.vividsolutions.jts.geom.Polygon; |
|
39 |
|
|
40 |
|
|
41 |
/** |
|
42 |
* @author Francisco Jos? Pe?arrubia (fjp@scolab.es) |
|
43 |
* |
|
44 |
* Adapter to F Jenett algorithm |
|
45 |
* |
|
46 |
*/ |
|
47 |
public class PirolTriangulator extends AbstractTriangulator { |
|
48 |
|
|
49 |
// class XYZWrapper extends XYZ { |
|
50 |
// private Vertex v; |
|
51 |
// |
|
52 |
// public XYZWrapper(Vertex v) { |
|
53 |
// super(v.getX(), v.getY(), v.getZ()); |
|
54 |
// this.v = v; |
|
55 |
// } |
|
56 |
// |
|
57 |
// public Vertex getVertex() { |
|
58 |
// return v; |
|
59 |
// } |
|
60 |
// } |
|
61 |
|
|
62 |
@Override |
|
63 |
public void addVertex(Vertex v) { |
|
64 |
// TODO Auto-generated method stub |
|
65 |
super.addVertex(v); |
|
66 |
} |
|
67 |
|
|
68 |
public TIN calculateTriangulation() { |
|
69 |
int nv = tin.vertices.size(); |
|
70 |
Iterator<Vertex> it = tin.vertices.iterator(); |
|
71 |
|
|
72 |
DelaunayPunkt[] points = new DelaunayPunkt[nv]; |
|
73 |
|
|
74 |
|
|
75 |
for (int i = 0; i < nv; i++) { |
|
76 |
Vertex v = it.next(); |
|
77 |
double[] cAux = new double[2]; |
|
78 |
cAux[0] = v.getX(); |
|
79 |
cAux[1] = v.getY(); |
|
80 |
// cAux[2] = v.getZ(); |
|
81 |
DelaunayPunkt site = new DelaunayPunkt(cAux, i); |
|
82 |
|
|
83 |
points[i] = site; // revisar la coordenada z si no funciona |
|
84 |
} |
|
85 |
|
|
86 |
|
|
87 |
|
|
88 |
DelaunayCalculator pirolDelaunayCalculator = new DelaunayCalculator(points, null); |
|
89 |
try { |
|
90 |
pirolDelaunayCalculator.run(); |
|
91 |
// pirolDelaunayCalculator.createDelaunayNet(); |
|
92 |
// pirolDelaunayCalculator.compilePoints(); |
|
93 |
|
|
94 |
ArrayList<DelaunayPunkt[]> triangles = PolygonCreator.createTrianglesList(pirolDelaunayCalculator); |
|
95 |
|
|
96 |
|
|
97 |
for (int tt = 0; tt < triangles.size(); tt++) { |
|
98 |
createTriangle(triangles.get(tt)); |
|
99 |
} |
|
100 |
} catch (Exception e) { |
|
101 |
// TODO Auto-generated catch block |
|
102 |
e.printStackTrace(); |
|
103 |
} |
|
104 |
|
|
105 |
return tin; |
|
106 |
|
|
107 |
} |
|
108 |
|
|
109 |
private void createTriangle(DelaunayPunkt[] t) { |
|
110 |
|
|
111 |
Vertex v1 = tin.vertices.get(t[0].getIndex()); |
|
112 |
Vertex v2 = tin.vertices.get(t[1].getIndex()); |
|
113 |
Vertex v3 = tin.vertices.get(t[2].getIndex()); |
|
114 |
System.out.println("T[" + t[0].getIndex() + " - " + t[1].getIndex() + " - " + t[2].getIndex()); |
|
115 |
|
|
116 |
tin.addTriangle(v1, v2, v3); |
|
117 |
} |
|
118 |
|
|
119 |
} |
|
120 |
|
trunk/extensions/extGraph/src/org/gvsig/fmap/algorithm/triangulation/ChewTriangulator.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2008 {Software Colaborativo (www.scolab.es)} {development} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.fmap.algorithm.triangulation; |
|
29 |
|
|
30 |
import java.util.Iterator; |
|
31 |
|
|
32 |
import org.gvsig.fmap.algorithm.triangulation.paul_chew.Pnt; |
|
33 |
import org.gvsig.fmap.algorithm.triangulation.paul_chew.Triangle; |
|
34 |
import org.gvsig.fmap.algorithm.triangulation.paul_chew.Triangulation; |
|
35 |
|
|
36 |
|
|
37 |
/** |
Also available in: Unified diff