root / trunk / extensions / extTopology / src / com / iver / cit / gvsig / geoprocess / impl / voronoi / gui / VoronoiGeoprocessPanel.java @ 22901
History | View | Annotate | Download (4.2 KB)
1 |
/*
|
---|---|
2 |
* Created on 10-abr-2006
|
3 |
*
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
5 |
*
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
21 |
*
|
22 |
* For more information, contact:
|
23 |
*
|
24 |
* Generalitat Valenciana
|
25 |
* Conselleria d'Infraestructures i Transport
|
26 |
* Av. Blasco Ib??ez, 50
|
27 |
* 46010 VALENCIA
|
28 |
* SPAIN
|
29 |
*
|
30 |
* +34 963862235
|
31 |
* gvsig@gva.es
|
32 |
* www.gvsig.gva.es
|
33 |
*
|
34 |
* or
|
35 |
*
|
36 |
* IVER T.I. S.A
|
37 |
* Salamanca 50
|
38 |
* 46005 Valencia
|
39 |
* Spain
|
40 |
*
|
41 |
* +34 963163400
|
42 |
* dac@iver.es
|
43 |
*/
|
44 |
/* CVS MESSAGES:
|
45 |
*
|
46 |
* $Id:
|
47 |
* $Log:
|
48 |
*/
|
49 |
package com.iver.cit.gvsig.geoprocess.impl.voronoi.gui; |
50 |
|
51 |
import java.awt.event.ItemEvent; |
52 |
import java.util.Iterator; |
53 |
|
54 |
import javax.swing.ButtonGroup; |
55 |
import javax.swing.JComboBox; |
56 |
import javax.swing.JRadioButton; |
57 |
|
58 |
import org.gvsig.jts.voronoi.Voronoier; |
59 |
import org.gvsig.jts.voronoi.Voronoier.VoronoiStrategy; |
60 |
|
61 |
import com.iver.andami.PluginServices; |
62 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
63 |
import com.iver.cit.gvsig.geoprocess.core.gui.AbstractGeoprocessGridbagPanel; |
64 |
import com.iver.cit.gvsig.geoprocess.impl.voronoi.IVoronoiGeoprocessUserEntries; |
65 |
|
66 |
public class VoronoiGeoprocessPanel extends AbstractGeoprocessGridbagPanel |
67 |
implements IVoronoiGeoprocessUserEntries{
|
68 |
|
69 |
private static final long serialVersionUID = 6485409632799083097L; |
70 |
|
71 |
private JRadioButton tinRadioButton; |
72 |
|
73 |
private JRadioButton thiessenRadioButton; |
74 |
|
75 |
private JComboBox algorithmCb; |
76 |
|
77 |
|
78 |
public VoronoiGeoprocessPanel(FLayers arg0) {
|
79 |
super(arg0, PluginServices.getText(null, "Voronoi")); |
80 |
} |
81 |
|
82 |
protected void addSpecificDesign() { |
83 |
tinRadioButton = getTinRadioButton(); |
84 |
|
85 |
addComponent(tinRadioButton); |
86 |
thiessenRadioButton = getThiessenRadioButton(); |
87 |
addComponent(thiessenRadioButton); |
88 |
|
89 |
ButtonGroup buttonGroup = new ButtonGroup(); |
90 |
buttonGroup.add(tinRadioButton); |
91 |
buttonGroup.add(thiessenRadioButton); |
92 |
tinRadioButton.setSelected(true);
|
93 |
|
94 |
algorithmCb = getAlgorithmCb(); |
95 |
addComponent(algorithmCb); |
96 |
|
97 |
initSelectedItemsJCheckBox(); |
98 |
updateNumSelectedFeaturesLabel(); |
99 |
} |
100 |
|
101 |
protected void processLayerComboBoxStateChange(ItemEvent arg0) { |
102 |
} |
103 |
|
104 |
private JRadioButton getTinRadioButton() { |
105 |
if (tinRadioButton == null) { |
106 |
tinRadioButton = new JRadioButton(); |
107 |
tinRadioButton.setText(PluginServices.getText(this,
|
108 |
"Calcular_Tin")
|
109 |
+ ":");
|
110 |
// tinRadioButton.setBounds(new java.awt.Rectangle(2, 41,
|
111 |
// 287, 21));
|
112 |
} |
113 |
return tinRadioButton;
|
114 |
} |
115 |
|
116 |
private JRadioButton getThiessenRadioButton() { |
117 |
if (thiessenRadioButton == null) { |
118 |
thiessenRadioButton = new JRadioButton(); |
119 |
thiessenRadioButton.setText(PluginServices.getText(this,
|
120 |
"Calcular_Thiessen")
|
121 |
+ ":");
|
122 |
// thiessenRadioButton.setBounds(new java.awt.Rectangle(2, 10,
|
123 |
// 303, 24));
|
124 |
} |
125 |
return thiessenRadioButton;
|
126 |
} |
127 |
|
128 |
private JComboBox getAlgorithmCb(){ |
129 |
if(algorithmCb == null){ |
130 |
algorithmCb = new JComboBox(); |
131 |
Iterator<VoronoiStrategy> it = Voronoier.getRegisteredAlgorithms().iterator();
|
132 |
while(it.hasNext()){
|
133 |
algorithmCb.addItem(it.next()); |
134 |
} |
135 |
} |
136 |
return algorithmCb;
|
137 |
} |
138 |
|
139 |
public boolean computeThiessen() { |
140 |
return getThiessenRadioButton().isSelected();
|
141 |
} |
142 |
|
143 |
public boolean computeTin() { |
144 |
return getTinRadioButton().isSelected();
|
145 |
} |
146 |
|
147 |
public boolean onlyFirstLayerSelected() { |
148 |
return isFirstOnlySelected();
|
149 |
} |
150 |
|
151 |
public VoronoiStrategy getAlgorithm() {
|
152 |
return (VoronoiStrategy) getAlgorithmCb().getSelectedItem();
|
153 |
} |
154 |
|
155 |
} |
156 |
|