svn-gvsig-desktop / branches / v10 / extensions / extAnnotations / src / com / iver / cit / gvsig / project / documents / view / legend / gui / PanelLegendAnnotation.java @ 12131
History | View | Annotate | Download (6.67 KB)
1 |
/*
|
---|---|
2 |
* Created on 01-jun-2004
|
3 |
*
|
4 |
*/
|
5 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
6 |
*
|
7 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
8 |
*
|
9 |
* This program is free software; you can redistribute it and/or
|
10 |
* modify it under the terms of the GNU General Public License
|
11 |
* as published by the Free Software Foundation; either version 2
|
12 |
* of the License, or (at your option) any later version.
|
13 |
*
|
14 |
* This program is distributed in the hope that it will be useful,
|
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
* GNU General Public License for more details.
|
18 |
*
|
19 |
* You should have received a copy of the GNU General Public License
|
20 |
* along with this program; if not, write to the Free Software
|
21 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
22 |
*
|
23 |
* For more information, contact:
|
24 |
*
|
25 |
* Generalitat Valenciana
|
26 |
* Conselleria d'Infraestructures i Transport
|
27 |
* Av. Blasco Ib??ez, 50
|
28 |
* 46010 VALENCIA
|
29 |
* SPAIN
|
30 |
*
|
31 |
* +34 963862235
|
32 |
* gvsig@gva.es
|
33 |
* www.gvsig.gva.es
|
34 |
*
|
35 |
* or
|
36 |
*
|
37 |
* IVER T.I. S.A
|
38 |
* Salamanca 50
|
39 |
* 46005 Valencia
|
40 |
* Spain
|
41 |
*
|
42 |
* +34 963163400
|
43 |
* dac@iver.es
|
44 |
*/
|
45 |
package com.iver.cit.gvsig.project.documents.view.legend.gui; |
46 |
|
47 |
import javax.swing.ButtonGroup; |
48 |
import javax.swing.JCheckBox; |
49 |
|
50 |
import com.iver.andami.PluginServices; |
51 |
import com.iver.cit.gvsig.fmap.core.FShape; |
52 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
53 |
import com.iver.cit.gvsig.fmap.layers.Annotation_Layer; |
54 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
55 |
import com.iver.cit.gvsig.fmap.rendering.Annotation_Legend; |
56 |
import com.iver.cit.gvsig.fmap.rendering.Legend; |
57 |
import com.iver.cit.gvsig.fmap.rendering.VectorialLegend; |
58 |
|
59 |
/**
|
60 |
* Panel legend annotation properties.
|
61 |
*
|
62 |
* @author Vicente Caballero Navarro
|
63 |
*/
|
64 |
public class PanelLegendAnnotation extends AbstractPanel implements |
65 |
ILegendPanel { |
66 |
|
67 |
private VectorialLegend m_Renderer;
|
68 |
|
69 |
private Annotation_Layer m_lyr;
|
70 |
|
71 |
private FSymbol m_FSymbol;
|
72 |
|
73 |
private javax.swing.JRadioButton jRadioButton = null; |
74 |
|
75 |
private javax.swing.JRadioButton jRadioButton1 = null; |
76 |
|
77 |
private JCheckBox jCheckBoxTextOnly = null; |
78 |
|
79 |
private JCheckBox chkDelOverLapping = null; |
80 |
|
81 |
private JCheckBox chkAvoidOverLapping = null; |
82 |
|
83 |
/**
|
84 |
* This is the default constructor
|
85 |
*/
|
86 |
public PanelLegendAnnotation() {
|
87 |
super();
|
88 |
initialize(); |
89 |
} |
90 |
|
91 |
/**
|
92 |
* This method initializes this
|
93 |
*
|
94 |
* @return void
|
95 |
*/
|
96 |
private void initialize() { |
97 |
this.setLayout(null); |
98 |
this.setSize(454, 308); |
99 |
this.add(getJCheckBoxTextOnly(), null); |
100 |
ButtonGroup jButtonGroup = new ButtonGroup(); |
101 |
jButtonGroup.add(getJRadioButton1()); |
102 |
jButtonGroup.add(getJRadioButton()); |
103 |
|
104 |
this.add(getJRadioButton1(), null); |
105 |
this.add(getJRadioButton(), null); |
106 |
this.add(getChkDelOverLapping(), null); |
107 |
this.add(getChkAvoidOverLapping(), null); |
108 |
} |
109 |
|
110 |
public void setLayer(FLayer lyr, Legend r) { |
111 |
m_lyr = (Annotation_Layer) lyr; |
112 |
m_Renderer = (VectorialLegend) r; |
113 |
// getJRadioButton().setSelected(m_lyr.isInPixels());
|
114 |
getChkAvoidOverLapping().setSelected(((Annotation_Legend)r).isAvoidOverLapping()); |
115 |
getChkDelOverLapping().setSelected(((Annotation_Legend)r).isDelOverLapping()); |
116 |
// getChkOverWrite()
|
117 |
if (r.getDefaultSymbol() instanceof FSymbol) |
118 |
setFSymbol((FSymbol) r.getDefaultSymbol()); |
119 |
} |
120 |
|
121 |
public void setFSymbol(FSymbol sym) { |
122 |
if (sym == null) { |
123 |
m_FSymbol = new FSymbol(FShape.MULTI);
|
124 |
} else
|
125 |
m_FSymbol = sym; |
126 |
|
127 |
getJRadioButton1().setSelected(!m_FSymbol.isFontSizeInPixels()); |
128 |
getJCheckBoxTextOnly().setSelected(!m_FSymbol.isShapeVisible()); |
129 |
} |
130 |
|
131 |
/**
|
132 |
* This method initializes jRadioButton
|
133 |
*
|
134 |
* @return javax.swing.JRadioButton
|
135 |
*/
|
136 |
private javax.swing.JRadioButton getJRadioButton() {
|
137 |
if (jRadioButton == null) { |
138 |
jRadioButton = new javax.swing.JRadioButton();
|
139 |
jRadioButton.setText(PluginServices.getText(this, "En_pixels")); |
140 |
jRadioButton.setBounds(new java.awt.Rectangle(27,50,303,23)); |
141 |
jRadioButton.setSelected(true);
|
142 |
} |
143 |
return jRadioButton;
|
144 |
} |
145 |
|
146 |
/**
|
147 |
* This method initializes jRadioButton1
|
148 |
*
|
149 |
* @return javax.swing.JRadioButton
|
150 |
*/
|
151 |
private javax.swing.JRadioButton getJRadioButton1() {
|
152 |
if (jRadioButton1 == null) { |
153 |
jRadioButton1 = new javax.swing.JRadioButton();
|
154 |
jRadioButton1.setText(PluginServices.getText(this, "En_metros")); |
155 |
jRadioButton1.setBounds(new java.awt.Rectangle(27,21,303,23)); |
156 |
} |
157 |
return jRadioButton1;
|
158 |
} |
159 |
|
160 |
public Legend getLegend() {
|
161 |
return m_Renderer;
|
162 |
} |
163 |
|
164 |
/**
|
165 |
* @param renderer
|
166 |
* The renderer to set.
|
167 |
*/
|
168 |
public void setRenderer(Legend renderer) { |
169 |
this.m_Renderer = (VectorialLegend) renderer;
|
170 |
getChkDelOverLapping().setSelected(((Annotation_Legend)renderer).isDelOverLapping()); |
171 |
getChkAvoidOverLapping().setSelected(((Annotation_Legend)renderer).isAvoidOverLapping()); |
172 |
if (m_Renderer.getDefaultSymbol() instanceof FSymbol) |
173 |
setFSymbol((FSymbol) m_Renderer.getDefaultSymbol()); |
174 |
} |
175 |
|
176 |
/**
|
177 |
* This method initializes jCheckBox1
|
178 |
*
|
179 |
* @return javax.swing.JCheckBox
|
180 |
*/
|
181 |
private JCheckBox getJCheckBoxTextOnly() { |
182 |
if (jCheckBoxTextOnly == null) { |
183 |
jCheckBoxTextOnly = new JCheckBox(); |
184 |
jCheckBoxTextOnly.setBounds(27, 88, 303, 23); |
185 |
jCheckBoxTextOnly.setText(PluginServices.getText(this,
|
186 |
"draw_text_only"));
|
187 |
} |
188 |
return jCheckBoxTextOnly;
|
189 |
} |
190 |
|
191 |
public void updateValuesFromControls(VectorialLegend l) { |
192 |
m_FSymbol.setFontSizeInPixels(jRadioButton.isSelected()); |
193 |
m_FSymbol.setShapeVisible(!jCheckBoxTextOnly.isSelected()); |
194 |
((Annotation_Legend)l).setAvoidOverLapping(chkAvoidOverLapping.isSelected()); |
195 |
((Annotation_Legend)l).setDelOverLapping(chkDelOverLapping.isSelected()); |
196 |
|
197 |
// m_Renderer.setDefaultSymbol(m_FSymbol);
|
198 |
l.setDefaultSymbol(m_FSymbol); |
199 |
} |
200 |
|
201 |
public void repaint() { |
202 |
super.repaint();
|
203 |
} |
204 |
|
205 |
public void actualizar() { |
206 |
getJRadioButton().setSelected(m_FSymbol.isFontSizeInPixels()); |
207 |
getJCheckBoxTextOnly().setSelected(!m_FSymbol.isShapeVisible()); |
208 |
} |
209 |
|
210 |
/**
|
211 |
* This method initializes chkOverWrite
|
212 |
*
|
213 |
* @return javax.swing.JCheckBox
|
214 |
*/
|
215 |
private JCheckBox getChkDelOverLapping() { |
216 |
if (chkDelOverLapping == null) { |
217 |
chkDelOverLapping = new JCheckBox(); |
218 |
chkDelOverLapping.setBounds(new java.awt.Rectangle(27,147,303,23)); |
219 |
chkDelOverLapping.setText(PluginServices.getText(this,"remove_annotation_overlapping")); |
220 |
chkDelOverLapping.setSelected(false);
|
221 |
} |
222 |
return chkDelOverLapping;
|
223 |
} |
224 |
|
225 |
/**
|
226 |
* This method initializes chkTryNotOverWrite
|
227 |
*
|
228 |
* @return javax.swing.JCheckBox
|
229 |
*/
|
230 |
private JCheckBox getChkAvoidOverLapping() { |
231 |
if (chkAvoidOverLapping == null) { |
232 |
chkAvoidOverLapping = new JCheckBox(); |
233 |
chkAvoidOverLapping.setBounds(new java.awt.Rectangle(27,116,303,23)); |
234 |
chkAvoidOverLapping.setText(PluginServices.getText(this,"avoid_overlapping")); |
235 |
} |
236 |
return chkAvoidOverLapping;
|
237 |
} |
238 |
} |