svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.symbology / org.gvsig.symbology.swing / org.gvsig.symbology.swing.api / src / main / java / org / gvsig / app / gui / styling / PictureMarker.java @ 47464
History | View | Annotate | Download (18.7 KB)
1 | 40560 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | 40435 | jjdelcerro | *
|
4 | 40560 | jjdelcerro | * Copyright (C) 2007-2013 gvSIG Association.
|
5 | 40435 | jjdelcerro | *
|
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 | 40560 | jjdelcerro | * as published by the Free Software Foundation; either version 3
|
9 | 40435 | jjdelcerro | * 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 | 40560 | jjdelcerro | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 | * MA 02110-1301, USA.
|
||
20 | 40435 | jjdelcerro | *
|
21 | 40560 | jjdelcerro | * For any additional information, do not hesitate to contact us
|
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | 40435 | jjdelcerro | */
|
24 | package org.gvsig.app.gui.styling; |
||
25 | |||
26 | 45523 | jjdelcerro | import java.awt.Color; |
27 | 40435 | jjdelcerro | import java.awt.event.ActionEvent; |
28 | import java.awt.event.ActionListener; |
||
29 | 45527 | jjdelcerro | import java.awt.event.ItemEvent; |
30 | 40435 | jjdelcerro | import java.awt.geom.Point2D; |
31 | import java.io.File; |
||
32 | import java.net.URL; |
||
33 | import java.util.ArrayList; |
||
34 | 45523 | jjdelcerro | import java.util.List; |
35 | 40435 | jjdelcerro | |
36 | import javax.swing.JPanel; |
||
37 | 45527 | jjdelcerro | import javax.swing.JPopupMenu; |
38 | 45523 | jjdelcerro | import javax.swing.SpinnerNumberModel; |
39 | import javax.swing.event.ChangeEvent; |
||
40 | 45526 | fdiaz | import org.gvsig.expressionevaluator.Expression; |
41 | 45523 | jjdelcerro | import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingLocator; |
42 | import org.gvsig.expressionevaluator.swing.ExpressionEvaluatorSwingManager; |
||
43 | import org.gvsig.expressionevaluator.swing.ExpressionPickerController; |
||
44 | import org.gvsig.fmap.dal.feature.FeatureStore; |
||
45 | import org.gvsig.fmap.dal.swing.DALSwingLocator; |
||
46 | import org.gvsig.fmap.dal.swing.DataSwingManager; |
||
47 | 40435 | jjdelcerro | import org.gvsig.fmap.mapcontext.MapContextLocator; |
48 | import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
||
49 | import org.gvsig.fmap.mapcontext.rendering.symbols.IWarningSymbol; |
||
50 | import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolDrawingException; |
||
51 | import org.gvsig.i18n.Messages; |
||
52 | import org.gvsig.symbology.SymbologyLocator; |
||
53 | 45523 | jjdelcerro | import org.gvsig.symbology.SymbologyManager; |
54 | 40435 | jjdelcerro | import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.IPictureMarkerSymbol; |
55 | 45523 | jjdelcerro | import org.gvsig.tools.swing.api.ToolsSwingLocator; |
56 | import org.gvsig.tools.swing.api.ToolsSwingManager; |
||
57 | import org.gvsig.tools.swing.api.pickercontroller.ColorPickerController; |
||
58 | import org.gvsig.tools.swing.api.pickercontroller.FilePickerController; |
||
59 | import org.gvsig.tools.util.URLUtils; |
||
60 | import org.slf4j.Logger; |
||
61 | import org.slf4j.LoggerFactory; |
||
62 | 40435 | jjdelcerro | |
63 | /**
|
||
64 | 45523 | jjdelcerro | * PictureMarker allows the user to store and modify the properties that define
|
65 | * a
|
||
66 | 40435 | jjdelcerro | * <b>picture marker symbol</b>.<p>
|
67 | * <p>
|
||
68 | * This functionality is carried out thanks to a tab (simple marker)which is
|
||
69 | 45523 | jjdelcerro | * included in the panel to edit the properities of a symbol (SymbolEditor)how
|
70 | * is explained in AbstractTypeSymbolEditor.
|
||
71 | 40435 | jjdelcerro | * <p>
|
72 | * First of all, in the above mentioned tab the user will have options to change
|
||
73 | 45523 | jjdelcerro | * the files from where the pictures for the symbol are taken (one for the
|
74 | * symbol when it is not selected in the map and the other when it is done)
|
||
75 | * .<p>
|
||
76 | 40435 | jjdelcerro | * <p>
|
77 | * Secondly, the user will have options to modify the pictures which had been
|
||
78 | 45523 | jjdelcerro | * selected before (width and offset) .
|
79 | 40435 | jjdelcerro | *
|
80 | 45523 | jjdelcerro | * @see AbstractTypeSymbolEditor
|
81 | * @author gvSIG Team
|
||
82 | 40435 | jjdelcerro | */
|
83 | 45523 | jjdelcerro | @SuppressWarnings("UseSpecificCatch") |
84 | public class PictureMarker |
||
85 | extends AbstractTypeSymbolEditor
|
||
86 | implements ActionListener { |
||
87 | |||
88 | protected static final Logger LOGGER = LoggerFactory.getLogger(PictureMarker.class); |
||
89 | 40435 | jjdelcerro | |
90 | public static final double MARKER_IMAGE_DEFAULT_WIDTH = 18; |
||
91 | |||
92 | 45527 | jjdelcerro | private final PictureMarkerView view = new PictureMarkerView(); |
93 | 40435 | jjdelcerro | |
94 | 45523 | jjdelcerro | protected List<JPanel> tabs = new ArrayList<>(); |
95 | 40435 | jjdelcerro | |
96 | 45523 | jjdelcerro | //TODO: Comentarizado hasta que mask est? acabado
|
97 | // protected Mask mask;
|
||
98 | private FilePickerController picturePicker;
|
||
99 | private FilePickerController selectedPicturePicker;
|
||
100 | private ColorPickerController colorLinePicker;
|
||
101 | private ExpressionPickerController xoffsetExpPicker;
|
||
102 | private ExpressionPickerController yoffsetExpPicker;
|
||
103 | private ExpressionPickerController rotationExpPicker;
|
||
104 | private ExpressionPickerController colorExpPicker;
|
||
105 | 45527 | jjdelcerro | private ExpressionPickerController sizeExpPicker;
|
106 | 40435 | jjdelcerro | |
107 | 45523 | jjdelcerro | public PictureMarker(SymbolEditor owner) {
|
108 | super(owner);
|
||
109 | initComponents(); |
||
110 | } |
||
111 | 40435 | jjdelcerro | |
112 | 45523 | jjdelcerro | private void translate() { |
113 | ToolsSwingManager toolsSwingManager = ToolsSwingLocator.getToolsSwingManager(); |
||
114 | toolsSwingManager.translate(view.lblLabelFileName); |
||
115 | toolsSwingManager.translate(view.lblLabelRotationExpression); |
||
116 | toolsSwingManager.translate(view.lblLabelSelFileName); |
||
117 | toolsSwingManager.translate(view.lblLabelSize); |
||
118 | 47464 | fdiaz | toolsSwingManager.translate(view.lblLabelRotation); |
119 | 45523 | jjdelcerro | toolsSwingManager.translate(view.lblLabelX); |
120 | toolsSwingManager.translate(view.lblLabelXExpression); |
||
121 | toolsSwingManager.translate(view.lblLabelY); |
||
122 | toolsSwingManager.translate(view.lblLabelYExpression); |
||
123 | 47464 | fdiaz | toolsSwingManager.translate(view.chkDrawLineToOffset); |
124 | toolsSwingManager.translate(view.lblColorLine); |
||
125 | toolsSwingManager.translate(view.lblLabelSizeExpression); |
||
126 | toolsSwingManager.translate(view.lblLabelXExpression); |
||
127 | toolsSwingManager.translate(view.lblLabelYExpression); |
||
128 | toolsSwingManager.translate(view.lblLabelRotationExpression); |
||
129 | toolsSwingManager.translate(view.lblColorLineExpression); |
||
130 | 45523 | jjdelcerro | } |
131 | 40435 | jjdelcerro | |
132 | 45523 | jjdelcerro | /**
|
133 | * Initializes the parameters that define a picturmarker.To do it, a tab is
|
||
134 | * created inside the SymbolEditor panel with default values for the
|
||
135 | * different attributes of the picture marker.
|
||
136 | */
|
||
137 | private void initComponents() { |
||
138 | 40435 | jjdelcerro | |
139 | 45523 | jjdelcerro | ToolsSwingManager toolsSwingManager = ToolsSwingLocator.getToolsSwingManager(); |
140 | ExpressionEvaluatorSwingManager expressionSwingManager = ExpressionEvaluatorSwingLocator.getManager(); |
||
141 | 40435 | jjdelcerro | |
142 | 45523 | jjdelcerro | this.translate();
|
143 | |||
144 | 47464 | fdiaz | this.picturePicker = toolsSwingManager.createFilePickerController(
|
145 | view.txtPictureFile, |
||
146 | view.btnPictureFile, |
||
147 | null,
|
||
148 | "PictureMarkerFiles",
|
||
149 | null,
|
||
150 | true
|
||
151 | ); |
||
152 | 45527 | jjdelcerro | JPopupMenu menu = view.txtPictureFile.getComponentPopupMenu();
|
153 | menu.add(expressionSwingManager.createJExpressionBuilderAction(view.txtPictureFile)); |
||
154 | menu.add(expressionSwingManager.createUniqueTemporalFileAction(view.txtPictureFile,"picture",".png")); |
||
155 | |||
156 | 47464 | fdiaz | this.selectedPicturePicker = toolsSwingManager.createFilePickerController(
|
157 | view.txtSelPictureFile, |
||
158 | view.btnSelPictureFile, |
||
159 | null,
|
||
160 | "PictureMarkerFiles",
|
||
161 | null,
|
||
162 | true
|
||
163 | ); |
||
164 | 45527 | jjdelcerro | menu = view.txtSelPictureFile.getComponentPopupMenu(); |
165 | menu.add(expressionSwingManager.createJExpressionBuilderAction(view.txtSelPictureFile)); |
||
166 | menu.add(expressionSwingManager.createUniqueTemporalFileAction(view.txtSelPictureFile,"picture",".png")); |
||
167 | 45523 | jjdelcerro | this.picturePicker.addChangeListener((ChangeEvent e) -> { |
168 | if (this.picturePicker.get() == null) { |
||
169 | this.selectedPicturePicker.setEnabled(false); |
||
170 | } |
||
171 | }); |
||
172 | view.txtSize.setModel(new SpinnerNumberModel(5, 0d, Double.POSITIVE_INFINITY, 0.5)); |
||
173 | 47464 | fdiaz | view.txtRotation.setModel(new SpinnerNumberModel(0, 0d, 360d, 0.5)); |
174 | 45523 | jjdelcerro | view.txtX.setModel(new SpinnerNumberModel(0, Integer.MIN_VALUE, Integer.MAX_VALUE, 1)); |
175 | view.txtY.setModel(new SpinnerNumberModel(0, Integer.MIN_VALUE, Integer.MAX_VALUE, 1)); |
||
176 | 40435 | jjdelcerro | |
177 | |||
178 | 45523 | jjdelcerro | this.colorLinePicker = toolsSwingManager.createColorPickerController(view.txtColorLine, view.btnColorLine);
|
179 | 40435 | jjdelcerro | |
180 | 45526 | fdiaz | |
181 | 45527 | jjdelcerro | this.sizeExpPicker = expressionSwingManager.createExpressionPickerController(
|
182 | view.txtSizeExp, |
||
183 | view.btnSizeExpression, |
||
184 | view.btnSizeExpressionBookmarks, |
||
185 | view.btnSizeExpressionHistory |
||
186 | ); |
||
187 | 45523 | jjdelcerro | this.xoffsetExpPicker = expressionSwingManager.createExpressionPickerController(
|
188 | view.txtXOffset, |
||
189 | view.btnXOffsetExpression, |
||
190 | view.btnXOffsetExpressionBookmarks, |
||
191 | view.btnXOffsetExpressionHistory |
||
192 | ); |
||
193 | this.yoffsetExpPicker = expressionSwingManager.createExpressionPickerController(
|
||
194 | view.txtYOffset, |
||
195 | view.btnYOffsetExpression, |
||
196 | view.btnYOffsetExpressionBookmarks, |
||
197 | view.btnYOffsetExpressionHistory |
||
198 | ); |
||
199 | this.rotationExpPicker = expressionSwingManager.createExpressionPickerController(
|
||
200 | 47464 | fdiaz | view.txtRotationExp, |
201 | 45523 | jjdelcerro | view.btnRotationExpression, |
202 | view.btnRotationExpressionBookmarks, |
||
203 | view.btnRotationExpressionHistory |
||
204 | ); |
||
205 | this.colorExpPicker = expressionSwingManager.createExpressionPickerController(
|
||
206 | view.txtColorLineExp, |
||
207 | view.btnColorLineExpression, |
||
208 | view.btnColorLineExpressionBookmarks, |
||
209 | view.btnColorLineExpressionHistory |
||
210 | ); |
||
211 | 45527 | jjdelcerro | this.picturePicker.addChangeListener((ChangeEvent e) -> {fireSymbolChangedEvent();}); |
212 | this.selectedPicturePicker.addChangeListener((ChangeEvent e) -> {fireSymbolChangedEvent();}); |
||
213 | 45526 | fdiaz | |
214 | view.txtSize.addChangeListener((ChangeEvent e) -> {fireSymbolChangedEvent();});
|
||
215 | 47464 | fdiaz | view.txtRotation.addChangeListener((ChangeEvent e) -> {fireSymbolChangedEvent();});
|
216 | 45526 | fdiaz | view.txtX.addChangeListener((ChangeEvent e) -> {fireSymbolChangedEvent();});
|
217 | view.txtY.addChangeListener((ChangeEvent e) -> {fireSymbolChangedEvent();});
|
||
218 | this.colorLinePicker.addChangeListener((ChangeEvent e) -> {fireSymbolChangedEvent();}); |
||
219 | 45527 | jjdelcerro | view.chkDrawLineToOffset.addItemListener((ItemEvent e) -> {
|
220 | fireSymbolChangedEvent(); |
||
221 | }); |
||
222 | |||
223 | this.sizeExpPicker.addChangeListener((ChangeEvent e) -> {fireSymbolChangedEvent();}); |
||
224 | 45526 | fdiaz | this.xoffsetExpPicker.addChangeListener((ChangeEvent e) -> {fireSymbolChangedEvent();}); |
225 | this.yoffsetExpPicker.addChangeListener((ChangeEvent e) -> {fireSymbolChangedEvent();}); |
||
226 | this.rotationExpPicker.addChangeListener((ChangeEvent e) -> {fireSymbolChangedEvent();}); |
||
227 | this.colorExpPicker.addChangeListener((ChangeEvent e) -> {fireSymbolChangedEvent();}); |
||
228 | 45527 | jjdelcerro | view.setName(this.getName());
|
229 | 45523 | jjdelcerro | tabs.add(view); |
230 | } |
||
231 | 40435 | jjdelcerro | |
232 | 45523 | jjdelcerro | @Override
|
233 | public ISymbol getLayer() {
|
||
234 | try {
|
||
235 | IPictureMarkerSymbol layer = null;
|
||
236 | 40435 | jjdelcerro | |
237 | 45523 | jjdelcerro | if (this.getPictureFile()!=null ) { |
238 | SymbologyManager symbologyManager = SymbologyLocator.getSymbologyManager(); |
||
239 | layer = symbologyManager.createPictureMarkerSymbol( |
||
240 | this.getPictureURL(),
|
||
241 | this.getSelectedPictureURL()
|
||
242 | ); |
||
243 | 45527 | jjdelcerro | layer.setFeature(this.getSampleFeature());
|
244 | 45523 | jjdelcerro | layer.setSize(getSize()); |
245 | layer.setOffset(new Point2D.Double(getX(),getY())); |
||
246 | 45526 | fdiaz | layer.setLineToOffsetColor(this.colorLinePicker.get());
|
247 | 45527 | jjdelcerro | layer.setDrawLineToOffset(view.chkDrawLineToOffset.isSelected()); |
248 | 47464 | fdiaz | layer.setRotation(Math.toRadians(getRotation()));
|
249 | 45527 | jjdelcerro | |
250 | layer.setLineToOffsetColorExpression(getPhrase(this.colorExpPicker.get()));
|
||
251 | 45526 | fdiaz | layer.setOffsetXExpression(getPhrase(this.xoffsetExpPicker.get()));
|
252 | layer.setOffsetYExpression(getPhrase(this.yoffsetExpPicker.get()));
|
||
253 | layer.setRotationExpression(getPhrase(this.rotationExpPicker.get()));
|
||
254 | 45527 | jjdelcerro | layer.setSizeExpression(getPhrase(this.sizeExpPicker.get()));
|
255 | 45523 | jjdelcerro | } |
256 | 40435 | jjdelcerro | |
257 | 45523 | jjdelcerro | return layer;
|
258 | } catch (Exception e) { |
||
259 | IWarningSymbol warning |
||
260 | = (IWarningSymbol) MapContextLocator.getSymbolManager() |
||
261 | .getWarningSymbol( |
||
262 | SymbolDrawingException.STR_UNSUPPORTED_SET_OF_SETTINGS, |
||
263 | Messages.getText("failed_acessing_files"),
|
||
264 | SymbolDrawingException.UNSUPPORTED_SET_OF_SETTINGS); |
||
265 | return warning;
|
||
266 | 40435 | jjdelcerro | |
267 | 45523 | jjdelcerro | } |
268 | 40435 | jjdelcerro | |
269 | 45523 | jjdelcerro | } |
270 | 45526 | fdiaz | |
271 | private String getPhrase(Expression expression){ |
||
272 | if(expression == null){ |
||
273 | return null; |
||
274 | } |
||
275 | return expression.getPhrase();
|
||
276 | } |
||
277 | 40435 | jjdelcerro | |
278 | 45523 | jjdelcerro | @Override
|
279 | public String getName() { |
||
280 | return Messages.getText("picture_marker_symbol"); |
||
281 | } |
||
282 | 40435 | jjdelcerro | |
283 | 45523 | jjdelcerro | @Override
|
284 | public JPanel[] getTabs() { |
||
285 | return tabs.toArray(new JPanel[tabs.size()]); |
||
286 | } |
||
287 | 40435 | jjdelcerro | |
288 | 45523 | jjdelcerro | @Override
|
289 | public void refreshControls(ISymbol layer) { |
||
290 | try {
|
||
291 | if (layer == null) { |
||
292 | 45527 | jjdelcerro | setValues(1d, 0d, 0d, null, null, "", "", "", null, "", "", false); |
293 | 45523 | jjdelcerro | } else {
|
294 | IPictureMarkerSymbol sym = (IPictureMarkerSymbol) layer; |
||
295 | setValues( |
||
296 | sym.getSize(), |
||
297 | 47464 | fdiaz | sym.getRotation(), |
298 | 45523 | jjdelcerro | sym.getOffset().getX(), |
299 | sym.getOffset().getY(), |
||
300 | sym.getSource(), |
||
301 | 45526 | fdiaz | sym.getSelectedSource(), |
302 | 45527 | jjdelcerro | sym.getSizeExpression(), |
303 | 45526 | fdiaz | sym.getOffsetXExpression(), |
304 | sym.getOffsetYExpression(), |
||
305 | sym.getLineToOffsetColor(), |
||
306 | sym.getLineToOffsetColorExpression(), |
||
307 | sym.getRotationExpression(), |
||
308 | sym.isDrawLineToOffset() |
||
309 | 45523 | jjdelcerro | ); |
310 | 47464 | fdiaz | fireSymbolChangedEvent(); |
311 | 45523 | jjdelcerro | } |
312 | } catch (Exception ex) { |
||
313 | LOGGER.warn("Can't refresh picture marker symbol panel.", ex);
|
||
314 | } |
||
315 | } |
||
316 | 40435 | jjdelcerro | |
317 | 45526 | fdiaz | protected void setValues( |
318 | double size,
|
||
319 | double xOffset,
|
||
320 | double yOffset,
|
||
321 | URL picture,
|
||
322 | URL selectedPicture,
|
||
323 | 45527 | jjdelcerro | String sizeExpression,
|
324 | 45526 | fdiaz | String offsetXExpression,
|
325 | String offsetYExpression,
|
||
326 | Color lineToOffsetColor,
|
||
327 | String lineToOffsetColorExpression,
|
||
328 | String rotationExpression,
|
||
329 | boolean isDrawLineToOffset) {
|
||
330 | 47464 | fdiaz | |
331 | setValues(size, 0d, xOffset, yOffset, picture, selectedPicture, sizeExpression, offsetXExpression, offsetYExpression, lineToOffsetColor, lineToOffsetColorExpression, rotationExpression, isDrawLineToOffset);
|
||
332 | } |
||
333 | protected void setValues( |
||
334 | double size,
|
||
335 | double rotation,
|
||
336 | double xOffset,
|
||
337 | double yOffset,
|
||
338 | URL picture,
|
||
339 | URL selectedPicture,
|
||
340 | String sizeExpression,
|
||
341 | String offsetXExpression,
|
||
342 | String offsetYExpression,
|
||
343 | Color lineToOffsetColor,
|
||
344 | String lineToOffsetColorExpression,
|
||
345 | String rotationExpression,
|
||
346 | boolean isDrawLineToOffset) {
|
||
347 | 45526 | fdiaz | |
348 | 45523 | jjdelcerro | setSize(size); |
349 | 47464 | fdiaz | setRotation(Math.toDegrees(rotation));
|
350 | 45523 | jjdelcerro | setX(xOffset); |
351 | setY(yOffset); |
||
352 | |||
353 | setPicture(picture); |
||
354 | setSelectedPicture(selectedPicture); |
||
355 | 45526 | fdiaz | |
356 | 45527 | jjdelcerro | sizeExpPicker.coerceAndSet(sizeExpression); |
357 | 45526 | fdiaz | xoffsetExpPicker.coerceAndSet(offsetXExpression); |
358 | yoffsetExpPicker.coerceAndSet(offsetYExpression); |
||
359 | rotationExpPicker.coerceAndSet(rotationExpression); |
||
360 | colorLinePicker.coerceAndSet(lineToOffsetColor); |
||
361 | colorExpPicker.coerceAndSet(lineToOffsetColorExpression); |
||
362 | view.chkDrawLineToOffset.setSelected(isDrawLineToOffset); |
||
363 | |||
364 | 45523 | jjdelcerro | } |
365 | 40435 | jjdelcerro | |
366 | 45523 | jjdelcerro | @Override
|
367 | public EditorTool[] getEditorTools() { |
||
368 | return null; |
||
369 | 40435 | jjdelcerro | |
370 | 45523 | jjdelcerro | } |
371 | 40435 | jjdelcerro | |
372 | 45523 | jjdelcerro | @Override
|
373 | public void actionPerformed(ActionEvent e) { |
||
374 | } |
||
375 | 40435 | jjdelcerro | |
376 | 45523 | jjdelcerro | @Override
|
377 | public boolean canManageSymbol(ISymbol symbol) { |
||
378 | return symbol instanceof IPictureMarkerSymbol; |
||
379 | } |
||
380 | 40435 | jjdelcerro | |
381 | 45523 | jjdelcerro | protected String getPictureFileName() { |
382 | File f = this.picturePicker.get(); |
||
383 | if( f == null ) { |
||
384 | return null; |
||
385 | } |
||
386 | return f.getAbsolutePath();
|
||
387 | } |
||
388 | 40435 | jjdelcerro | |
389 | 45523 | jjdelcerro | protected String getSelectedPictureFileName() { |
390 | File f = this.selectedPicturePicker.get(); |
||
391 | if( f == null ) { |
||
392 | return null; |
||
393 | } |
||
394 | return f.getAbsolutePath();
|
||
395 | } |
||
396 | 40435 | jjdelcerro | |
397 | 45523 | jjdelcerro | protected URL getPictureURL() { |
398 | return URLUtils.toURL(this.picturePicker.get()); |
||
399 | } |
||
400 | 40435 | jjdelcerro | |
401 | 45523 | jjdelcerro | protected URL getSelectedPictureURL() { |
402 | return URLUtils.toURL(this.selectedPicturePicker.get()); |
||
403 | } |
||
404 | 40435 | jjdelcerro | |
405 | 45523 | jjdelcerro | protected File getPictureFile() { |
406 | File f = this.picturePicker.get(); |
||
407 | return f;
|
||
408 | } |
||
409 | 40435 | jjdelcerro | |
410 | 45523 | jjdelcerro | protected File getSelectedPictureFile() { |
411 | File f = this.selectedPicturePicker.get(); |
||
412 | return f;
|
||
413 | } |
||
414 | 40435 | jjdelcerro | |
415 | 45523 | jjdelcerro | protected double getSize() { |
416 | SpinnerNumberModel model = (SpinnerNumberModel) view.txtSize.getModel(); |
||
417 | return model.getNumber().doubleValue();
|
||
418 | } |
||
419 | 40435 | jjdelcerro | |
420 | 47464 | fdiaz | protected double getRotation() { |
421 | SpinnerNumberModel model = (SpinnerNumberModel) view.txtRotation.getModel(); |
||
422 | return model.getNumber().doubleValue();
|
||
423 | } |
||
424 | |||
425 | 45523 | jjdelcerro | protected double getX() { |
426 | SpinnerNumberModel model = (SpinnerNumberModel) view.txtX.getModel(); |
||
427 | return model.getNumber().doubleValue();
|
||
428 | } |
||
429 | 40435 | jjdelcerro | |
430 | 45523 | jjdelcerro | protected double getY() { |
431 | SpinnerNumberModel model = (SpinnerNumberModel) view.txtY.getModel(); |
||
432 | return model.getNumber().doubleValue();
|
||
433 | } |
||
434 | 40435 | jjdelcerro | |
435 | 45523 | jjdelcerro | protected void setPicture(URL picture) { |
436 | this.picturePicker.set(URLUtils.toFile(picture));
|
||
437 | } |
||
438 | 40435 | jjdelcerro | |
439 | 45523 | jjdelcerro | protected void setSelectedPicture(URL selectedPicture) { |
440 | this.selectedPicturePicker.set(URLUtils.toFile(selectedPicture));
|
||
441 | } |
||
442 | 40435 | jjdelcerro | |
443 | 45523 | jjdelcerro | protected void setSize(double d) { |
444 | SpinnerNumberModel model = (SpinnerNumberModel) view.txtSize.getModel(); |
||
445 | model.setValue(d); |
||
446 | } |
||
447 | 40435 | jjdelcerro | |
448 | 47464 | fdiaz | protected void setRotation(double degrees) { |
449 | SpinnerNumberModel model = (SpinnerNumberModel) view.txtRotation.getModel(); |
||
450 | model.setValue(degrees); |
||
451 | } |
||
452 | |||
453 | 45523 | jjdelcerro | protected void setX(double d) { |
454 | SpinnerNumberModel model = (SpinnerNumberModel) view.txtX.getModel(); |
||
455 | model.setValue(d); |
||
456 | } |
||
457 | 40435 | jjdelcerro | |
458 | 45523 | jjdelcerro | protected void setY(double d) { |
459 | SpinnerNumberModel model = (SpinnerNumberModel) view.txtY.getModel(); |
||
460 | model.setValue(d); |
||
461 | } |
||
462 | 40435 | jjdelcerro | |
463 | 45523 | jjdelcerro | protected Color getColorLine() { |
464 | return this.colorLinePicker.get(); |
||
465 | } |
||
466 | |||
467 | protected void setColorLine(Color color) { |
||
468 | this.colorLinePicker.set(color);
|
||
469 | |||
470 | } |
||
471 | 40435 | jjdelcerro | |
472 | 45523 | jjdelcerro | @Override
|
473 | public void setFeatureStore(FeatureStore store) { |
||
474 | 45527 | jjdelcerro | if( store==null ) { |
475 | return;
|
||
476 | } |
||
477 | 45523 | jjdelcerro | super.setFeatureStore(store);
|
478 | DataSwingManager dataSwingManager = DALSwingLocator.getDataSwingManager(); |
||
479 | 46589 | jjdelcerro | dataSwingManager.configureExpressionBuilder(this.xoffsetExpPicker.getConfig(), store);
|
480 | dataSwingManager.configureExpressionBuilder(this.yoffsetExpPicker.getConfig(), store);
|
||
481 | dataSwingManager.configureExpressionBuilder(this.rotationExpPicker.getConfig(), store);
|
||
482 | 45523 | jjdelcerro | } |
483 | |||
484 | |||
485 | } |