72 |
72 |
private OutputChannelSelectionPanel outputChannelSelectionPanelLine;
|
73 |
73 |
private OutputChannelSelectionPanel outputChannelSelectionPanelPoint;
|
74 |
74 |
private JPanel outputPanel;
|
75 |
|
|
|
75 |
|
76 |
76 |
public MergeParametersPanel() {
|
77 |
77 |
super();
|
78 |
78 |
}
|
... | ... | |
85 |
85 |
private void initGUI() {
|
86 |
86 |
GridBagLayout gbl = new GridBagLayout();
|
87 |
87 |
this.setLayout(gbl);
|
88 |
|
|
|
88 |
|
89 |
89 |
GridBagConstraints gbc = new GridBagConstraints();
|
90 |
90 |
gbc.fill = GridBagConstraints.HORIZONTAL;
|
91 |
91 |
gbc.weightx = 1.0;
|
... | ... | |
93 |
93 |
gbc.gridy = 0;
|
94 |
94 |
gbc.insets = new Insets(5, 5, 8, 5);
|
95 |
95 |
this.add(getAllLayersCheck(), gbc);
|
96 |
|
|
|
96 |
|
97 |
97 |
gbc.gridy = 1;
|
98 |
98 |
gbc.fill = GridBagConstraints.BOTH;
|
99 |
99 |
gbc.insets = new Insets(0, 0, 12, 0);
|
100 |
100 |
gbc.weighty = 1.0;
|
101 |
101 |
this.add(getCheckBoxTable(), gbc);
|
102 |
|
|
|
102 |
|
103 |
103 |
gbc.gridy = 2;
|
104 |
104 |
gbc.fill = GridBagConstraints.HORIZONTAL;
|
105 |
105 |
gbc.insets = new Insets(5, 5, 8, 5);
|
106 |
106 |
gbc.weightx = 1.0;
|
107 |
107 |
gbc.weighty = 0;
|
108 |
|
this.add(getFieldsComboPanel(GeoProcessLocator.getGeoProcessManager().getTranslation("Field"), getFieldsCombo()), gbc);
|
109 |
|
|
|
108 |
this.add(getFieldsComboPanel(GeoProcessLocator.getGeoProcessManager().getTranslation("use_fields_from_layer"), getFieldsCombo()), gbc);
|
|
109 |
|
110 |
110 |
gbc.gridy = 3;
|
111 |
111 |
this.add(getOutputChannelSelectionPanel(), gbc);
|
112 |
|
|
|
112 |
|
113 |
113 |
initTable();
|
114 |
114 |
}
|
115 |
|
|
|
115 |
|
116 |
116 |
/**
|
117 |
117 |
* Gets the output panel (SEXTANTE)
|
118 |
118 |
* @return
|
... | ... | |
126 |
126 |
final Output out_pol = ooSet.getOutput(MergeAlgorithm.RESULT_POL);
|
127 |
127 |
final Output out_line = ooSet.getOutput(MergeAlgorithm.RESULT_LINE);
|
128 |
128 |
final Output out_point = ooSet.getOutput(MergeAlgorithm.RESULT_POINT);
|
129 |
|
|
|
129 |
|
130 |
130 |
outputChannelSelectionPanelPol = new OutputChannelSelectionPanel(out_pol, m_Algorithm.getParameters());
|
131 |
131 |
outputChannelSelectionPanelLine = new OutputChannelSelectionPanel(out_line, m_Algorithm.getParameters());
|
132 |
132 |
outputChannelSelectionPanelPoint = new OutputChannelSelectionPanel(out_point, m_Algorithm.getParameters());
|
133 |
|
|
|
133 |
|
134 |
134 |
String label = GeoProcessLocator.getGeoProcessManager().getTranslation("Merge");
|
135 |
|
|
|
135 |
|
136 |
136 |
GridBagConstraints gbc = new GridBagConstraints();
|
137 |
137 |
gbc.fill = GridBagConstraints.HORIZONTAL;
|
138 |
138 |
gbc.insets = new Insets(0, 0, 4, 0);
|
139 |
139 |
gbc.weightx = 1;
|
140 |
140 |
gbc.gridx = 0;
|
141 |
141 |
gbc.gridy = 0;
|
142 |
|
outputPanel.add(new JLabel(" " + label + " [" +
|
|
142 |
outputPanel.add(new JLabel(" " + label + " [" +
|
143 |
143 |
GeoProcessLocator.getGeoProcessManager().getTranslation("Polygon") + "] "), gbc);
|
144 |
|
|
|
144 |
|
145 |
145 |
gbc.gridx = 0;
|
146 |
146 |
gbc.gridy = 1;
|
147 |
147 |
outputPanel.add(new JLabel(" " + label + " [" +
|
148 |
148 |
GeoProcessLocator.getGeoProcessManager().getTranslation("Line") + "] "), gbc);
|
149 |
|
|
|
149 |
|
150 |
150 |
gbc.gridx = 0;
|
151 |
151 |
gbc.gridy = 2;
|
152 |
152 |
outputPanel.add(new JLabel(" " + label + " [" +
|
153 |
153 |
GeoProcessLocator.getGeoProcessManager().getTranslation("Point") + "] "), gbc);
|
154 |
|
|
|
154 |
|
155 |
155 |
gbc.fill = GridBagConstraints.HORIZONTAL;
|
156 |
156 |
gbc.weightx = 1;
|
157 |
157 |
gbc.gridx = 1;
|
158 |
158 |
gbc.gridy = 0;
|
159 |
159 |
outputPanel.add(outputChannelSelectionPanelPol, gbc);
|
160 |
|
|
|
160 |
|
161 |
161 |
gbc.gridx = 1;
|
162 |
162 |
gbc.gridy = 1;
|
163 |
163 |
outputPanel.add(outputChannelSelectionPanelLine, gbc);
|
164 |
|
|
|
164 |
|
165 |
165 |
gbc.gridx = 1;
|
166 |
166 |
gbc.gridy = 2;
|
167 |
167 |
outputPanel.add(outputChannelSelectionPanelPoint, gbc);
|
... | ... | |
171 |
171 |
}
|
172 |
172 |
return outputPanel;
|
173 |
173 |
}
|
174 |
|
|
|
174 |
|
175 |
175 |
/**
|
176 |
176 |
* Gets the output panel (DAL)
|
177 |
177 |
* @return
|
... | ... | |
182 |
182 |
algorithmOutputPanel = new AlgorithmOutputPanel();
|
183 |
183 |
return algorithmOutputPanel;
|
184 |
184 |
}
|
185 |
|
|
|
185 |
|
186 |
186 |
/**
|
187 |
|
* Gets a new JPanel with the text and JComboBox
|
|
187 |
* Gets a new JPanel with the text and JComboBox
|
188 |
188 |
* @param text
|
189 |
189 |
* @param combo
|
190 |
190 |
* @return
|
... | ... | |
195 |
195 |
panel.setLayout(gbl);
|
196 |
196 |
|
197 |
197 |
GridBagConstraints gbc = new GridBagConstraints();
|
198 |
|
gbc.fill = GridBagConstraints.NONE;
|
199 |
|
gbc.weightx = 0;
|
|
198 |
gbc.fill = GridBagConstraints.HORIZONTAL;
|
|
199 |
gbc.weightx = 1.0;
|
200 |
200 |
gbc.gridx = 0;
|
201 |
|
gbc.insets = new Insets(0, 2, 0, 50);
|
|
201 |
gbc.insets = new Insets(0, 0, 4, 0);
|
202 |
202 |
JLabel label = new JLabel(text);
|
203 |
|
label.setPreferredSize(new Dimension(80, 18));
|
|
203 |
// label.setPreferredSize(new Dimension(80, 18));
|
204 |
204 |
panel.add(label, gbc);
|
205 |
205 |
|
206 |
206 |
gbc.fill = GridBagConstraints.HORIZONTAL;
|
207 |
207 |
gbc.weightx = 1.0;
|
208 |
208 |
gbc.gridx = 1;
|
209 |
|
gbc.anchor = GridBagConstraints.EAST;
|
210 |
|
gbc.insets = new Insets(0, 2, 0, 0);
|
|
209 |
// gbc.anchor = GridBagConstraints.EAST;
|
|
210 |
gbc.insets = new Insets(0, 0, 4, 0);
|
211 |
211 |
panel.add(combo, gbc);
|
212 |
212 |
return panel;
|
213 |
213 |
}
|
214 |
|
|
|
214 |
|
215 |
215 |
/**
|
216 |
216 |
* Gets a ComboBox
|
217 |
217 |
* @return
|
... | ... | |
219 |
219 |
public JComboBox getFieldsCombo() {
|
220 |
220 |
if(fieldsCombo == null) {
|
221 |
221 |
fieldsCombo = new JComboBox();
|
222 |
|
fieldsCombo.setPreferredSize(new Dimension(0, 18));
|
|
222 |
// fieldsCombo.setPreferredSize(new Dimension(0, 18));
|
223 |
223 |
ObjectAndDescription[] fieldList = getLayerList();
|
224 |
224 |
fieldsCombo.removeAllItems();
|
225 |
|
for (int i = 0; i < fieldList.length; i++)
|
|
225 |
for (int i = 0; i < fieldList.length; i++)
|
226 |
226 |
fieldsCombo.addItem(fieldList[i]);
|
227 |
227 |
}
|
228 |
228 |
return fieldsCombo;
|
229 |
229 |
}
|
230 |
|
|
|
230 |
|
231 |
231 |
/**
|
232 |
232 |
* Gets a CheckBox
|
233 |
233 |
* @return
|
... | ... | |
253 |
253 |
}
|
254 |
254 |
return table;
|
255 |
255 |
}
|
256 |
|
|
|
256 |
|
257 |
257 |
//------------------------------------------------------------
|
258 |
|
|
|
258 |
|
259 |
259 |
/*
|
260 |
260 |
* (non-Javadoc)
|
261 |
261 |
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
|
... | ... | |
275 |
275 |
}
|
276 |
276 |
}
|
277 |
277 |
}
|
278 |
|
|
|
278 |
|
279 |
279 |
/**
|
280 |
280 |
* Adds to the table one entry for each field
|
281 |
281 |
*/
|
... | ... | |
292 |
292 |
|
293 |
293 |
/**
|
294 |
294 |
* Adds one entry to the table
|
295 |
|
* @param layerName
|
|
295 |
* @param layerName
|
296 |
296 |
* Layer name
|
297 |
|
* @throws NotInitializeException
|
|
297 |
* @throws NotInitializeException
|
298 |
298 |
*/
|
299 |
299 |
private void addTableRow(String layerName) throws NotInitializeException {
|
300 |
|
Object[] row = { new Boolean(false),
|
|
300 |
Object[] row = { new Boolean(false),
|
301 |
301 |
layerName };
|
302 |
302 |
getCheckBoxTable().addRow(row);
|
303 |
303 |
}
|
304 |
|
|
|
304 |
|
305 |
305 |
@Override
|
306 |
306 |
public void assignParameters() {
|
307 |
307 |
try {
|
308 |
308 |
ParametersSet params = m_Algorithm.getParameters();
|
309 |
309 |
params.getParameter(MergeAlgorithm.FIELDLAYER).setParameterValue(getSelectedVectorLayer());
|
310 |
310 |
params.getParameter(MergeAlgorithm.LAYERS).setParameterValue(getSelectedLayerList());
|
311 |
|
|
|
311 |
|
312 |
312 |
OutputObjectsSet ooSet = m_Algorithm.getOutputObjects();
|
313 |
313 |
Output outPol = ooSet.getOutput(MergeAlgorithm.RESULT_POL);
|
314 |
314 |
Output outLine = ooSet.getOutput(MergeAlgorithm.RESULT_LINE);
|
315 |
315 |
Output outPoint = ooSet.getOutput(MergeAlgorithm.RESULT_POINT);
|
316 |
|
|
|
316 |
|
317 |
317 |
//Reponer estas l?neas para cambiar el panel de salida y comentar la siguiente
|
318 |
318 |
//AlgorithmOutputPanel fsp = getAlgorithmOutputPanel();
|
319 |
319 |
//out.setOutputChannel(new CompositeSourceOutputChannel(fsp.getOutputParameters()));
|
... | ... | |
327 |
327 |
|
328 |
328 |
@Override
|
329 |
329 |
public void setOutputValue(String arg0, String arg1) {
|
330 |
|
|
|
330 |
|
331 |
331 |
}
|
332 |
332 |
|
333 |
333 |
@Override
|
334 |
334 |
public void setParameterValue(String arg0, String arg1) {
|
335 |
|
|
|
335 |
|
336 |
336 |
}
|
337 |
|
|
|
337 |
|
338 |
338 |
/**
|
339 |
339 |
* Gets the input layer list
|
340 |
340 |
* @return
|
... | ... | |
349 |
349 |
}
|
350 |
350 |
return layerList;
|
351 |
351 |
}
|
352 |
|
|
|
352 |
|
353 |
353 |
/**
|
354 |
354 |
* Gets the list of selected layers
|
355 |
355 |
* @return
|
... | ... | |
364 |
364 |
}
|
365 |
365 |
return vLayer;
|
366 |
366 |
}
|
367 |
|
|
|
367 |
|
368 |
368 |
/**
|
369 |
369 |
* Gets the selected vector layer in the JComboBox
|
370 |
370 |
* @return
|
... | ... | |
374 |
374 |
return (IVectorLayer)((ObjectAndDescription)getFieldsCombo().getSelectedItem()).getObject();
|
375 |
375 |
return null;
|
376 |
376 |
}
|
377 |
|
|
|
377 |
|
378 |
378 |
}
|