Revision 244 org.gvsig.geoprocess/trunk/org.gvsig.geoprocess/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.spatialjoin/src/main/java/org/gvsig/geoprocess/algorithm/spatialjoin/SpatialJoinAlgorithm.java
SpatialJoinAlgorithm.java | ||
---|---|---|
29 | 29 |
import es.unex.sextante.exceptions.GeoAlgorithmExecutionException; |
30 | 30 |
import es.unex.sextante.exceptions.RepeatedParameterNameException; |
31 | 31 |
import es.unex.sextante.exceptions.UnsupportedOutputChannelException; |
32 |
import es.unex.sextante.gui.algorithm.GeoAlgorithmParametersPanel; |
|
32 | 33 |
import es.unex.sextante.outputs.OutputVectorLayer; |
33 | 34 |
|
34 | 35 |
import org.gvsig.fmap.dal.DALLocator; |
... | ... | |
68 | 69 |
* @see es.unex.sextante.core.GeoAlgorithm#defineCharacteristics() |
69 | 70 |
*/ |
70 | 71 |
public void defineCharacteristics(){ |
71 |
setName(Sextante.getText("Spatialjoin"));
|
|
72 |
setGroup(Sextante.getText("gvSIG_Algorithms"));
|
|
72 |
setName(getTranslation("Spatialjoin"));
|
|
73 |
setGroup(getTranslation("basic_vect_algorithms"));
|
|
73 | 74 |
// setGeneratesUserDefinedRasterOutput(false); |
74 | 75 |
|
75 | 76 |
try { |
76 | 77 |
m_Parameters.addInputVectorLayer(LAYER1, |
77 |
Sextante.getText("Input_layer"),
|
|
78 |
getTranslation("Input_layer"),
|
|
78 | 79 |
IVectorLayer.SHAPE_TYPE_WRONG, |
79 | 80 |
true); |
80 | 81 |
m_Parameters.addInputVectorLayer(LAYER2, |
81 |
Sextante.getText( "Input_layer"),
|
|
82 |
getTranslation("Input_layer"),
|
|
82 | 83 |
IVectorLayer.SHAPE_TYPE_WRONG, |
83 | 84 |
true); |
84 |
m_Parameters.addBoolean(SELECTED_GEOM, Sextante.getText("Selected_geometries"), false); |
|
85 |
m_Parameters.addBoolean(NEAREST, Sextante.getText("use_the_nearest"), false); |
|
86 |
m_Parameters.addString(FUNCTION_LIST, Sextante.getText("Function_list")); |
|
85 |
m_Parameters.addBoolean(SELECTED_GEOM, |
|
86 |
getTranslation("Selected_geometries"), false); |
|
87 |
m_Parameters.addBoolean(NEAREST, getTranslation("use_the_nearest"), |
|
88 |
false); |
|
89 |
m_Parameters.addString(FUNCTION_LIST, |
|
90 |
getTranslation("Function_list")); |
|
87 | 91 |
} catch (RepeatedParameterNameException e) { |
88 | 92 |
Sextante.addErrorToLog(e); |
89 | 93 |
} |
90 | 94 |
addOutputVectorLayer(RESULT, |
91 |
Sextante.getText("Spatialjoin"),
|
|
95 |
getTranslation("Spatialjoin"),
|
|
92 | 96 |
OutputVectorLayer.SHAPE_TYPE_UNDEFINED); |
93 | 97 |
} |
94 | 98 |
|
... | ... | |
144 | 148 |
GeometryOperation operation = null; |
145 | 149 |
FeatureStore outFeatStore = null; |
146 | 150 |
|
147 |
if(nearest) { |
|
148 |
outFeatStore = buildOutPutStoreFromUnion(featureType1, |
|
149 |
featureType2, |
|
150 |
lyr1.getShapeType(), |
|
151 |
Sextante.getText("SpatialJoin"), |
|
152 |
RESULT, |
|
153 |
"DIST", |
|
154 |
Double.class); |
|
151 |
if (nearest) { |
|
152 |
outFeatStore = |
|
153 |
buildOutPutStoreFromUnion(featureType1, featureType2, |
|
154 |
lyr1.getShapeType(), getTranslation("SpatialJoin"), |
|
155 |
RESULT, "DIST", Double.class); |
|
155 | 156 |
|
156 |
operation = new SpatiallyIndexedSpatialJoinOperation(lyr2, indexName + "_idx"); |
|
157 |
} else { |
|
158 |
outFeatStore = buildSpatialJoinOutPutStore(featureType1, |
|
159 |
lyr1.getShapeType(), |
|
160 |
Sextante.getText("SpatialJoin"), |
|
161 |
RESULT); |
|
162 |
IDissolveRule rule = new DissolveRule(0, funcMap); |
|
163 |
Summary summary = new Summary(rule, outFeatStore.getDefaultFeatureType()); |
|
164 |
operation = new IntersectsSpatialJoinOperation(lyr2, indexName + "_idx", summary); |
|
165 |
} |
|
157 |
operation = |
|
158 |
new SpatiallyIndexedSpatialJoinOperation(lyr2, indexName |
|
159 |
+ "_idx"); |
|
160 |
} else { |
|
161 |
outFeatStore = |
|
162 |
buildSpatialJoinOutPutStore(featureType1, |
|
163 |
lyr1.getShapeType(), getTranslation("SpatialJoin"), |
|
164 |
RESULT); |
|
165 |
IDissolveRule rule = new DissolveRule(0, funcMap); |
|
166 |
Summary summary = |
|
167 |
new Summary(rule, outFeatStore.getDefaultFeatureType()); |
|
168 |
operation = |
|
169 |
new IntersectsSpatialJoinOperation(lyr2, |
|
170 |
indexName + "_idx", summary); |
|
171 |
} |
|
166 | 172 |
|
167 | 173 |
operation.setTaskStatus(getStatus()); |
168 | 174 |
operation.computesGeometryOperation(lyr1.getFeatureStore(), |
... | ... | |
260 | 266 |
} |
261 | 267 |
return null; |
262 | 268 |
} |
263 |
|
|
269 |
|
|
270 |
@Override |
|
271 |
public Class<? extends GeoAlgorithmParametersPanel> getCustomParametersPanelClass() { |
|
272 |
return SpatialJoinParametersPanel.class; |
|
273 |
} |
|
264 | 274 |
} |
Also available in: Unified diff