Revision 1259 org.gvsig.geoprocess/trunk/org.gvsig.geoprocess/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.union/src/main/java/org/gvsig/geoprocess/algorithm/union/UnionAlgorithm.java
UnionAlgorithm.java | ||
---|---|---|
44 | 44 |
import es.unex.sextante.exceptions.WrongParameterIDException; |
45 | 45 |
import es.unex.sextante.exceptions.WrongParameterTypeException; |
46 | 46 |
import es.unex.sextante.outputs.OutputVectorLayer; |
47 |
import org.gvsig.tools.namestranslator.NamesTranslator; |
|
47 | 48 |
|
48 | 49 |
/** |
49 | 50 |
* Union algorithm |
... | ... | |
57 | 58 |
public static final String LAYER2 = "LAYER2"; |
58 | 59 |
public static final String SELECTGEOM_INPUT = "SELECTGEOM_INPUT"; |
59 | 60 |
public static final String SELECTGEOM_OVERLAY = "SELECTGEOM_OVERLAY"; |
61 |
private NamesTranslator nameTranslator; |
|
60 | 62 |
|
61 | 63 |
/* |
62 | 64 |
* (non-Javadoc) |
... | ... | |
105 | 107 |
IVectorLayer layer2 = m_Parameters.getParameterValueAsVectorLayer(LAYER2); |
106 | 108 |
boolean selectedGeomInput = m_Parameters.getParameter(SELECTGEOM_INPUT).getParameterValueAsBoolean(); |
107 | 109 |
boolean selectedGeomOverlay = m_Parameters.getParameter(SELECTGEOM_OVERLAY).getParameterValueAsBoolean(); |
110 |
this.nameTranslator = NamesTranslator.createTrimTranslator(10); |
|
108 | 111 |
|
109 | 112 |
FeatureStore storeLayer1 = null; |
110 | 113 |
FeatureStore storeLayer2 = null; |
... | ... | |
131 | 134 |
featureType2, |
132 | 135 |
layer1.getShapeType(), |
133 | 136 |
getTranslation("Union_polygon"), |
134 |
RESULT1); |
|
137 |
RESULT1, nameTranslator);
|
|
135 | 138 |
computesUnion(storeLayer1, storeLayer2, featStoreOut1, selectedGeomInput, selectedGeomOverlay); |
136 | 139 |
} else |
137 | 140 |
//PTO-PTO |
... | ... | |
140 | 143 |
featureType2, |
141 | 144 |
layer1.getShapeType(), |
142 | 145 |
getTranslation("Union_point"), |
143 |
RESULT1); |
|
146 |
RESULT1, nameTranslator);
|
|
144 | 147 |
computesUnion(storeLayer1, storeLayer2, featStoreOut1, selectedGeomInput, selectedGeomOverlay); |
145 | 148 |
} else |
146 | 149 |
//LIN-LIN |
... | ... | |
149 | 152 |
featureType2, |
150 | 153 |
IVectorLayer.SHAPE_TYPE_POINT, |
151 | 154 |
getTranslation("Union_point"), |
152 |
RESULT1); |
|
155 |
RESULT1, nameTranslator);
|
|
153 | 156 |
computesIntersection(storeLayer1, storeLayer2, featStoreOut1, selectedGeomInput, selectedGeomOverlay, true); |
154 | 157 |
featStoreOut2 = buildOutPutStoreFromUnion(featureType1, |
155 | 158 |
featureType2, |
156 | 159 |
IVectorLayer.SHAPE_TYPE_LINE, |
157 | 160 |
getTranslation("Union_line"), |
158 |
RESULT2); |
|
161 |
RESULT2, nameTranslator);
|
|
159 | 162 |
computesDifference(storeLayer1, storeLayer2, featStoreOut2, selectedGeomInput, selectedGeomOverlay, false); |
160 | 163 |
computesDifference(storeLayer2, storeLayer1, featStoreOut2, selectedGeomInput, selectedGeomOverlay, true); |
161 | 164 |
} else |
... | ... | |
165 | 168 |
featStoreOut1 = buildOutPutStoreFromUnion(featureType1, |
166 | 169 |
featureType2, |
167 | 170 |
IVectorLayer.SHAPE_TYPE_LINE, |
168 |
getTranslation("Union_line"), RESULT1); |
|
171 |
getTranslation("Union_line"), RESULT1, nameTranslator);
|
|
169 | 172 |
computesUnion(storeLayer1, storeLayer2, featStoreOut1, selectedGeomInput, selectedGeomOverlay); |
170 | 173 |
featStoreOut2 = buildOutPutStoreFromUnion(featureType1, |
171 | 174 |
featureType2, |
172 | 175 |
IVectorLayer.SHAPE_TYPE_POLYGON, |
173 | 176 |
getTranslation("Union_polygon"), |
174 |
RESULT2); |
|
177 |
RESULT2, nameTranslator);
|
|
175 | 178 |
computesDifference(storeLayer1, storeLayer2, featStoreOut2, selectedGeomInput, selectedGeomOverlay, false); |
176 | 179 |
computesDifference(storeLayer2, storeLayer1, featStoreOut2, selectedGeomInput, selectedGeomOverlay, true); |
177 | 180 |
} else |
... | ... | |
179 | 182 |
if( (isPolygon(storeLayer1) && isPoint(storeLayer2)) || |
180 | 183 |
(isPoint(storeLayer1) && isPolygon(storeLayer2))) { |
181 | 184 |
featStoreOut1 = buildOutPutStoreFromUnion(featureType1, featureType2, IVectorLayer.SHAPE_TYPE_POINT, |
182 |
getTranslation("Union_point"), RESULT1); |
|
185 |
getTranslation("Union_point"), RESULT1, nameTranslator);
|
|
183 | 186 |
computesUnion(storeLayer1, storeLayer2, featStoreOut1, selectedGeomInput, selectedGeomOverlay); |
184 | 187 |
featStoreOut2 = buildOutPutStoreFromUnion(featureType1, featureType2, IVectorLayer.SHAPE_TYPE_POLYGON, |
185 |
getTranslation("Union_polygon"), RESULT2); |
|
188 |
getTranslation("Union_polygon"), RESULT2, nameTranslator);
|
|
186 | 189 |
computesUnion(storeLayer1, storeLayer2, featStoreOut2, selectedGeomInput, selectedGeomOverlay); |
187 | 190 |
} else |
188 | 191 |
//PTO-LIN |
189 | 192 |
if( (isPoint(storeLayer1) && isLine(storeLayer2)) || |
190 | 193 |
(isLine(storeLayer1) && isPoint(storeLayer2))) { |
191 | 194 |
featStoreOut1 = buildOutPutStoreFromUnion(featureType1, featureType2, IVectorLayer.SHAPE_TYPE_POINT, |
192 |
getTranslation("Union_point"), RESULT1); |
|
195 |
getTranslation("Union_point"), RESULT1, nameTranslator);
|
|
193 | 196 |
computesUnion(storeLayer1, storeLayer2, featStoreOut1, selectedGeomInput, selectedGeomOverlay); |
194 | 197 |
featStoreOut2 = buildOutPutStoreFromUnion(featureType1, featureType2, IVectorLayer.SHAPE_TYPE_LINE, |
195 |
getTranslation("Union_line"), RESULT2); |
|
198 |
getTranslation("Union_line"), RESULT2, nameTranslator);
|
|
196 | 199 |
computesUnion(storeLayer1, storeLayer2, featStoreOut2, selectedGeomInput, selectedGeomOverlay); |
197 | 200 |
} |
198 | 201 |
|
199 | 202 |
if(featStoreOut2 == null) { |
200 | 203 |
featStoreOut2 = buildOutPutStoreFromUnion(featureType1, featureType2, IVectorLayer.SHAPE_TYPE_WRONG, |
201 |
getTranslation("Null_Layer"), RESULT2); |
|
204 |
getTranslation("Null_Layer"), RESULT2, nameTranslator);
|
|
202 | 205 |
} |
203 | 206 |
|
204 | 207 |
} catch (ReadException e) { |
Also available in: Unified diff