root / trunk / extensions / extSymbology / src / org / gvsig / symbology / gui / layerproperties / DuplicateLayersMode.java @ 20768
History | View | Annotate | Download (3.6 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package org.gvsig.symbology.gui.layerproperties; |
42 |
|
43 |
import javax.swing.BorderFactory; |
44 |
import javax.swing.ButtonGroup; |
45 |
import javax.swing.JRadioButton; |
46 |
|
47 |
import org.gvsig.gui.beans.swing.GridBagLayoutPanel; |
48 |
|
49 |
import com.iver.andami.PluginServices; |
50 |
import com.iver.cit.gvsig.fmap.rendering.styling.labeling.IPlacementConstraints; |
51 |
|
52 |
public class DuplicateLayersMode extends GridBagLayoutPanel { |
53 |
private JRadioButton rdBtnRemoveDuplicates; |
54 |
private JRadioButton rdBtnOnePerFeature; |
55 |
private JRadioButton rdBtnOnePerFeaturePart; |
56 |
|
57 |
public DuplicateLayersMode() {
|
58 |
super();
|
59 |
initialize(); |
60 |
} |
61 |
private void initialize() { |
62 |
setBorder(BorderFactory.
|
63 |
createTitledBorder(null,
|
64 |
PluginServices.getText(this, "duplicate_labels"))); |
65 |
addComponent(getRdBtnRemoveDuplicates()); |
66 |
addComponent(getRdBtnOnePerFeature()); |
67 |
addComponent(getRdBtnOnePerFeaturePart()); |
68 |
|
69 |
ButtonGroup group = new ButtonGroup(); |
70 |
group.add(getRdBtnOnePerFeature()); |
71 |
group.add(getRdBtnOnePerFeaturePart()); |
72 |
group.add(getRdBtnRemoveDuplicates()); |
73 |
} |
74 |
|
75 |
|
76 |
private JRadioButton getRdBtnOnePerFeaturePart() { |
77 |
if (rdBtnOnePerFeaturePart == null) { |
78 |
rdBtnOnePerFeaturePart = new JRadioButton( |
79 |
PluginServices.getText(this, "place_one_label_per_feature_part")); |
80 |
} |
81 |
return rdBtnOnePerFeaturePart;
|
82 |
} |
83 |
|
84 |
private JRadioButton getRdBtnOnePerFeature() { |
85 |
if (rdBtnOnePerFeature == null) { |
86 |
rdBtnOnePerFeature = new JRadioButton( |
87 |
PluginServices.getText(this, "place_one_label_per_feature")); |
88 |
} |
89 |
return rdBtnOnePerFeature;
|
90 |
} |
91 |
|
92 |
private JRadioButton getRdBtnRemoveDuplicates() { |
93 |
if (rdBtnRemoveDuplicates == null) { |
94 |
rdBtnRemoveDuplicates = new JRadioButton( |
95 |
PluginServices.getText(this, "remove_duplicate_labels")); |
96 |
|
97 |
} |
98 |
return rdBtnRemoveDuplicates;
|
99 |
} |
100 |
|
101 |
public void setMode(int dupMode) { |
102 |
rdBtnRemoveDuplicates.setSelected(dupMode == IPlacementConstraints.REMOVE_DUPLICATE_LABELS); |
103 |
rdBtnOnePerFeature.setSelected(dupMode == IPlacementConstraints.ONE_LABEL_PER_FEATURE); |
104 |
rdBtnOnePerFeaturePart.setSelected(dupMode == IPlacementConstraints.ONE_LABEL_PER_FEATURE_PART); |
105 |
} |
106 |
|
107 |
public int getMode() { |
108 |
if (rdBtnRemoveDuplicates.isSelected()) {
|
109 |
return IPlacementConstraints.REMOVE_DUPLICATE_LABELS;
|
110 |
} |
111 |
if (rdBtnOnePerFeature.isSelected()) {
|
112 |
return IPlacementConstraints.ONE_LABEL_PER_FEATURE;
|
113 |
} |
114 |
if (rdBtnOnePerFeaturePart.isSelected()) {
|
115 |
return IPlacementConstraints.ONE_LABEL_PER_FEATURE_PART;
|
116 |
} |
117 |
|
118 |
throw new Error("Unsupported layer duplicates mode"); |
119 |
} |
120 |
} |