Revision 874
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.60/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.lateralbuffer/src/main/java/org/gvsig/geoprocess/algorithm/lateralbuffer/LateralBufferOperation.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.geoprocess.algorithm.lateralbuffer; |
|
25 |
|
|
26 |
import org.gvsig.fmap.dal.exception.DataException; |
|
27 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
|
28 |
import org.gvsig.fmap.dal.feature.Feature; |
|
29 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
30 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
31 |
import org.gvsig.geoprocess.algorithm.base.util.GeometryUtil; |
|
32 |
import org.gvsig.geoprocess.algorithm.base.util.JTSFacade; |
|
33 |
import org.gvsig.geoprocess.algorithm.buffer.BufferAlgorithm; |
|
34 |
import org.gvsig.geoprocess.algorithm.buffer.BufferOperation; |
|
35 |
import org.gvsig.geoprocess.algorithm.buffer.IDistance; |
|
36 |
import org.gvsig.geoprocess.lib.sextante.AbstractSextanteGeoProcess; |
|
37 |
|
|
38 |
import com.vividsolutions.jts.geom.Geometry; |
|
39 |
import com.vividsolutions.jts.operation.buffer.BufferOp; |
|
40 |
import com.vividsolutions.jts.operation.buffer.BufferParameters; |
|
41 |
import com.vividsolutions.jts.simplify.TopologyPreservingSimplifier; |
|
42 |
|
|
43 |
import es.unex.sextante.core.Sextante; |
|
44 |
|
|
45 |
/** |
|
46 |
* Lateral buffer operation |
|
47 |
* |
|
48 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
49 |
*/ |
|
50 |
public class LateralBufferOperation extends BufferOperation { |
|
51 |
private BufferParameters bufParams = null; |
|
52 |
private int lateral = LateralBufferAlgorithm.LEFT; |
|
53 |
/** |
|
54 |
* Builds an instance of this operation. |
|
55 |
* |
|
56 |
* @param distance |
|
57 |
* @param layer |
|
58 |
* @param userDistance |
|
59 |
*/ |
|
60 |
public LateralBufferOperation(IDistance distance, |
|
61 |
FeatureStore inputStore, |
|
62 |
AbstractSextanteGeoProcess p, |
|
63 |
byte tableFieldStructure, |
|
64 |
int lateral) { |
|
65 |
super(distance, inputStore, p, tableFieldStructure); |
|
66 |
this.lateral = lateral; |
|
67 |
bufParams = new BufferParameters(); |
|
68 |
bufParams.setSingleSided(true); |
|
69 |
bufParams.setEndCapStyle(capBuffer == CAP_ROUND |
|
70 |
? BufferParameters.CAP_ROUND : BufferParameters.CAP_SQUARE); |
|
71 |
} |
|
72 |
|
|
73 |
public EditableFeature invoke(org.gvsig.fmap.geom.Geometry g, |
|
74 |
Feature feature) { |
|
75 |
Geometry newGeom = null; |
|
76 |
Geometry previousExteriorRing = null; |
|
77 |
Geometry originalGeometry = GeometryUtil.geomToJTS(g); |
|
78 |
Geometry simplifiedGeometry = originalGeometry; |
|
79 |
distance.setFeature(feature); |
|
80 |
double bufferDistance = |
|
81 |
distance.getBufferDistance(projection, |
|
82 |
getDistanceUnits(), getMapUnits()); |
|
83 |
|
|
84 |
if(originalGeometry == null) |
|
85 |
return null; |
|
86 |
|
|
87 |
if (originalGeometry.getDimension() != 0) |
|
88 |
simplifiedGeometry = |
|
89 |
TopologyPreservingSimplifier.simplify(originalGeometry, |
|
90 |
bufferDistance / 10d); |
|
91 |
|
|
92 |
for (int i = 1; i <= numberOfRadialBuffers; i++) { |
|
93 |
double distRing = i * bufferDistance; |
|
94 |
|
|
95 |
if (lateral == LateralBufferAlgorithm.RIGHT) { |
|
96 |
distRing = distRing * -1; |
|
97 |
} |
|
98 |
|
|
99 |
newGeom = BufferOp.bufferOp(simplifiedGeometry, distRing, bufParams); |
|
100 |
|
|
101 |
if(i == 1) |
|
102 |
previousExteriorRing = newGeom; |
|
103 |
else { |
|
104 |
Geometry complete = newGeom; |
|
105 |
newGeom = JTSFacade.difference(newGeom, previousExteriorRing); |
|
106 |
previousExteriorRing = complete; |
|
107 |
} |
|
108 |
|
|
109 |
try { |
|
110 |
if (newGeom != null && !newGeom.isEmpty()) { |
|
111 |
if(getTableFieldStructure() == BufferAlgorithm.SOURCE_FIELDS) |
|
112 |
lastEditFeature = persister.addFeature(feature, newGeom); |
|
113 |
else |
|
114 |
lastEditFeature = persister.addFeature(newGeom, id, distRing); |
|
115 |
id++; |
|
116 |
} |
|
117 |
} catch (CreateGeometryException e) { |
|
118 |
Sextante.addErrorToLog(e); |
|
119 |
} catch (DataException e) { |
|
120 |
Sextante.addErrorToLog(e); |
|
121 |
} |
|
122 |
} |
|
123 |
|
|
124 |
return lastEditFeature; |
|
125 |
} |
|
126 |
|
|
127 |
/* |
|
128 |
* (non-Javadoc) |
|
129 |
* |
|
130 |
* @see |
|
131 |
* org.gvsig.geoprocess.algorithm.base.core.GeometryOperation#invoke(org |
|
132 |
* .gvsig.fmap.geom.Geometry, org.gvsig.fmap.dal.feature.EditableFeature) |
|
133 |
*/ |
|
134 |
public void invoke(org.gvsig.fmap.geom.Geometry g, EditableFeature feature) { |
|
135 |
invoke(g, (Feature) feature); |
|
136 |
} |
|
137 |
} |
|
0 | 138 |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.60/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.lateralbuffer/src/main/java/org/gvsig/geoprocess/algorithm/lateralbuffer/LateralBufferParametersPanel.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.geoprocess.algorithm.lateralbuffer; |
|
25 |
|
|
26 |
import java.awt.BorderLayout; |
|
27 |
import java.awt.GridBagConstraints; |
|
28 |
import java.awt.GridBagLayout; |
|
29 |
import java.awt.Insets; |
|
30 |
import java.awt.event.ActionEvent; |
|
31 |
import java.awt.event.ActionListener; |
|
32 |
import java.util.ArrayList; |
|
33 |
import java.util.List; |
|
34 |
|
|
35 |
import javax.swing.BorderFactory; |
|
36 |
import javax.swing.ButtonGroup; |
|
37 |
import javax.swing.ComboBoxModel; |
|
38 |
import javax.swing.DefaultComboBoxModel; |
|
39 |
import javax.swing.JCheckBox; |
|
40 |
import javax.swing.JComboBox; |
|
41 |
import javax.swing.JLabel; |
|
42 |
import javax.swing.JPanel; |
|
43 |
import javax.swing.JRadioButton; |
|
44 |
import javax.swing.JScrollPane; |
|
45 |
import javax.swing.JTextField; |
|
46 |
|
|
47 |
import org.gvsig.geoprocess.lib.api.GeoProcessLocator; |
|
48 |
import org.gvsig.geoprocess.sextante.gui.algorithm.AlgorithmOutputPanel; |
|
49 |
|
|
50 |
import es.unex.sextante.core.GeoAlgorithm; |
|
51 |
import es.unex.sextante.core.ObjectAndDescription; |
|
52 |
import es.unex.sextante.core.OutputObjectsSet; |
|
53 |
import es.unex.sextante.core.ParametersSet; |
|
54 |
import es.unex.sextante.core.Sextante; |
|
55 |
import es.unex.sextante.dataObjects.IVectorLayer; |
|
56 |
import es.unex.sextante.gui.algorithm.GeoAlgorithmParametersPanel; |
|
57 |
import es.unex.sextante.gui.algorithm.OutputChannelSelectionPanel; |
|
58 |
import es.unex.sextante.gui.core.SextanteGUI; |
|
59 |
import es.unex.sextante.outputs.Output; |
|
60 |
|
|
61 |
/** |
|
62 |
* Panel for lateral buffer algorithm |
|
63 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
64 |
*/ |
|
65 |
public class LateralBufferParametersPanel extends GeoAlgorithmParametersPanel implements ActionListener { |
|
66 |
private static final long serialVersionUID = 1L; |
|
67 |
private final int marginSides = 15; |
|
68 |
private final int marginBottom = 8; |
|
69 |
private GeoAlgorithm m_Algorithm = null; |
|
70 |
private JComboBox layers = null; |
|
71 |
private JComboBox fields = null; |
|
72 |
private JComboBox radialBuffers = null; |
|
73 |
private JPanel concentricalRingsPanel = null; |
|
74 |
private JComboBox lateralSelectionCombo = null; |
|
75 |
private JPanel lateralSelectionPanel = null; |
|
76 |
private JCheckBox selectionOnly = null; |
|
77 |
private JCheckBox dissolveEntities = null; |
|
78 |
private JCheckBox roundBorder = null; |
|
79 |
private JTextField distance = null; |
|
80 |
private JRadioButton selectDistance = null; |
|
81 |
private JRadioButton selectField = null; |
|
82 |
|
|
83 |
private List<String> fieldList = new ArrayList<String>(); |
|
84 |
private AlgorithmOutputPanel algorithmOutputPanel = null; |
|
85 |
private OutputChannelSelectionPanel outputChannelSelectionPanel; |
|
86 |
private JPanel outputPanel; |
|
87 |
|
|
88 |
public LateralBufferParametersPanel() { |
|
89 |
super(); |
|
90 |
} |
|
91 |
|
|
92 |
public void init(GeoAlgorithm algorithm) { |
|
93 |
m_Algorithm = algorithm; |
|
94 |
initGUI(); |
|
95 |
} |
|
96 |
|
|
97 |
private void initGUI() { |
|
98 |
this.setLayout(new BorderLayout()); |
|
99 |
this.add(getMainJScrollPane(), BorderLayout.CENTER); |
|
100 |
} |
|
101 |
|
|
102 |
private JScrollPane getMainJScrollPane() { |
|
103 |
JPanel panel = new JPanel(); |
|
104 |
GridBagLayout gbl = new GridBagLayout(); |
|
105 |
panel.setLayout(gbl); |
|
106 |
|
|
107 |
GridBagConstraints gbc = new GridBagConstraints(); |
|
108 |
gbc.fill = GridBagConstraints.HORIZONTAL; |
|
109 |
gbc.weightx = 1.0; |
|
110 |
gbc.gridx = 0; |
|
111 |
gbc.gridy = 0; |
|
112 |
gbc.insets = new Insets(0, marginSides, 0, marginSides); |
|
113 |
panel.add(getInputPanel(), gbc); |
|
114 |
|
|
115 |
gbc.gridy = 1; |
|
116 |
panel.add(getOptionsPanel(), gbc); |
|
117 |
|
|
118 |
gbc.gridy = 2; |
|
119 |
panel.add(getOutputsPanel(), gbc); |
|
120 |
JScrollPane scrollPane = new JScrollPane(panel); |
|
121 |
return scrollPane; |
|
122 |
} |
|
123 |
|
|
124 |
/** |
|
125 |
* Gets the output panel (SEXTANTE) |
|
126 |
* @return |
|
127 |
*/ |
|
128 |
private JPanel getOutputChannelSelectionPanel() { |
|
129 |
if(outputPanel == null) { |
|
130 |
try { |
|
131 |
outputPanel = new JPanel(); |
|
132 |
outputPanel.setLayout(new BorderLayout()); |
|
133 |
final OutputObjectsSet ooSet = m_Algorithm.getOutputObjects(); |
|
134 |
final Output out = ooSet.getOutput(LateralBufferAlgorithm.RESULT); |
|
135 |
outputChannelSelectionPanel = new OutputChannelSelectionPanel(out, m_Algorithm.getParameters()); |
|
136 |
outputPanel.add(new JLabel(" " + GeoProcessLocator.getGeoProcessManager().getTranslation("lateral_buffer") + |
|
137 |
" [" + GeoProcessLocator.getGeoProcessManager().getTranslation("Vectorial") + |
|
138 |
"] "), BorderLayout.WEST); |
|
139 |
outputPanel.add(outputChannelSelectionPanel, BorderLayout.CENTER); |
|
140 |
} catch (final Exception e) { |
|
141 |
Sextante.addErrorToLog(e); |
|
142 |
} |
|
143 |
} |
|
144 |
return outputPanel; |
|
145 |
} |
|
146 |
|
|
147 |
/** |
|
148 |
* Gets the output panel |
|
149 |
* @return |
|
150 |
*/ |
|
151 |
@SuppressWarnings("unused") |
|
152 |
private AlgorithmOutputPanel getAlgorithmOutputPanel() { |
|
153 |
if(algorithmOutputPanel == null) |
|
154 |
algorithmOutputPanel = new AlgorithmOutputPanel(); |
|
155 |
return algorithmOutputPanel; |
|
156 |
} |
|
157 |
|
|
158 |
/** |
|
159 |
* Gets a new input panel |
|
160 |
* @param text |
|
161 |
* @param combo |
|
162 |
* @return |
|
163 |
*/ |
|
164 |
public JPanel getOutputsPanel() { |
|
165 |
JPanel panel = new JPanel(); |
|
166 |
GridBagLayout gbl = new GridBagLayout(); |
|
167 |
panel.setLayout(gbl); |
|
168 |
panel.setBorder(BorderFactory.createTitledBorder(GeoProcessLocator.getGeoProcessManager().getTranslation("outputs"))); |
|
169 |
|
|
170 |
GridBagConstraints gbc = new GridBagConstraints(); |
|
171 |
gbc.fill = GridBagConstraints.HORIZONTAL; |
|
172 |
gbc.weightx = 1.0; |
|
173 |
gbc.insets = new Insets(0, marginSides, marginBottom, marginSides); |
|
174 |
panel.add(getOutputChannelSelectionPanel(), gbc); |
|
175 |
|
|
176 |
return panel; |
|
177 |
} |
|
178 |
|
|
179 |
/** |
|
180 |
* Gets a new input panel |
|
181 |
* @param text |
|
182 |
* @param combo |
|
183 |
* @return |
|
184 |
*/ |
|
185 |
public JPanel getInputPanel() { |
|
186 |
JPanel panel = new JPanel(); |
|
187 |
GridBagLayout gbl = new GridBagLayout(); |
|
188 |
panel.setLayout(gbl); |
|
189 |
panel.setBorder(BorderFactory.createTitledBorder(GeoProcessLocator.getGeoProcessManager().getTranslation("input"))); |
|
190 |
|
|
191 |
GridBagConstraints gbc = new GridBagConstraints(); |
|
192 |
gbc.fill = GridBagConstraints.HORIZONTAL; |
|
193 |
gbc.weightx = 1.0; |
|
194 |
gbc.insets = new Insets(0, marginSides, marginBottom, marginSides); |
|
195 |
panel.add(getComboLayers(), gbc); |
|
196 |
|
|
197 |
return panel; |
|
198 |
} |
|
199 |
|
|
200 |
/** |
|
201 |
* Gets a new options panel |
|
202 |
* @param text |
|
203 |
* @param combo |
|
204 |
* @return |
|
205 |
*/ |
|
206 |
public JPanel getOptionsPanel() { |
|
207 |
JPanel panel = new JPanel(); |
|
208 |
GridBagLayout gbl = new GridBagLayout(); |
|
209 |
panel.setLayout(gbl); |
|
210 |
panel.setBorder(BorderFactory.createTitledBorder(GeoProcessLocator.getGeoProcessManager().getTranslation("options"))); |
|
211 |
|
|
212 |
ButtonGroup group = new ButtonGroup(); |
|
213 |
group.add(getRadioSelectDistance()); |
|
214 |
group.add(getRadioSelectField()); |
|
215 |
|
|
216 |
GridBagConstraints gbc = new GridBagConstraints(); |
|
217 |
gbc.fill = GridBagConstraints.HORIZONTAL; |
|
218 |
gbc.weightx = 1.0; |
|
219 |
gbc.insets = new Insets(0, marginSides, marginBottom, marginSides); |
|
220 |
panel.add(getRadioSelectField(), gbc); |
|
221 |
|
|
222 |
gbc.gridy = 1; |
|
223 |
gbc.insets = new Insets(0, marginSides + 10, marginBottom, marginSides); |
|
224 |
panel.add(getComboFields(), gbc); |
|
225 |
|
|
226 |
gbc.gridy = 2; |
|
227 |
gbc.insets = new Insets(0, marginSides, marginBottom, marginSides); |
|
228 |
panel.add(getRadioSelectDistance(), gbc); |
|
229 |
|
|
230 |
gbc.gridy = 3; |
|
231 |
gbc.insets = new Insets(0, marginSides + 10, marginBottom, marginSides); |
|
232 |
panel.add(getTextDistance(), gbc); |
|
233 |
|
|
234 |
gbc.gridy = 4; |
|
235 |
gbc.insets = new Insets(0, marginSides, marginBottom, marginSides); |
|
236 |
panel.add(getCheckSelectedGeom(), gbc); |
|
237 |
|
|
238 |
gbc.gridy = 5; |
|
239 |
panel.add(getCheckDissolveEntities(), gbc); |
|
240 |
|
|
241 |
gbc.gridy = 6; |
|
242 |
//panel.add(getCheckRoundBorder(), gbc); |
|
243 |
|
|
244 |
gbc.gridy = 7; |
|
245 |
panel.add(getLateralSelectionPanel(), gbc); |
|
246 |
|
|
247 |
gbc.gridy = 8; |
|
248 |
panel.add(getNumberOfConcentricalRingsPanel(), gbc); |
|
249 |
|
|
250 |
return panel; |
|
251 |
} |
|
252 |
|
|
253 |
/** |
|
254 |
* Gets a ComboBox |
|
255 |
* @return |
|
256 |
*/ |
|
257 |
public JComboBox getComboLayers() { |
|
258 |
if(layers == null) { |
|
259 |
layers = new JComboBox(); |
|
260 |
ComboBoxModel comboModel = new DefaultComboBoxModel(getLayerList()); |
|
261 |
layers.setModel(comboModel); |
|
262 |
layers.addActionListener(this); |
|
263 |
} |
|
264 |
return layers; |
|
265 |
} |
|
266 |
|
|
267 |
private JPanel getLateralSelectionPanel() { |
|
268 |
if(lateralSelectionPanel == null) { |
|
269 |
lateralSelectionPanel = new JPanel(); |
|
270 |
BorderLayout ly = new BorderLayout(); |
|
271 |
ly.setHgap(5); |
|
272 |
lateralSelectionPanel.setLayout(ly); |
|
273 |
lateralSelectionPanel.add(new JLabel(GeoProcessLocator.getGeoProcessManager().getTranslation("select_lateral")), BorderLayout.WEST); |
|
274 |
lateralSelectionPanel.add(getLateralSelectionCombo(), BorderLayout.CENTER); |
|
275 |
} |
|
276 |
return lateralSelectionPanel; |
|
277 |
} |
|
278 |
|
|
279 |
/** |
|
280 |
* Gets a influence areas ComboBox |
|
281 |
* @return |
|
282 |
*/ |
|
283 |
public JComboBox getLateralSelectionCombo() { |
|
284 |
if(lateralSelectionCombo == null) { |
|
285 |
lateralSelectionCombo = new JComboBox(); |
|
286 |
lateralSelectionCombo.addItem(GeoProcessLocator.getGeoProcessManager().getTranslation("left")); |
|
287 |
lateralSelectionCombo.addItem(GeoProcessLocator.getGeoProcessManager().getTranslation("right")); |
|
288 |
lateralSelectionCombo.addActionListener(this); |
|
289 |
} |
|
290 |
return lateralSelectionCombo; |
|
291 |
} |
|
292 |
|
|
293 |
private JPanel getNumberOfConcentricalRingsPanel() { |
|
294 |
if(concentricalRingsPanel == null) { |
|
295 |
concentricalRingsPanel = new JPanel(); |
|
296 |
BorderLayout ly = new BorderLayout(); |
|
297 |
ly.setHgap(5); |
|
298 |
concentricalRingsPanel.setLayout(ly); |
|
299 |
concentricalRingsPanel.add(new JLabel(GeoProcessLocator.getGeoProcessManager().getTranslation("concentrical_rings")), BorderLayout.WEST); |
|
300 |
concentricalRingsPanel.add(getComboRadialBuffers(), BorderLayout.CENTER); |
|
301 |
} |
|
302 |
return concentricalRingsPanel; |
|
303 |
} |
|
304 |
|
|
305 |
/** |
|
306 |
* Gets a influence areas ComboBox |
|
307 |
* @return |
|
308 |
*/ |
|
309 |
public JComboBox getComboRadialBuffers() { |
|
310 |
if(radialBuffers == null) { |
|
311 |
radialBuffers = new JComboBox(); |
|
312 |
radialBuffers.addItem("1"); |
|
313 |
radialBuffers.addItem("2"); |
|
314 |
radialBuffers.addItem("3"); |
|
315 |
radialBuffers.addActionListener(this); |
|
316 |
} |
|
317 |
return radialBuffers; |
|
318 |
} |
|
319 |
|
|
320 |
/** |
|
321 |
* Gets a CheckBox |
|
322 |
* @return |
|
323 |
*/ |
|
324 |
public JCheckBox getCheckSelectedGeom() { |
|
325 |
if(selectionOnly == null) { |
|
326 |
selectionOnly = new JCheckBox(GeoProcessLocator.getGeoProcessManager().getTranslation("Selected_geometries")); |
|
327 |
} |
|
328 |
return selectionOnly; |
|
329 |
} |
|
330 |
|
|
331 |
/** |
|
332 |
* Gets a CheckBox |
|
333 |
* @return |
|
334 |
*/ |
|
335 |
public JCheckBox getCheckDissolveEntities() { |
|
336 |
if(dissolveEntities == null) { |
|
337 |
dissolveEntities = new JCheckBox(GeoProcessLocator.getGeoProcessManager().getTranslation("Dissolve_entities")); |
|
338 |
} |
|
339 |
return dissolveEntities; |
|
340 |
} |
|
341 |
|
|
342 |
/** |
|
343 |
* Gets a CheckBox |
|
344 |
* @return |
|
345 |
*/ |
|
346 |
public JCheckBox getCheckRoundBorder() { |
|
347 |
if(roundBorder == null) { |
|
348 |
roundBorder = new JCheckBox(GeoProcessLocator.getGeoProcessManager().getTranslation("Round_border")); |
|
349 |
} |
|
350 |
return roundBorder; |
|
351 |
} |
|
352 |
|
|
353 |
/** |
|
354 |
* Gets a ComboBox |
|
355 |
* @return |
|
356 |
*/ |
|
357 |
public JComboBox getComboFields() { |
|
358 |
if(fields == null) { |
|
359 |
fields = new JComboBox(); |
|
360 |
loadFieldsInAreaCombo(); |
|
361 |
fields.setEnabled(true); |
|
362 |
} |
|
363 |
return fields; |
|
364 |
} |
|
365 |
|
|
366 |
private void loadFieldsInAreaCombo() { |
|
367 |
List<String> fieldList = getFieldList(); |
|
368 |
getComboFields().removeAllItems(); |
|
369 |
for (int i = 0; i < fieldList.size(); i++) |
|
370 |
getComboFields().addItem(fieldList.get(i)); |
|
371 |
} |
|
372 |
|
|
373 |
/** |
|
374 |
* Gets a CheckBox |
|
375 |
* @return |
|
376 |
*/ |
|
377 |
public JTextField getTextDistance() { |
|
378 |
if(distance == null) { |
|
379 |
distance = new JTextField("0.0"); |
|
380 |
distance.setEnabled(false); |
|
381 |
} |
|
382 |
return distance; |
|
383 |
} |
|
384 |
|
|
385 |
/** |
|
386 |
* Gets a JRadioButton |
|
387 |
* @return |
|
388 |
*/ |
|
389 |
public JRadioButton getRadioSelectDistance() { |
|
390 |
if(selectDistance == null) { |
|
391 |
selectDistance = new JRadioButton(GeoProcessLocator.getGeoProcessManager().getTranslation("area_distance")); |
|
392 |
selectDistance.addActionListener(this); |
|
393 |
selectDistance.setSelected(false); |
|
394 |
} |
|
395 |
return selectDistance; |
|
396 |
} |
|
397 |
|
|
398 |
/** |
|
399 |
* Gets a JRadioButton |
|
400 |
* @return |
|
401 |
*/ |
|
402 |
public JRadioButton getRadioSelectField() { |
|
403 |
if(selectField == null) { |
|
404 |
selectField = new JRadioButton(GeoProcessLocator.getGeoProcessManager().getTranslation("area_field")); |
|
405 |
selectField.addActionListener(this); |
|
406 |
selectField.setSelected(true); |
|
407 |
} |
|
408 |
return selectField; |
|
409 |
} |
|
410 |
|
|
411 |
//------------------------------------------------------------ |
|
412 |
|
|
413 |
/* |
|
414 |
* (non-Javadoc) |
|
415 |
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) |
|
416 |
*/ |
|
417 |
public void actionPerformed(ActionEvent e) { |
|
418 |
if(e.getSource() == getRadioSelectDistance()) { |
|
419 |
getTextDistance().setEnabled(true); |
|
420 |
getComboFields().setEnabled(false); |
|
421 |
} |
|
422 |
|
|
423 |
if(e.getSource() == getRadioSelectField()) { |
|
424 |
getTextDistance().setEnabled(false); |
|
425 |
getTextDistance().setText("0.0"); |
|
426 |
getComboFields().setEnabled(true); |
|
427 |
} |
|
428 |
|
|
429 |
if(e.getSource() == getComboLayers()) { |
|
430 |
loadFieldsInAreaCombo(); |
|
431 |
} |
|
432 |
} |
|
433 |
|
|
434 |
|
|
435 |
|
|
436 |
@Override |
|
437 |
public void assignParameters() { |
|
438 |
try { |
|
439 |
ParametersSet params = m_Algorithm.getParameters(); |
|
440 |
params.getParameter(LateralBufferAlgorithm.LAYER).setParameterValue(getSelectedVectorLayer()); |
|
441 |
params.getParameter(LateralBufferAlgorithm.FIELD).setParameterValue(getFieldPosition()); |
|
442 |
params.getParameter(LateralBufferAlgorithm.SELECTED_GEOM).setParameterValue(getCheckSelectedGeom().isSelected()); |
|
443 |
double dist = 0; |
|
444 |
try { |
|
445 |
dist = new Double(getTextDistance().getText()); |
|
446 |
} catch(NumberFormatException e) { |
|
447 |
} |
|
448 |
params.getParameter(LateralBufferAlgorithm.DISTANCE).setParameterValue(dist); |
|
449 |
params.getParameter(LateralBufferAlgorithm.DISSOLVE).setParameterValue(getCheckDissolveEntities().isSelected()); |
|
450 |
params.getParameter(LateralBufferAlgorithm.ROUND_BORDER).setParameterValue(getCheckRoundBorder().isSelected()); |
|
451 |
params.getParameter(LateralBufferAlgorithm.RING_NUMBER).setParameterValue(getComboRadialBuffers().getSelectedIndex()); |
|
452 |
params.getParameter(LateralBufferAlgorithm.LATERAL).setParameterValue(getLateralSelectionCombo().getSelectedIndex()); |
|
453 |
|
|
454 |
OutputObjectsSet ooSet = m_Algorithm.getOutputObjects(); |
|
455 |
Output out = ooSet.getOutput(LateralBufferAlgorithm.RESULT); |
|
456 |
|
|
457 |
//Reponer estas l?neas para cambiar el panel de salida y comentar la siguiente |
|
458 |
//AlgorithmOutputPanel fsp = getAlgorithmOutputPanel(); |
|
459 |
//out.setOutputChannel(new CompositeSourceOutputChannel(fsp.getOutputParameters())); |
|
460 |
out.setOutputChannel(outputChannelSelectionPanel.getOutputChannel()); |
|
461 |
} catch (Exception e) { |
|
462 |
Sextante.addErrorToLog(e); |
|
463 |
} |
|
464 |
} |
|
465 |
|
|
466 |
|
|
467 |
|
|
468 |
@Override |
|
469 |
public void setOutputValue(String arg0, String arg1) { |
|
470 |
|
|
471 |
} |
|
472 |
|
|
473 |
@Override |
|
474 |
public void setParameterValue(String arg0, String arg1) { |
|
475 |
|
|
476 |
} |
|
477 |
|
|
478 |
/** |
|
479 |
* Gets the input layer list |
|
480 |
* @return |
|
481 |
*/ |
|
482 |
private ObjectAndDescription[] getLayerList() { |
|
483 |
IVectorLayer[] layers = SextanteGUI.getInputFactory() |
|
484 |
.getVectorLayers(IVectorLayer.SHAPE_TYPE_WRONG); |
|
485 |
ObjectAndDescription[] oad = new ObjectAndDescription[layers.length]; |
|
486 |
for (int i = 0; i < layers.length; i++) |
|
487 |
oad[i] = new ObjectAndDescription(layers[i].getName(), layers[i]); |
|
488 |
return oad; |
|
489 |
} |
|
490 |
|
|
491 |
/** |
|
492 |
* Gets the selected vector layer in the JComboBox |
|
493 |
* @return |
|
494 |
*/ |
|
495 |
private IVectorLayer getSelectedVectorLayer() { |
|
496 |
if(layers.getSelectedItem() != null) |
|
497 |
return (IVectorLayer)((ObjectAndDescription)layers.getSelectedItem()).getObject(); |
|
498 |
return null; |
|
499 |
} |
|
500 |
|
|
501 |
/** |
|
502 |
* Gets the field list of the selected layer |
|
503 |
* @return |
|
504 |
*/ |
|
505 |
public List<String> getFieldList() { |
|
506 |
IVectorLayer layer = getSelectedVectorLayer(); |
|
507 |
List<String> data = new ArrayList<String>(); |
|
508 |
fieldList.clear(); |
|
509 |
for (int i = 0; i < layer.getFieldCount(); i++) { |
|
510 |
Class type = layer.getFieldType(i); |
|
511 |
fieldList.add(layer.getFieldName(i)); |
|
512 |
if(Number.class.isAssignableFrom(type)) |
|
513 |
data.add(layer.getFieldName(i)); |
|
514 |
} |
|
515 |
return data; |
|
516 |
} |
|
517 |
|
|
518 |
private int getFieldPosition() { |
|
519 |
if(getComboFields().getSelectedItem() != null) { |
|
520 |
String label = getComboFields().getSelectedItem().toString(); |
|
521 |
for (int i = 0; i < fieldList.size(); i++) { |
|
522 |
if(fieldList.get(i).equals(label)) { |
|
523 |
return i; |
|
524 |
} |
|
525 |
} |
|
526 |
} |
|
527 |
return -1; |
|
528 |
} |
|
529 |
} |
|
0 | 530 |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.60/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.lateralbuffer/src/main/java/org/gvsig/geoprocess/algorithm/lateralbuffer/LateralBufferLibrary.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.geoprocess.algorithm.lateralbuffer; |
|
25 |
|
|
26 |
import org.gvsig.geoprocess.algorithm.base.core.AlgorithmAbstractLibrary; |
|
27 |
import org.gvsig.i18n.Messages; |
|
28 |
import org.gvsig.tools.library.LibraryException; |
|
29 |
|
|
30 |
/** |
|
31 |
* Initialization of IntersectionLibrary library. |
|
32 |
* |
|
33 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
34 |
*/ |
|
35 |
public class LateralBufferLibrary extends AlgorithmAbstractLibrary { |
|
36 |
|
|
37 |
@Override |
|
38 |
protected void doInitialize() throws LibraryException { |
|
39 |
|
|
40 |
} |
|
41 |
|
|
42 |
@Override |
|
43 |
protected void doPostInitialize() throws LibraryException { |
|
44 |
Messages.addResourceFamily( |
|
45 |
"org.gvsig.geoprocess.algorithm.lateralbuffer.lateralbuffer", |
|
46 |
LateralBufferLibrary.class.getClassLoader(), |
|
47 |
LateralBufferLibrary.class.getClass().getName()); |
|
48 |
registerGeoProcess(new LateralBufferAlgorithm()); |
|
49 |
} |
|
50 |
|
|
51 |
} |
|
0 | 52 |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.60/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.lateralbuffer/src/main/java/org/gvsig/geoprocess/algorithm/lateralbuffer/LateralBufferAlgorithm.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.geoprocess.algorithm.lateralbuffer; |
|
25 |
|
|
26 |
import org.gvsig.fmap.dal.exception.DataException; |
|
27 |
import org.gvsig.geoprocess.algorithm.buffer.BufferAlgorithm; |
|
28 |
import org.gvsig.geoprocess.algorithm.buffer.BufferOperation; |
|
29 |
import org.gvsig.geoprocess.algorithm.buffer.ConstantDistance; |
|
30 |
import org.gvsig.geoprocess.algorithm.buffer.FieldDistance; |
|
31 |
import org.gvsig.geoprocess.algorithm.buffer.IDistance; |
|
32 |
import org.gvsig.geoprocess.lib.sextante.dataObjects.FlyrVectIVectorLayer; |
|
33 |
|
|
34 |
import es.unex.sextante.additionalInfo.AdditionalInfoNumericalValue; |
|
35 |
import es.unex.sextante.core.Sextante; |
|
36 |
import es.unex.sextante.dataObjects.IVectorLayer; |
|
37 |
import es.unex.sextante.exceptions.GeoAlgorithmExecutionException; |
|
38 |
import es.unex.sextante.exceptions.OptionalParentParameterException; |
|
39 |
import es.unex.sextante.exceptions.RepeatedParameterNameException; |
|
40 |
import es.unex.sextante.exceptions.UndefinedParentParameterNameException; |
|
41 |
import es.unex.sextante.gui.algorithm.GeoAlgorithmParametersPanel; |
|
42 |
import es.unex.sextante.outputs.OutputVectorLayer; |
|
43 |
|
|
44 |
/** |
|
45 |
* Lateral buffer algorithm |
|
46 |
* |
|
47 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
48 |
*/ |
|
49 |
public class LateralBufferAlgorithm extends BufferAlgorithm { |
|
50 |
|
|
51 |
public static final String LATERAL = "LATERAL"; |
|
52 |
|
|
53 |
public static final int LEFT = 0; |
|
54 |
public static final int RIGHT = 1; |
|
55 |
|
|
56 |
private int lateral = LEFT; |
|
57 |
|
|
58 |
public void defineCharacteristics() { |
|
59 |
setName(getTranslation("lateral_buffer")); |
|
60 |
setGroup(getTranslation("basic_vect_algorithms")); |
|
61 |
// setGeneratesUserDefinedRasterOutput(false); |
|
62 |
|
|
63 |
try { |
|
64 |
m_Parameters.addInputVectorLayer(LAYER, getTranslation("Input_layer"), |
|
65 |
IVectorLayer.SHAPE_TYPE_WRONG, true); |
|
66 |
m_Parameters.addBoolean(SELECTED_GEOM, getTranslation("Selected_geometries"), false); |
|
67 |
m_Parameters.addNumericalValue(DISTANCE, getTranslation("area_distance"), 0, |
|
68 |
AdditionalInfoNumericalValue.NUMERICAL_VALUE_DOUBLE); |
|
69 |
m_Parameters.addTableField(FIELD, getTranslation("area_field"), "LAYER"); |
|
70 |
m_Parameters.addBoolean(DISSOLVE, getTranslation("Dissolve_entities"), false); |
|
71 |
m_Parameters.addSelection(RING_NUMBER, getTranslation("Number_of_rings"), |
|
72 |
new String[] { "1", "2", "3" }); |
|
73 |
m_Parameters.addBoolean(ROUND_BORDER, getTranslation("Round_border"), true); |
|
74 |
m_Parameters.addNumericalValue(LATERAL, getTranslation("select_lateral"), 0, |
|
75 |
AdditionalInfoNumericalValue.NUMERICAL_VALUE_INTEGER); |
|
76 |
} catch (RepeatedParameterNameException e) { |
|
77 |
Sextante.addErrorToLog(e); |
|
78 |
} catch (UndefinedParentParameterNameException e) { |
|
79 |
Sextante.addErrorToLog(e); |
|
80 |
} catch (OptionalParentParameterException e) { |
|
81 |
Sextante.addErrorToLog(e); |
|
82 |
} |
|
83 |
addOutputVectorLayer(RESULT, getTranslation("lateral_buffer"), |
|
84 |
OutputVectorLayer.SHAPE_TYPE_POLYGON); |
|
85 |
} |
|
86 |
|
|
87 |
/* |
|
88 |
* (non-Javadoc) |
|
89 |
* @see es.unex.sextante.core.GeoAlgorithm#processAlgorithm() |
|
90 |
*/ |
|
91 |
public boolean processAlgorithm() throws GeoAlgorithmExecutionException { |
|
92 |
if(existsOutPutFile(LateralBufferAlgorithm.RESULT, 0)) { |
|
93 |
throw new GeoAlgorithmExecutionException(getTranslation("file_exists")); |
|
94 |
} |
|
95 |
|
|
96 |
int attributePosition = m_Parameters.getParameterValueAsInt(FIELD); |
|
97 |
double distanceValue = m_Parameters.getParameter(DISTANCE).getParameterValueAsDouble(); |
|
98 |
lateral = m_Parameters.getParameterValueAsInt(LATERAL); //0:left 1:right |
|
99 |
//Default inflArea BUFFER_OUTSIDE_POLY |
|
100 |
readParameters(); |
|
101 |
|
|
102 |
if (sextanteInputLayer instanceof FlyrVectIVectorLayer) |
|
103 |
inputStore = ((FlyrVectIVectorLayer) sextanteInputLayer).getFeatureStore(); |
|
104 |
else |
|
105 |
return false; |
|
106 |
|
|
107 |
try { |
|
108 |
// Object to compute the distance |
|
109 |
IDistance distance = null; |
|
110 |
if (distanceValue == 0) |
|
111 |
distance = new FieldDistance(attributePosition); |
|
112 |
else |
|
113 |
distance = new ConstantDistance(distanceValue); |
|
114 |
|
|
115 |
BufferOperation operation = new LateralBufferOperation(distance, inputStore, this, getTableFieldsStructure(), lateral); |
|
116 |
|
|
117 |
operation.setTypeOfCap(round_border ? BufferOperation.CAP_ROUND : BufferOperation.CAP_SQUARE); |
|
118 |
operation.setNumberOfRadialBuffers(rings + 1); |
|
119 |
operation.setGeoProcess(this, 100); |
|
120 |
|
|
121 |
// Builds the output FeatureStore |
|
122 |
outputStore = buildOutPutStore(IVectorLayer.SHAPE_TYPE_POLYGON, |
|
123 |
getTranslation("lateral_buffer"), RESULT); |
|
124 |
|
|
125 |
if(!dissolve) { |
|
126 |
computesBufferAlgWithoutDissolve(operation); |
|
127 |
} else { |
|
128 |
computesBufferAlgWithDissolve(operation); |
|
129 |
} |
|
130 |
|
|
131 |
} catch (DataException e) { |
|
132 |
Sextante.addErrorToLog(e); |
|
133 |
return false; |
|
134 |
} |
|
135 |
|
|
136 |
return true; |
|
137 |
} |
|
138 |
|
|
139 |
|
|
140 |
@Override |
|
141 |
public Class<? extends GeoAlgorithmParametersPanel> getCustomParametersPanelClass() { |
|
142 |
return LateralBufferParametersPanel.class; |
|
143 |
} |
|
144 |
|
|
145 |
} |
|
0 | 146 |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.60/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.lateralbuffer/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.geoprocess.algorithm.lateralbuffer.LateralBufferLibrary |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.60/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.lateralbuffer/src/main/resources/org/gvsig/geoprocess/algorithm/lateralbuffer/lateralbuffer.properties | ||
---|---|---|
1 |
# |
|
2 |
# gvSIG. Desktop Geographic Information System. |
|
3 |
# |
|
4 |
# Copyright (C) 2007-2012 gvSIG Association. |
|
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 |
# For any additional information, do not hesitate to contact us |
|
22 |
# at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
# |
|
24 |
lateral_buffer=Buffer lateral |
|
25 |
left=Izquierda |
|
26 |
right=Derecha |
|
27 |
select_lateral=Seleccionar lateral |
|
28 |
SplitLines._Introduccion_de_datos=Cortar l?neas. Introducci?n de datos |
|
29 |
split_lines=Cortar l?neas |
|
30 |
distance_section=Distancia de la secci?n |
|
31 |
Mensaje_split=Geoproceso split.... |
|
32 |
Mensaje_procesando_split=Partiendo geometr?as... |
|
33 |
new_geoprocess=Geoprocesos nuevos |
|
34 |
concentrical_rings=N?mero de anillos concentricos |
|
0 | 35 |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.60/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.lateralbuffer/src/main/resources/org/gvsig/geoprocess/algorithm/lateralbuffer/lateralbuffer_en.properties | ||
---|---|---|
1 |
# |
|
2 |
# gvSIG. Desktop Geographic Information System. |
|
3 |
# |
|
4 |
# Copyright (C) 2007-2012 gvSIG Association. |
|
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 |
# For any additional information, do not hesitate to contact us |
|
22 |
# at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
# |
|
24 |
lateral_buffer=Lateral buffer |
|
25 |
left=Left |
|
26 |
right=Right |
|
27 |
select_lateral=Select lateral |
|
28 |
SplitLines._Introduccion_de_datos=Split lines. Data introduction |
|
29 |
split_lines=Split lines |
|
30 |
distance_section=Distance section |
|
31 |
Mensaje_split=Split geoprocess |
|
32 |
Mensaje_procesando_split=Splitting geometries... |
|
33 |
new_geoprocess=New geoprocess |
|
34 |
concentrical_rings=Number of concentrical rings |
|
0 | 35 |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.60/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.lateralbuffer/src/main/resources/help/LateralBufferAlgorithm_en.xml | ||
---|---|---|
1 |
<?xml version='1.0' encoding='ISO-8859-1' standalone='yes' ?> |
|
2 |
<!-- |
|
3 |
|
|
4 |
gvSIG. Desktop Geographic Information System. |
|
5 |
|
|
6 |
Copyright (C) 2007-2012 gvSIG Association. |
|
7 |
|
|
8 |
This program is free software; you can redistribute it and/or |
|
9 |
modify it under the terms of the GNU General Public License |
|
10 |
as published by the Free Software Foundation; either version 2 |
|
11 |
of the License, or (at your option) any later version. |
|
12 |
|
|
13 |
This program is distributed in the hope that it will be useful, |
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
GNU General Public License for more details. |
|
17 |
|
|
18 |
You should have received a copy of the GNU General Public License |
|
19 |
along with this program; if not, write to the Free Software |
|
20 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
21 |
MA 02110-1301, USA. |
|
22 |
|
|
23 |
For any additional information, do not hesitate to contact us |
|
24 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
25 |
|
|
26 |
--> |
|
27 |
<help> |
|
28 |
<element name="DESCRIPTION" text='This geoprocess creates a new polygon layer, with polygon buffers of the geometries of the input layer. Input layer geometries could have only line types. For each input geometry, you could create one or many equidistant polygon buffer rings.' description="Descripción" type="0"> |
|
29 |
<image description="" file="lateral_buffer.png"> |
|
30 |
</image> |
|
31 |
</element> |
|
32 |
<element name="ADDITIONAL_INFO" text="" description="Información adicional" type="0"> |
|
33 |
</element> |
|
34 |
<element name="EXTENSION_AUTHOR" text="Nacho Brodin" description="Algoritmo creado por" type="0"> |
|
35 |
</element> |
|
36 |
<element name="HELP_AUTHOR" text="" description="Ayuda creada por" type="0"> |
|
37 |
</element> |
|
38 |
<element name="USER_NOTES" text="" description="Notas de usuario" type="0"> |
|
39 |
</element> |
|
40 |
<element name="LAYER" text="" description="Capa de entrada" type="3"> |
|
41 |
</element> |
|
42 |
<element name="INTER" text="" description="Capa de revestimiento" type="3"> |
|
43 |
</element> |
|
44 |
<element name="CHECK" text="" description="Geometrias seleccionadas" type="3"> |
|
45 |
</element> |
|
46 |
<element name="OUTPUT_DESCRIPTION" text="" description="Descripción" type="2"> |
|
47 |
</element> |
|
48 |
<element name="RESULT" text="" description="Intersección" type="2"> |
|
49 |
</element> |
|
50 |
</help> |
|
51 |
<?xml version='1.0' encoding='ISO-8859-1' standalone='yes' ?> |
|
0 | 52 |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.60/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.lateralbuffer/src/main/resources/help/LateralBufferAlgorithm_de.xml | ||
---|---|---|
1 |
<?xml version='1.0' encoding='ISO-8859-1' standalone='yes' ?> |
|
2 |
<!-- |
|
3 |
|
|
4 |
gvSIG. Desktop Geographic Information System. |
|
5 |
|
|
6 |
Copyright (C) 2007-2012 gvSIG Association. |
|
7 |
|
|
8 |
This program is free software; you can redistribute it and/or |
|
9 |
modify it under the terms of the GNU General Public License |
|
10 |
as published by the Free Software Foundation; either version 2 |
|
11 |
of the License, or (at your option) any later version. |
|
12 |
|
|
13 |
This program is distributed in the hope that it will be useful, |
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
GNU General Public License for more details. |
|
17 |
|
|
18 |
You should have received a copy of the GNU General Public License |
|
19 |
along with this program; if not, write to the Free Software |
|
20 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
21 |
MA 02110-1301, USA. |
|
22 |
|
|
23 |
For any additional information, do not hesitate to contact us |
|
24 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
25 |
|
|
26 |
--> |
|
27 |
<help> |
|
28 |
<element name="DESCRIPTION" text='Dies schafft eine neue geoprocess Polygonlayer, mit Polygon-Puffer der Geometrien der Input-Layer. Input-Layer-Geometrien haben k?nnte nur Linientypen. F?r jeden Eingang Geometrie, k?nnten Sie einen oder mehrere ?quidistante Polygon-Puffer Ringe.' description="Descripción" type="0"> |
|
29 |
<image description="" file="lateral_buffer.png"> |
|
30 |
</image> |
|
31 |
</element> |
|
32 |
<element name="ADDITIONAL_INFO" text="" description="Información adicional" type="0"> |
|
33 |
</element> |
|
34 |
<element name="EXTENSION_AUTHOR" text="Nacho Brodin" description="Algoritmo creado por" type="0"> |
|
35 |
</element> |
|
36 |
<element name="HELP_AUTHOR" text="" description="Ayuda creada por" type="0"> |
|
37 |
</element> |
|
38 |
<element name="USER_NOTES" text="" description="Notas de usuario" type="0"> |
|
39 |
</element> |
|
40 |
<element name="LAYER" text="" description="Capa de entrada" type="3"> |
|
41 |
</element> |
|
42 |
<element name="INTER" text="" description="Capa de revestimiento" type="3"> |
|
43 |
</element> |
|
44 |
<element name="CHECK" text="" description="Geometrias seleccionadas" type="3"> |
|
45 |
</element> |
|
46 |
<element name="OUTPUT_DESCRIPTION" text="" description="Descripción" type="2"> |
|
47 |
</element> |
|
48 |
<element name="RESULT" text="" description="Intersección" type="2"> |
|
49 |
</element> |
|
50 |
</help> |
|
51 |
<?xml version='1.0' encoding='ISO-8859-1' standalone='yes' ?> |
|
0 | 52 |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.60/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.lateralbuffer/src/main/resources/help/LateralBufferAlgorithm.xml | ||
---|---|---|
1 |
<?xml version='1.0' encoding='ISO-8859-1' standalone='yes' ?> |
|
2 |
<!-- |
|
3 |
|
|
4 |
gvSIG. Desktop Geographic Information System. |
|
5 |
|
|
6 |
Copyright (C) 2007-2012 gvSIG Association. |
|
7 |
|
|
8 |
This program is free software; you can redistribute it and/or |
|
9 |
modify it under the terms of the GNU General Public License |
|
10 |
as published by the Free Software Foundation; either version 2 |
|
11 |
of the License, or (at your option) any later version. |
|
12 |
|
|
13 |
This program is distributed in the hope that it will be useful, |
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
GNU General Public License for more details. |
|
17 |
|
|
18 |
You should have received a copy of the GNU General Public License |
|
19 |
along with this program; if not, write to the Free Software |
|
20 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
21 |
MA 02110-1301, USA. |
|
22 |
|
|
23 |
For any additional information, do not hesitate to contact us |
|
24 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
25 |
|
|
26 |
--> |
|
27 |
<help> |
|
28 |
<element name="DESCRIPTION" text='Este geoproceso crea una nueva capa vectorial de polígonos, generados como zonas de influencia por el lado que hemos seleccionado de las geometrías de los elementos vectoriales de una capa de entrada. Las geometrías de la capa de entrada pueden ser de tipo lénea únicamente. Se pueden generar varios anillos concéntricos equidistantes en torno a las geometrías de entrada.' description="Descripción" type="0"> |
|
29 |
<image description="" file="lateral_buffer.jpg"> |
|
30 |
</image> |
|
31 |
</element> |
|
32 |
<element name="ADDITIONAL_INFO" text="" description="Información adicional" type="0"> |
|
33 |
</element> |
|
34 |
<element name="EXTENSION_AUTHOR" text="Nacho Brodin" description="Algoritmo creado por" type="0"> |
|
35 |
</element> |
|
36 |
<element name="HELP_AUTHOR" text="" description="Ayuda creada por" type="0"> |
|
37 |
</element> |
|
38 |
<element name="USER_NOTES" text="" description="Notas de usuario" type="0"> |
|
39 |
</element> |
|
40 |
<element name="LAYER" text="" description="Capa de entrada" type="3"> |
|
41 |
</element> |
|
42 |
<element name="INTER" text="" description="Capa de revestimiento" type="3"> |
|
43 |
</element> |
|
44 |
<element name="CHECK" text="" description="Geometrias seleccionadas" type="3"> |
|
45 |
</element> |
|
46 |
<element name="OUTPUT_DESCRIPTION" text="" description="Descripción" type="2"> |
|
47 |
</element> |
|
48 |
<element name="RESULT" text="" description="Intersección" type="2"> |
|
49 |
</element> |
|
50 |
</help> |
|
0 | 51 |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.60/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.lateralbuffer/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.geoprocess.algorithm.lateralbuffer</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
<name>org.gvsig.geoprocess.algorithm.lateralbuffer</name> |
|
7 |
|
|
8 |
<parent> |
|
9 |
<groupId>org.gvsig</groupId> |
|
10 |
<artifactId>org.gvsig.geoprocess.algorithm</artifactId> |
|
11 |
<version>2.2.60</version> |
|
12 |
</parent> |
|
13 |
|
|
14 |
<dependencies> |
|
15 |
<dependency> |
|
16 |
<groupId>org.gvsig</groupId> |
|
17 |
<artifactId>org.gvsig.geoprocess.algorithm.base</artifactId> |
|
18 |
<scope>compile</scope> |
|
19 |
</dependency> |
|
20 |
<dependency> |
|
21 |
<groupId>org.gvsig</groupId> |
|
22 |
<artifactId>org.gvsig.geoprocess.algorithm.buffer</artifactId> |
|
23 |
<scope>compile</scope> |
|
24 |
</dependency> |
|
25 |
<dependency> |
|
26 |
<groupId>org.gvsig</groupId> |
|
27 |
<artifactId>org.gvsig.andami</artifactId> |
|
28 |
<scope>compile</scope> |
|
29 |
</dependency> |
|
30 |
<dependency> |
|
31 |
<groupId>org.gvsig</groupId> |
|
32 |
<artifactId>org.gvsig.fmap.mapcontext.api</artifactId> |
|
33 |
<scope>compile</scope> |
|
34 |
</dependency> |
|
35 |
<dependency> |
|
36 |
<groupId>org.gvsig</groupId> |
|
37 |
<artifactId>org.gvsig.fmap.mapcontext.impl</artifactId> |
|
38 |
<scope>runtime</scope> |
|
39 |
</dependency> |
|
40 |
<dependency> |
|
41 |
<groupId>org.gvsig</groupId> |
|
42 |
<artifactId>org.gvsig.fmap.mapcontext.operation</artifactId> |
|
43 |
<scope>runtime</scope> |
|
44 |
</dependency> |
|
45 |
<dependency> |
|
46 |
<groupId>org.gvsig</groupId> |
|
47 |
<artifactId>org.gvsig.fmap.dal.api</artifactId> |
|
48 |
<scope>compile</scope> |
|
49 |
</dependency> |
|
50 |
<dependency> |
|
51 |
<groupId>org.gvsig</groupId> |
|
52 |
<artifactId>org.gvsig.fmap.dal.impl</artifactId> |
|
53 |
<scope>runtime</scope> |
|
54 |
</dependency> |
|
55 |
<dependency> |
|
56 |
<groupId>org.gvsig</groupId> |
|
57 |
<artifactId>org.gvsig.fmap.dal.file.lib</artifactId> |
|
58 |
<scope>compile</scope> |
|
59 |
</dependency> |
|
60 |
<dependency> |
|
61 |
<groupId>org.gvsig</groupId> |
|
62 |
<artifactId>org.gvsig.fmap.dal.spi</artifactId> |
|
63 |
<scope>compile</scope> |
|
64 |
</dependency> |
|
65 |
</dependencies> |
|
66 |
|
|
67 |
</project> |
|
0 | 68 |
org.gvsig.geoprocess/tags/org.gvsig.geoprocess-2.2.60/org.gvsig.geoprocess.algorithm/org.gvsig.geoprocess.algorithm.fusespatially/src/main/java/org/gvsig/geoprocess/algorithm/fusespatially/FuseSpatiallyAlgorithm.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2012 gvSIG Association. |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.geoprocess.algorithm.fusespatially; |
|
25 |
|
|
26 |
import java.util.ArrayList; |
|
27 |
import java.util.List; |
|
28 |
|
|
29 |
import org.gvsig.fmap.dal.exception.DataException; |
|
30 |
import org.gvsig.fmap.dal.feature.Feature; |
|
31 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
32 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
33 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
34 |
import org.gvsig.geoprocess.algorithm.dissolve.DissolveAlgorithm; |
|
35 |
import org.gvsig.geoprocess.lib.sextante.AbstractSextanteGeoProcess; |
|
36 |
import org.gvsig.geoprocess.lib.sextante.dataObjects.FlyrVectIVectorLayer; |
|
37 |
import org.gvsig.tools.task.SimpleTaskStatus; |
|
38 |
|
|
39 |
import es.unex.sextante.core.Sextante; |
|
40 |
import es.unex.sextante.dataObjects.IVectorLayer; |
|
41 |
import es.unex.sextante.exceptions.GeoAlgorithmExecutionException; |
|
42 |
import es.unex.sextante.exceptions.RepeatedParameterNameException; |
|
43 |
import es.unex.sextante.exceptions.UnsupportedOutputChannelException; |
|
44 |
import es.unex.sextante.outputs.OutputVectorLayer; |
|
45 |
import java.util.Iterator; |
|
46 |
|
|
47 |
/** |
|
48 |
* Fuse spatially algorithm |
|
49 |
* @author <a href="mailto:nachobrodin@gmail.com">Nacho Brodin</a> |
|
50 |
*/ |
|
51 |
public class FuseSpatiallyAlgorithm extends AbstractSextanteGeoProcess { |
|
52 |
|
|
53 |
public static final String RESULT = "RESULT"; |
|
54 |
public static final String RESULT_TABLE = "RESULT_TABLE"; |
|
55 |
public static final String LAYER = "LAYER"; |
|
56 |
public static final String SELECTED_GEOM = "SELECTED_GEOM"; |
|
57 |
private AbstractSextanteGeoProcess process = null; |
|
58 |
private String fid = "FID"; |
|
59 |
|
|
60 |
/* |
|
61 |
* (non-Javadoc) |
|
62 |
* @see es.unex.sextante.core.GeoAlgorithm#defineCharacteristics() |
|
63 |
*/ |
|
64 |
public void defineCharacteristics(){ |
|
65 |
setName(getTranslation("fusespatially")); |
|
66 |
setGroup(getTranslation("basic_vect_algorithms")); |
|
67 |
// setGeneratesUserDefinedRasterOutput(false); |
|
68 |
try { |
|
69 |
m_Parameters.addInputVectorLayer(LAYER, getTranslation("Input_layer"), IVectorLayer.SHAPE_TYPE_WRONG, true); |
|
70 |
m_Parameters.addBoolean(SELECTED_GEOM, getTranslation("Selected_geometries_fuse"), false); |
|
71 |
addOutputVectorLayer(RESULT, getTranslation("fuse_spatially") + " ", OutputVectorLayer.SHAPE_TYPE_UNDEFINED); |
|
72 |
addOutputVectorLayer(RESULT_TABLE, getTranslation("fuse_spatially") + "_" + getTranslation("Table") + " ", OutputVectorLayer.SHAPE_TYPE_UNDEFINED); |
|
73 |
} catch (RepeatedParameterNameException e) { |
|
74 |
Sextante.addErrorToLog(e); |
|
75 |
} |
|
76 |
} |
|
77 |
|
|
78 |
public void setParentProcess(AbstractSextanteGeoProcess process) { |
|
79 |
this.process = process; |
|
80 |
} |
|
81 |
|
|
82 |
/* |
|
83 |
* (non-Javadoc) |
|
84 |
* @see es.unex.sextante.core.GeoAlgorithm#processAlgorithm() |
|
85 |
*/ |
|
86 |
@SuppressWarnings("unchecked") |
|
87 |
public boolean processAlgorithm() throws GeoAlgorithmExecutionException { |
|
88 |
if(existsOutPutFile(DissolveAlgorithm.RESULT, 0)) { |
|
89 |
throw new GeoAlgorithmExecutionException(getTranslation("file_exists")); |
|
90 |
} |
|
91 |
IVectorLayer layer = m_Parameters.getParameterValueAsVectorLayer(LAYER); |
|
92 |
boolean selectedGeom = m_Parameters.getParameterValueAsBoolean(SELECTED_GEOM); |
|
93 |
|
|
94 |
FeatureStore storeLayer = null; |
|
95 |
if(layer instanceof FlyrVectIVectorLayer) |
|
96 |
storeLayer = ((FlyrVectIVectorLayer)layer).getFeatureStore(); |
|
97 |
else |
|
98 |
return false; |
|
99 |
|
|
100 |
try { |
|
101 |
String[] attrNames = new String[]{"FID"}; |
|
102 |
Class[] types = new Class[] {Integer.class}; |
|
103 |
|
|
104 |
FeatureStore outFeatStore = buildFuseSpatiallyOutPutStore(attrNames, types, |
|
105 |
layer.getShapeType(), getTranslation("fusespatially"), RESULT); |
|
106 |
|
|
107 |
return execute(storeLayer, outFeatStore, layer.getShapeType(), selectedGeom, getStatus(), "FID", true); |
|
108 |
} catch (DataException e) { |
|
109 |
Sextante.addErrorToLog(e); |
|
110 |
return false; |
|
111 |
} |
|
112 |
} |
|
113 |
|
|
114 |
public boolean execute(FeatureStore inputStoreLayer, |
|
115 |
FeatureStore outFeatStore, |
|
116 |
int shapeType, |
|
117 |
boolean selectedGeom, |
|
118 |
SimpleTaskStatus status, |
|
119 |
String idField, |
|
120 |
boolean createTable) throws DataException { |
|
121 |
FeatureStore outFeatStoreTable = null; |
|
122 |
String[] attrNamesTable = null; |
|
123 |
if(createTable) { |
|
124 |
attrNamesTable = new String[inputStoreLayer.getDefaultFeatureType().size() + 1]; |
|
125 |
Class[] typesTable = new Class[inputStoreLayer.getDefaultFeatureType().size() + 1]; |
|
126 |
attrNamesTable[0] = fid; |
|
127 |
typesTable[0] = Integer.class; |
|
128 |
for (int i = 0; i < inputStoreLayer.getDefaultFeatureType().size(); i++) { |
|
129 |
FeatureAttributeDescriptor attrDesc = inputStoreLayer.getDefaultFeatureType().getAttributeDescriptor(i); |
|
130 |
attrNamesTable[i + 1] = attrDesc.getName(); |
|
131 |
typesTable[i + 1] = attrDesc.getDataType().getDefaultClass(); |
|
132 |
} |
|
133 |
|
|
134 |
attrNamesTable = checkFields(attrNamesTable); |
|
135 |
outFeatStoreTable = buildFuseSpatiallyOutPutStore(attrNamesTable, typesTable, |
|
136 |
shapeType, getTranslation("fusespatially") + "_Table", RESULT_TABLE); |
|
137 |
} |
|
138 |
|
|
139 |
FuseSpatiallyOperationFast2 operation = new FuseSpatiallyOperationFast2(this); |
|
140 |
operation.setTaskStatus(getStatus()); |
|
141 |
operation.computesGeometryOperation(inputStoreLayer, |
|
142 |
outFeatStore, |
|
143 |
outFeatStoreTable, |
|
144 |
new String[]{fid}, |
|
145 |
attrNamesTable, |
|
146 |
selectedGeom, |
|
147 |
false, |
|
148 |
idField); |
|
149 |
|
|
150 |
if(getTaskMonitor().isCanceled()) |
|
151 |
return false; |
|
152 |
/*computesGeometryOperation(inputStoreLayer, outFeatStore, outFeatStoreTable, |
|
153 |
attrNames, attrNamesTable, selectedGeom, status, idField);*/ |
|
154 |
return true; |
|
155 |
} |
|
156 |
|
|
157 |
/** |
|
158 |
* Removes duplicate fields |
|
159 |
* @param names |
|
160 |
* @return |
|
161 |
*/ |
|
162 |
public String[] checkFields(String[] names) { |
|
163 |
if(names.length <= 1) |
|
164 |
return names; |
|
165 |
int cont = 0; |
|
166 |
|
|
167 |
int i = 1; |
|
168 |
while(i < names.length) { |
|
169 |
if(names[0].compareTo(names[i]) == 0) { |
|
170 |
names[0] = "FID_" + cont; |
|
171 |
i = 0; |
|
172 |
cont ++; |
|
173 |
} |
|
174 |
i ++; |
|
175 |
} |
|
176 |
return names; |
|
177 |
} |
|
178 |
|
|
179 |
|
|
180 |
/** |
|
181 |
* Computes a complete operation over the input FeatureStore. The result of this operation |
|
182 |
* is stored in the output FeatureStore. This method will call once for each geometry. |
|
183 |
* @param inFeatStore |
|
184 |
* Input FeatureStore |
|
185 |
* @param outFeatStore |
|
186 |
* Output FeatureStore |
|
187 |
* @param attrNames |
|
188 |
* List of attributes to build the output feature store |
|
189 |
* @param selectedGeom |
|
190 |
* If it is true only the selected geometries will be processed |
|
191 |
* @deprecated This method uses FuseSpatiallyOperation which is deprecated |
|
192 |
* @throws DataException |
|
193 |
*/ |
|
194 |
@SuppressWarnings("deprecation") |
|
195 |
public void computesGeometryOperation(FeatureStore inFeatStore, |
|
196 |
FeatureStore outFeatStore, |
|
197 |
FeatureStore outFeatStoreTable, |
|
198 |
String[] attrNames, |
|
199 |
String[] attrNamesTable, |
|
200 |
boolean selectedGeom, |
Also available in: Unified diff