Revision 12555 branches/v10/extensions/extGeoProcessing/src/com/iver/cit/gvsig/geoprocess/impl/convexhull/fmap/ScalableUnionVisitor.java
ScalableUnionVisitor.java | ||
---|---|---|
45 | 45 |
* |
46 | 46 |
* $Id$ |
47 | 47 |
* $Log$ |
48 |
* Revision 1.1 2006-06-20 18:20:45 azabala |
|
48 |
* Revision 1.1.2.1 2007-07-12 09:28:17 azabala |
|
49 |
* Modifications to work with closed polylines as polygons (usual in cad files) |
|
50 |
* |
|
51 |
* Revision 1.1 2006/06/20 18:20:45 azabala |
|
49 | 52 |
* first version in cvs |
50 | 53 |
* |
51 | 54 |
* Revision 1.3 2006/06/08 18:20:59 azabala |
... | ... | |
70 | 73 |
*/ |
71 | 74 |
package com.iver.cit.gvsig.geoprocess.impl.convexhull.fmap; |
72 | 75 |
|
76 |
import com.iver.cit.gvsig.fmap.core.FShape; |
|
73 | 77 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
74 | 78 |
import com.iver.cit.gvsig.fmap.operations.strategies.VisitException; |
75 | 79 |
import com.iver.cit.gvsig.geoprocess.core.fmap.XTypes; |
76 | 80 |
import com.vividsolutions.jts.geom.Geometry; |
77 | 81 |
import com.vividsolutions.jts.geom.GeometryCollection; |
82 |
import com.vividsolutions.jts.geom.MultiLineString; |
|
78 | 83 |
|
79 | 84 |
|
80 | 85 |
|
... | ... | |
89 | 94 |
public void visit(IGeometry g, int index) throws VisitException { |
90 | 95 |
if(g == null) |
91 | 96 |
return; |
92 |
|
|
93 |
if(g.getGeometryType() != XTypes.POLYGON && |
|
94 |
g.getGeometryType() != XTypes.MULTI) |
|
97 |
Geometry actualGeometry = null; |
|
98 |
int geometryType = g.getGeometryType(); |
|
99 |
switch(geometryType){ |
|
100 |
case XTypes.POLYGON: |
|
101 |
case FShape.CIRCLE: |
|
102 |
case FShape.ELLIPSE: |
|
103 |
case FShape.POLYGON + FShape.Z: |
|
104 |
case FShape.MULTI://Este igual hay que quitarlo, pero no suele |
|
105 |
//ser devuelto por los drivers |
|
106 |
actualGeometry = g.toJTSGeometry(); |
|
107 |
break; |
|
108 |
|
|
109 |
case XTypes.LINE: |
|
110 |
case XTypes.ARC: |
|
111 |
case XTypes.LINE + XTypes.Z: |
|
112 |
actualGeometry = g.toJTSGeometry(); |
|
113 |
MultiLineString lineString = (MultiLineString) actualGeometry; |
|
114 |
if(!lineString.isClosed()) |
|
115 |
return; |
|
116 |
/* |
|
117 |
* TODO |
|
118 |
* must be faster build a multipolygon from the multilinestring |
|
119 |
* (one polygon from each linestring |
|
120 |
* */ |
|
121 |
actualGeometry = lineString.buffer(0d); |
|
122 |
break; |
|
123 |
|
|
124 |
default: |
|
95 | 125 |
return; |
96 |
|
|
97 |
Geometry actualGeometry = g.toJTSGeometry(); |
|
126 |
} |
|
98 | 127 |
if(geometry == null){ |
99 | 128 |
geometry = actualGeometry; |
100 | 129 |
}else{ |
Also available in: Unified diff