root / tags / Root_Fmap_GisPlanet / libraries / libFMap / src / com / iver / cit / gvsig / fmap / core / v02 / FSymbol.java @ 1826
History | View | Annotate | Download (19.8 KB)
1 |
/*
|
---|---|
2 |
* Created on 19-feb-2004
|
3 |
*
|
4 |
* To change the template for this generated file go to
|
5 |
* Window>Preferences>Java>Code Generation>Code and Comments
|
6 |
*/
|
7 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
8 |
*
|
9 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
10 |
*
|
11 |
* This program is free software; you can redistribute it and/or
|
12 |
* modify it under the terms of the GNU General Public License
|
13 |
* as published by the Free Software Foundation; either version 2
|
14 |
* of the License, or (at your option) any later version.
|
15 |
*
|
16 |
* This program is distributed in the hope that it will be useful,
|
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
* GNU General Public License for more details.
|
20 |
*
|
21 |
* You should have received a copy of the GNU General Public License
|
22 |
* along with this program; if not, write to the Free Software
|
23 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
24 |
*
|
25 |
* For more information, contact:
|
26 |
*
|
27 |
* Generalitat Valenciana
|
28 |
* Conselleria d'Infraestructures i Transport
|
29 |
* Av. Blasco Ib??ez, 50
|
30 |
* 46010 VALENCIA
|
31 |
* SPAIN
|
32 |
*
|
33 |
* +34 963862235
|
34 |
* gvsig@gva.es
|
35 |
* www.gvsig.gva.es
|
36 |
*
|
37 |
* or
|
38 |
*
|
39 |
* IVER T.I. S.A
|
40 |
* Salamanca 50
|
41 |
* 46005 Valencia
|
42 |
* Spain
|
43 |
*
|
44 |
* +34 963163400
|
45 |
* dac@iver.es
|
46 |
*/
|
47 |
package com.iver.cit.gvsig.fmap.core.v02; |
48 |
|
49 |
import java.awt.BasicStroke; |
50 |
import java.awt.Color; |
51 |
import java.awt.Font; |
52 |
import java.awt.Graphics2D; |
53 |
import java.awt.Image; |
54 |
import java.awt.Paint; |
55 |
import java.awt.Rectangle; |
56 |
import java.awt.Stroke; |
57 |
import java.awt.image.BufferedImage; |
58 |
import java.net.MalformedURLException; |
59 |
import java.net.URI; |
60 |
import java.net.URISyntaxException; |
61 |
|
62 |
import javax.swing.ImageIcon; |
63 |
|
64 |
import com.iver.cit.gvsig.fmap.core.FShape; |
65 |
import com.iver.utiles.StringUtilities; |
66 |
import com.iver.utiles.XMLEntity; |
67 |
|
68 |
|
69 |
/**
|
70 |
* S?mbolo utilizado para guardar las caracter?sticas que se deben de aplicar a
|
71 |
* los Shapes a dibujar.
|
72 |
*
|
73 |
* @author Vicente Caballero Navarro
|
74 |
*/
|
75 |
public class FSymbol { |
76 |
private static BufferedImage img = new BufferedImage(1, 1, |
77 |
BufferedImage.TYPE_INT_ARGB);
|
78 |
private static Rectangle rect = new Rectangle(0, 0, 1, 1); |
79 |
private static Color selectionColor = Color.YELLOW; |
80 |
private int m_symbolType; |
81 |
private int m_Style; |
82 |
private boolean m_useOutline; |
83 |
private Color m_Color; |
84 |
private Color m_outlineColor; |
85 |
private Font m_Font; |
86 |
private Color m_FontColor; |
87 |
private float m_FontSize; |
88 |
private int rgb; |
89 |
|
90 |
/**
|
91 |
* Si <code>m_bUseFontSize</code> viene a false entonces m_FontSize viene
|
92 |
* en unidades de mapa (metros)
|
93 |
*/
|
94 |
private boolean m_bUseFontSizeInPixels; |
95 |
|
96 |
/**
|
97 |
* <code>m_bDrawShape</code> indica si queremos dibujar el shape de fondo.
|
98 |
* Es ?til cuando est?s etiquetando y no quieres que se dibuje el s?mbolo
|
99 |
* que te sirve de base para etiquetar.
|
100 |
*/
|
101 |
private boolean m_bDrawShape = true; |
102 |
private int m_Size; |
103 |
private Image m_Icon; |
104 |
private URI m_IconURI; |
105 |
private int m_Rotation; |
106 |
private Paint m_Fill; |
107 |
public String m_LinePattern = "0"; // Solo para poder mostrarlo cuando vamos a seleccionar un s?mbolo |
108 |
|
109 |
// En realidad lo podemos ver de BasicStroke, pero....
|
110 |
// ya veremos si luego lo quitamos.
|
111 |
private Stroke m_Stroke; |
112 |
|
113 |
//private float m_stroke=0;
|
114 |
// public int m_Transparency; // Ya la lleva dentro del Color
|
115 |
private boolean m_bUseSize; // Si est? a true, m_Size viene en coordenadas de mundo real. |
116 |
private int m_AlingVert; |
117 |
private int m_AlingHoriz; |
118 |
private String m_Descrip; |
119 |
public Color m_BackColor; |
120 |
public Paint m_BackFill; |
121 |
|
122 |
/**
|
123 |
* Crea un nuevo FSymbol.
|
124 |
*/
|
125 |
FSymbol() { |
126 |
} |
127 |
|
128 |
/**
|
129 |
* Creates a new FSymbol object.
|
130 |
*
|
131 |
* @param tipoSymbol Tipo de s?mbolo.
|
132 |
* @param c Color.
|
133 |
*/
|
134 |
public FSymbol(int tipoSymbol, Color c) { |
135 |
createSymbol(tipoSymbol, c); |
136 |
} |
137 |
|
138 |
/**
|
139 |
* Crea un nuevo FSymbol.
|
140 |
*
|
141 |
* @param tipoSymbol Tipo de S?mbolo.
|
142 |
*/
|
143 |
public FSymbol(int tipoSymbol) { |
144 |
int numreg = (int) (Math.random() * 100); |
145 |
Color colorAleatorio = new Color(((numreg * numreg) + 100) % 255, |
146 |
(numreg + ((3 * numreg) + 100)) % 255, numreg % 255); |
147 |
|
148 |
createSymbol(tipoSymbol, colorAleatorio); |
149 |
} |
150 |
|
151 |
/**
|
152 |
* A partir de un s?mbolo devuelve otro similar pero con el color de
|
153 |
* selecci?n.
|
154 |
*
|
155 |
* @param sym S?mbolo a modificar.
|
156 |
*
|
157 |
* @return S?mbolo modificado.
|
158 |
*/
|
159 |
public static FSymbol getSymbolForSelection(FSymbol sym) { |
160 |
FSymbol selecSymbol = sym.fastCloneSymbol(); |
161 |
selecSymbol.setColor(getSelectionColor()); |
162 |
selecSymbol.setFill(null);
|
163 |
// 050215, jmorell: Si en los drivers cambiamos el estilo, aqu? tenemos que
|
164 |
// actualizar los cambios. SYMBOL_STYLE_MARKER_SQUARE --> SYMBOL_STYLE_DGNSPECIAL.
|
165 |
if ((selecSymbol.getStyle() == FConstant.SYMBOL_STYLE_FILL_TRANSPARENT)
|
166 |
|| (selecSymbol.getStyle() == FConstant.SYMBOL_STYLE_DGNSPECIAL)) |
167 |
selecSymbol.setStyle(FConstant.SYMBOL_STYLE_FILL_SOLID); |
168 |
selecSymbol.rgb = getSelectionColor().getRGB(); |
169 |
|
170 |
return selecSymbol;
|
171 |
} |
172 |
|
173 |
/**
|
174 |
* Clona el s?mbolo actual.
|
175 |
*
|
176 |
* @return Nuevo s?mbolo clonado.
|
177 |
*/
|
178 |
public FSymbol cloneSymbol() {
|
179 |
return createFromXML(getXMLEntity());
|
180 |
} |
181 |
|
182 |
/**
|
183 |
* Se usa para el s?mbolo de selecci?n. Es una forma
|
184 |
* r?pida de clonar un s?mbolo, sin hacerlo via XML.
|
185 |
* Vicente, no lo borres!!!
|
186 |
* @return
|
187 |
*/
|
188 |
public FSymbol fastCloneSymbol()
|
189 |
{ |
190 |
FSymbol nS = new FSymbol();
|
191 |
|
192 |
|
193 |
nS.m_symbolType = m_symbolType; |
194 |
nS.m_Style = m_Style; |
195 |
nS.m_useOutline = m_useOutline; |
196 |
nS.m_Color = m_Color; |
197 |
nS.m_outlineColor = m_outlineColor; |
198 |
nS.m_Font = m_Font; |
199 |
nS.m_FontColor = m_FontColor; |
200 |
nS.m_FontSize = m_FontSize; |
201 |
nS.m_bUseFontSizeInPixels = m_bUseFontSizeInPixels; |
202 |
nS.m_bDrawShape = m_bDrawShape; |
203 |
nS.m_Size = m_Size; |
204 |
nS.m_Icon = m_Icon; |
205 |
nS.m_IconURI = m_IconURI; |
206 |
nS.m_Rotation = m_Rotation; |
207 |
nS.m_Fill = m_Fill; |
208 |
nS.m_Stroke = m_Stroke; |
209 |
// nS.m_Transparency =m_Transparency ;
|
210 |
nS.m_bUseSize = m_bUseSize; |
211 |
nS.m_AlingVert = m_AlingVert; |
212 |
nS.m_AlingHoriz = m_AlingHoriz; |
213 |
nS.m_Descrip = m_Descrip; |
214 |
nS.m_BackColor = m_BackColor; |
215 |
nS.m_BackFill = m_BackFill; |
216 |
|
217 |
nS.m_LinePattern = m_LinePattern; |
218 |
|
219 |
return nS;
|
220 |
} |
221 |
|
222 |
|
223 |
/**
|
224 |
* Crea un s?mbolo a partir del tipo y el color.
|
225 |
*
|
226 |
* @param tipoSymbol Tipo de s?mbolo.
|
227 |
* @param c Color del s?mbolo a crear.
|
228 |
*/
|
229 |
private void createSymbol(int tipoSymbol, Color c) { |
230 |
// OJO: HE HECHO COINCIDIR LOS TIPOS DE SIMBOLO
|
231 |
//FConstant.SYMBOL_TYPE_POINT, LINE Y FILL CON
|
232 |
// FShape.POINT, LINE, POLYGON. EL .MULTI SE REFIERE
|
233 |
// A MULTIPLES TIPO DENTRO DEL SHAPE, AS? QUE SER? UN
|
234 |
// MULTISIMBOLO
|
235 |
// Tipo de simbolo
|
236 |
m_symbolType = tipoSymbol; // Para no recalcular el pixel, no usamos los set
|
237 |
|
238 |
// Ponemos un estilo por defecto
|
239 |
m_useOutline = true;
|
240 |
m_Color = c; |
241 |
m_Stroke = null;
|
242 |
m_Fill = null;
|
243 |
|
244 |
m_FontColor = Color.BLACK;
|
245 |
m_FontSize = 10;
|
246 |
m_bUseFontSizeInPixels = true;
|
247 |
|
248 |
m_Size = 0;
|
249 |
|
250 |
switch (getSymbolType()) {
|
251 |
case FConstant.SYMBOL_TYPE_POINT:
|
252 |
case FConstant.SYMBOL_TYPE_POINTZ:
|
253 |
case FConstant.SYMBOL_TYPE_MULTIPOINT:
|
254 |
m_bUseSize = true; // Esto es lo primero que hay que hacer siempre |
255 |
|
256 |
// para evitar un StackOverflow
|
257 |
m_useOutline = false;
|
258 |
setStyle(FConstant.SYMBOL_STYLE_MARKER_SQUARE); |
259 |
setSize(5); //pixels |
260 |
|
261 |
break;
|
262 |
|
263 |
case FConstant.SYMBOL_TYPE_LINE:
|
264 |
case FConstant.SYMBOL_TYPE_POLYLINEZ:
|
265 |
case FConstant.SYMBOL_TYPE_POLYGONZ:
|
266 |
setStroke(new BasicStroke()); |
267 |
setStyle(FConstant.SYMBOL_STYLE_LINE_SOLID); |
268 |
|
269 |
break;
|
270 |
|
271 |
case FConstant.SYMBOL_TYPE_FILL:
|
272 |
case FShape.MULTI:
|
273 |
setStroke(new BasicStroke()); |
274 |
setStyle(FConstant.SYMBOL_STYLE_FILL_SOLID); |
275 |
|
276 |
break;
|
277 |
} |
278 |
|
279 |
m_outlineColor = c.darker(); |
280 |
|
281 |
calculateRgb(); |
282 |
} |
283 |
|
284 |
/**
|
285 |
* Calcula el RGB del s?mbolo.
|
286 |
*/
|
287 |
public void calculateRgb() { |
288 |
// Recalculamos el RGB
|
289 |
Graphics2D g2 = img.createGraphics();
|
290 |
|
291 |
FGraphicUtilities.DrawSymbol(g2, g2.getTransform(), rect, this);
|
292 |
rgb = img.getRGB(0, 0); |
293 |
} |
294 |
|
295 |
/**
|
296 |
* Devuelve el rgb del s?mbolo.
|
297 |
*
|
298 |
* @return rgb del s?mbolo.
|
299 |
*/
|
300 |
public int getRgb() { |
301 |
return rgb;
|
302 |
} |
303 |
|
304 |
/**
|
305 |
* @see com.iver.cit.gvsig.gui.layout.fframes.IFFrame#getXMLEntity()
|
306 |
*/
|
307 |
public XMLEntity getXMLEntity() {
|
308 |
XMLEntity xml = new XMLEntity();
|
309 |
xml.putProperty("className",this.getClass().getName()); |
310 |
xml.putProperty("m_symbolType", getSymbolType());
|
311 |
xml.putProperty("m_Style", getStyle());
|
312 |
xml.putProperty("m_useOutline", isOutlined());
|
313 |
|
314 |
if (getColor() != null) { |
315 |
xml.putProperty("m_Color", StringUtilities.color2String(getColor()));
|
316 |
} |
317 |
|
318 |
if (getOutlineColor() != null) { |
319 |
xml.putProperty("m_outlineColor",
|
320 |
StringUtilities.color2String(getOutlineColor())); |
321 |
} |
322 |
|
323 |
if (getFont() != null) { |
324 |
xml.putProperty("fontname", getFont().getName());
|
325 |
xml.putProperty("fontstyle", getFont().getStyle());
|
326 |
xml.putProperty("m_FontSize", getFontSize());
|
327 |
xml.putProperty("m_FontColor",
|
328 |
StringUtilities.color2String(getFontColor())); |
329 |
} |
330 |
|
331 |
xml.putProperty("m_bUseFontSize", isFontSizeInPixels());
|
332 |
xml.putProperty("m_bDrawShape", isShapeVisible());
|
333 |
xml.putProperty("m_Size", getSize());
|
334 |
|
335 |
//xml.putProperty("m_Icon",m_Icon.);
|
336 |
xml.putProperty("m_Rotation", getRotation());
|
337 |
|
338 |
if (getFill() instanceof Color) { |
339 |
xml.putProperty("m_Fill",
|
340 |
StringUtilities.color2String((Color) getFill()));
|
341 |
} |
342 |
else
|
343 |
if (getFill() != null) |
344 |
{ |
345 |
xml.putProperty("m_Fill", "WithFill"); |
346 |
} |
347 |
|
348 |
|
349 |
xml.putProperty("m_LinePattern", m_LinePattern);
|
350 |
|
351 |
//Ancho del stroke en float
|
352 |
if (getStroke() != null) { |
353 |
xml.putProperty("m_stroke",
|
354 |
((BasicStroke) getStroke()).getLineWidth());
|
355 |
} else {
|
356 |
xml.putProperty("m_stroke", 0f); |
357 |
} |
358 |
|
359 |
xml.putProperty("m_bUseSize", isSizeInPixels());
|
360 |
xml.putProperty("m_AlingVert", getAlingVert());
|
361 |
xml.putProperty("m_AlingHoriz", getAlingHoriz());
|
362 |
xml.putProperty("m_Descrip", getDescription());
|
363 |
|
364 |
if (m_BackColor != null) { |
365 |
xml.putProperty("m_BackColor",
|
366 |
StringUtilities.color2String(m_BackColor)); |
367 |
} |
368 |
|
369 |
if (m_BackFill instanceof Color) { |
370 |
xml.putProperty("m_BackFill",
|
371 |
StringUtilities.color2String((Color) m_BackFill));
|
372 |
} |
373 |
|
374 |
xml.putProperty("rgb", rgb);
|
375 |
|
376 |
if (m_Icon != null) |
377 |
{ |
378 |
xml.putProperty("m_IconURI", m_IconURI);
|
379 |
} |
380 |
|
381 |
return xml;
|
382 |
} |
383 |
|
384 |
/**
|
385 |
* Crea el s?mbolo a partir del xml.
|
386 |
*
|
387 |
* @param xml xml que contiene la informaci?n para crear el s?mbolo.
|
388 |
*
|
389 |
* @return S?mbolo creado a partir del XML.
|
390 |
*/
|
391 |
public static FSymbol createFromXML(XMLEntity xml) { |
392 |
FSymbol symbol = new FSymbol();
|
393 |
symbol.setSymbolType(xml.getIntProperty("m_symbolType"));
|
394 |
symbol.setStyle(xml.getIntProperty("m_Style"));
|
395 |
System.out.println("createFromXML: m_Style=" + xml.getIntProperty("m_Style")); |
396 |
|
397 |
symbol.setOutlined(xml.getBooleanProperty("m_useOutline"));
|
398 |
|
399 |
if (xml.contains("m_Color")) { |
400 |
symbol.setColor(StringUtilities.string2Color(xml.getStringProperty( |
401 |
"m_Color")));
|
402 |
} |
403 |
|
404 |
if (xml.contains("m_outlineColor")) { |
405 |
symbol.setOutlineColor(StringUtilities.string2Color( |
406 |
xml.getStringProperty("m_outlineColor")));
|
407 |
} |
408 |
|
409 |
if (xml.contains("m_FontColor")) { |
410 |
symbol.setFont(new Font(xml.getStringProperty("fontname"), |
411 |
xml.getIntProperty("fontstyle"),
|
412 |
(int) xml.getFloatProperty("m_FontSize"))); |
413 |
symbol.setFontColor(StringUtilities.string2Color( |
414 |
xml.getStringProperty("m_FontColor")));
|
415 |
symbol.setFontSize(xml.getFloatProperty("m_FontSize"));
|
416 |
} |
417 |
|
418 |
symbol.setFontSizeInPixels(xml.getBooleanProperty("m_bUseFontSize"));
|
419 |
symbol.setShapeVisible(xml.getBooleanProperty("m_bDrawShape"));
|
420 |
symbol.setSize(xml.getIntProperty("m_Size"));
|
421 |
|
422 |
//xml.putProperty("m_Icon",m_Icon.);
|
423 |
symbol.setRotation(xml.getIntProperty("m_Rotation"));
|
424 |
|
425 |
if (xml.contains("m_Fill")) { |
426 |
// TODO: Si es un Fill de tipo imagen, deber?amos recuperar la imagen.
|
427 |
String strFill = xml.getStringProperty("m_Fill"); |
428 |
if (strFill.compareTo("WithFill") == 0) |
429 |
symbol.setFill(FSymbolFactory.createPatternFill(symbol.getStyle(), symbol.getColor())); |
430 |
else
|
431 |
symbol.setFill(StringUtilities.string2Color(strFill)); |
432 |
} |
433 |
|
434 |
|
435 |
symbol.m_LinePattern = xml.getStringProperty("m_LinePattern");
|
436 |
|
437 |
//Ancho del stroke en float
|
438 |
symbol.setStroke(new BasicStroke(xml.getFloatProperty("m_stroke"))); |
439 |
symbol.setSizeInPixels(xml.getBooleanProperty("m_bUseSize"));
|
440 |
symbol.setAlingVert(xml.getIntProperty("m_AlingVert"));
|
441 |
symbol.setAlingHoriz(xml.getIntProperty("m_AlingHoriz"));
|
442 |
symbol.setDescription(xml.getStringProperty("m_Descrip"));
|
443 |
|
444 |
if (xml.contains("m_BackColor")) { |
445 |
symbol.m_BackColor = StringUtilities.string2Color(xml.getStringProperty( |
446 |
"m_BackColor"));
|
447 |
} |
448 |
|
449 |
if (xml.contains("m_BackFill")) { |
450 |
symbol.m_BackFill = StringUtilities.string2Color(xml.getStringProperty( |
451 |
"m_BackFill"));
|
452 |
} |
453 |
|
454 |
symbol.rgb = xml.getIntProperty("rgb");
|
455 |
|
456 |
if (xml.contains("m_IconURI")) { |
457 |
try {
|
458 |
symbol.setIconURI(new URI(xml.getStringProperty("m_IconURI"))); |
459 |
} catch (URISyntaxException e) { |
460 |
// TODO Auto-generated catch block
|
461 |
e.printStackTrace(); |
462 |
} |
463 |
} |
464 |
|
465 |
return symbol;
|
466 |
} |
467 |
|
468 |
/**
|
469 |
* Introduce el estilo del s?mbolo.
|
470 |
*
|
471 |
* @param m_Style The m_Style to set.
|
472 |
*/
|
473 |
public void setStyle(int m_Style) { |
474 |
this.m_Style = m_Style;
|
475 |
|
476 |
// calculateRgb();
|
477 |
} |
478 |
|
479 |
/**
|
480 |
* Devuelve el estilo del s?mbolo.
|
481 |
*
|
482 |
* @return Returns the m_Style.
|
483 |
*/
|
484 |
public int getStyle() { |
485 |
return m_Style;
|
486 |
} |
487 |
|
488 |
/**
|
489 |
* Introduce el tipo de s?mbolo.
|
490 |
*
|
491 |
* @param m_symbolType The m_symbolType to set.
|
492 |
*/
|
493 |
public void setSymbolType(int m_symbolType) { |
494 |
this.m_symbolType = m_symbolType;
|
495 |
} |
496 |
|
497 |
/**
|
498 |
* Devuelve el tipo de s?mbolo.
|
499 |
*
|
500 |
* @return Returns the m_symbolType.
|
501 |
*/
|
502 |
public int getSymbolType() { |
503 |
return m_symbolType;
|
504 |
} |
505 |
|
506 |
/**
|
507 |
* Introduce si el s?mbolo contiene linea de brode o no.
|
508 |
*
|
509 |
* @param m_useOutline The m_useOutline to set.
|
510 |
*/
|
511 |
public void setOutlined(boolean m_useOutline) { |
512 |
this.m_useOutline = m_useOutline;
|
513 |
|
514 |
// calculateRgb();
|
515 |
} |
516 |
|
517 |
/**
|
518 |
* Devuelve si el s?mbolo contiene o no linea de borde.
|
519 |
*
|
520 |
* @return Returns the m_useOutline.
|
521 |
*/
|
522 |
public boolean isOutlined() { |
523 |
return m_useOutline;
|
524 |
} |
525 |
|
526 |
/**
|
527 |
* Introduce el color del s?mbolo.
|
528 |
*
|
529 |
* @param m_Color The m_Color to set.
|
530 |
*/
|
531 |
public void setColor(Color m_Color) { |
532 |
this.m_Color = m_Color;
|
533 |
|
534 |
// calculateRgb();
|
535 |
} |
536 |
|
537 |
/**
|
538 |
* Devuelve el color del s?mbolo.
|
539 |
*
|
540 |
* @return Returns the m_Color.
|
541 |
*/
|
542 |
public Color getColor() { |
543 |
return m_Color;
|
544 |
} |
545 |
|
546 |
/**
|
547 |
* Introduce el color de la l?nea de borde.
|
548 |
*
|
549 |
* @param m_outlineColor The m_outlineColor to set.
|
550 |
*/
|
551 |
public void setOutlineColor(Color m_outlineColor) { |
552 |
this.m_outlineColor = m_outlineColor;
|
553 |
|
554 |
// calculateRgb();
|
555 |
} |
556 |
|
557 |
/**
|
558 |
* Devuelve el color de la l?nea de borde.
|
559 |
*
|
560 |
* @return Returns the m_outlineColor.
|
561 |
*/
|
562 |
public Color getOutlineColor() { |
563 |
return m_outlineColor;
|
564 |
} |
565 |
|
566 |
/**
|
567 |
* Introduce el Font del s?mbolo.
|
568 |
*
|
569 |
* @param m_Font The m_Font to set.
|
570 |
*/
|
571 |
public void setFont(Font m_Font) { |
572 |
this.m_Font = m_Font;
|
573 |
|
574 |
// calculateRgb();
|
575 |
} |
576 |
|
577 |
/**
|
578 |
* Devuelve el Font del s?mbolo.
|
579 |
*
|
580 |
* @return Returns the m_Font.
|
581 |
*/
|
582 |
public Font getFont() { |
583 |
return m_Font;
|
584 |
} |
585 |
|
586 |
/**
|
587 |
* Introduce el color de la fuente.
|
588 |
*
|
589 |
* @param m_FontColor The m_FontColor to set.
|
590 |
*/
|
591 |
public void setFontColor(Color m_FontColor) { |
592 |
this.m_FontColor = m_FontColor;
|
593 |
|
594 |
// calculateRgb();
|
595 |
} |
596 |
|
597 |
/**
|
598 |
* Devuelve el color de la fuente.
|
599 |
*
|
600 |
* @return Returns the m_FontColor.
|
601 |
*/
|
602 |
public Color getFontColor() { |
603 |
return m_FontColor;
|
604 |
} |
605 |
|
606 |
/**
|
607 |
* Introduce si se usa el tama?o de la fuente en pixels.
|
608 |
*
|
609 |
* @param m_bUseFontSize The m_bUseFontSize to set.
|
610 |
*/
|
611 |
public void setFontSizeInPixels(boolean m_bUseFontSize) { |
612 |
this.m_bUseFontSizeInPixels = m_bUseFontSize;
|
613 |
|
614 |
// calculateRgb();
|
615 |
} |
616 |
|
617 |
/**
|
618 |
* Devuelve true si el tama?o de la fuente esta seleccionado en pixels.
|
619 |
*
|
620 |
* @return Returns the m_bUseFontSize.
|
621 |
*/
|
622 |
public boolean isFontSizeInPixels() { |
623 |
return m_bUseFontSizeInPixels;
|
624 |
} |
625 |
|
626 |
/**
|
627 |
* Introduce si el shape e visible o no lo es.
|
628 |
*
|
629 |
* @param m_bDrawShape The m_bDrawShape to set.
|
630 |
*/
|
631 |
public void setShapeVisible(boolean m_bDrawShape) { |
632 |
this.m_bDrawShape = m_bDrawShape;
|
633 |
|
634 |
// calculateRgb();
|
635 |
} |
636 |
|
637 |
/**
|
638 |
* Devuelve true si el shape es visible.
|
639 |
*
|
640 |
* @return Returns the m_bDrawShape.
|
641 |
*/
|
642 |
public boolean isShapeVisible() { |
643 |
return m_bDrawShape;
|
644 |
} |
645 |
|
646 |
/**
|
647 |
* Introduce el tama?o del s?mbolo.
|
648 |
*
|
649 |
* @param m_Size The m_Size to set.
|
650 |
*/
|
651 |
public void setSize(int m_Size) { |
652 |
this.m_Size = m_Size;
|
653 |
|
654 |
// calculateRgb();
|
655 |
} |
656 |
|
657 |
/**
|
658 |
* Devuelve el tama?o del s?mbolo.
|
659 |
*
|
660 |
* @return Returns the m_Size.
|
661 |
*/
|
662 |
public int getSize() { |
663 |
return m_Size;
|
664 |
} |
665 |
|
666 |
/**
|
667 |
* Introduce la imagen que hace de icono.
|
668 |
*
|
669 |
* @param m_Icon The m_Icon to set.
|
670 |
*/
|
671 |
public void setIcon(Image m_Icon) { |
672 |
this.m_Icon = m_Icon;
|
673 |
|
674 |
// calculateRgb();
|
675 |
} |
676 |
|
677 |
/**
|
678 |
* Devuelve el icono.
|
679 |
*
|
680 |
* @return Returns the m_Icon.
|
681 |
*/
|
682 |
public Image getIcon() { |
683 |
return m_Icon;
|
684 |
} |
685 |
|
686 |
/**
|
687 |
* Introduce la rotaci?n.
|
688 |
*
|
689 |
* @param m_Rotation The m_Rotation to set.
|
690 |
*/
|
691 |
public void setRotation(int m_Rotation) { |
692 |
this.m_Rotation = m_Rotation;
|
693 |
|
694 |
// calculateRgb();
|
695 |
} |
696 |
|
697 |
/**
|
698 |
* Devuelve la rotaci?n.
|
699 |
*
|
700 |
* @return Returns the m_Rotation.
|
701 |
*/
|
702 |
public int getRotation() { |
703 |
return m_Rotation;
|
704 |
} |
705 |
|
706 |
/**
|
707 |
* Introduce el relleno.
|
708 |
*
|
709 |
* @param m_Fill The m_Fill to set.
|
710 |
*/
|
711 |
public void setFill(Paint m_Fill) { |
712 |
this.m_Fill = m_Fill;
|
713 |
|
714 |
// calculateRgb();
|
715 |
} |
716 |
|
717 |
/**
|
718 |
* Devuelve el relleno.
|
719 |
*
|
720 |
* @return Returns the m_Fill.
|
721 |
*/
|
722 |
public Paint getFill() { |
723 |
return m_Fill;
|
724 |
} |
725 |
|
726 |
/**
|
727 |
* Introduce el Stroke.
|
728 |
*
|
729 |
* @param m_Stroke The m_Stroke to set.
|
730 |
*/
|
731 |
public void setStroke(Stroke m_Stroke) { |
732 |
this.m_Stroke = m_Stroke;
|
733 |
|
734 |
// calculateRgb();
|
735 |
} |
736 |
|
737 |
/**
|
738 |
* Devuelve el Stroke.
|
739 |
*
|
740 |
* @return Returns the m_Stroke.
|
741 |
*/
|
742 |
public Stroke getStroke() { |
743 |
return m_Stroke;
|
744 |
} |
745 |
|
746 |
/**
|
747 |
* Introduce si el tama?o del simbolo est? en pixels.
|
748 |
*
|
749 |
* @param m_bUseSize The m_bUseSize to set.
|
750 |
*/
|
751 |
public void setSizeInPixels(boolean m_bUseSize) { |
752 |
this.m_bUseSize = m_bUseSize;
|
753 |
|
754 |
// calculateRgb();
|
755 |
} |
756 |
|
757 |
/**
|
758 |
* Devuelve si el tama?o del s?mbolo est? en pixels.
|
759 |
*
|
760 |
* @return Returns the m_bUseSize.
|
761 |
*/
|
762 |
public boolean isSizeInPixels() { |
763 |
return m_bUseSize;
|
764 |
} |
765 |
|
766 |
/**
|
767 |
* Introduce la descripci?n del s?mbolo.
|
768 |
*
|
769 |
* @param m_Descrip The m_Descrip to set.
|
770 |
*/
|
771 |
public void setDescription(String m_Descrip) { |
772 |
this.m_Descrip = m_Descrip;
|
773 |
} |
774 |
|
775 |
/**
|
776 |
* Devuelve la descripci?n del s?mbolo.
|
777 |
*
|
778 |
* @return Returns the m_Descrip.
|
779 |
*/
|
780 |
public String getDescription() { |
781 |
return m_Descrip;
|
782 |
} |
783 |
|
784 |
/**
|
785 |
* Introduce la alineaci?n en vertical.
|
786 |
*
|
787 |
* @param m_AlingVert The m_AlingVert to set.
|
788 |
*/
|
789 |
public void setAlingVert(int m_AlingVert) { |
790 |
this.m_AlingVert = m_AlingVert;
|
791 |
|
792 |
// calculateRgb();
|
793 |
} |
794 |
|
795 |
/**
|
796 |
* Devuelve la alineaci?n en vertical.
|
797 |
*
|
798 |
* @return Returns the m_AlingVert.
|
799 |
*/
|
800 |
public int getAlingVert() { |
801 |
return m_AlingVert;
|
802 |
} |
803 |
|
804 |
/**
|
805 |
* Introduce la alineaci?n en horizontal.
|
806 |
*
|
807 |
* @param m_AlingHoriz The m_AlingHoriz to set.
|
808 |
*/
|
809 |
public void setAlingHoriz(int m_AlingHoriz) { |
810 |
this.m_AlingHoriz = m_AlingHoriz;
|
811 |
|
812 |
// calculateRgb();
|
813 |
} |
814 |
|
815 |
/**
|
816 |
* Devuelve la alineaci?n en horizontal.
|
817 |
*
|
818 |
* @return Returns the m_AlingHoriz.
|
819 |
*/
|
820 |
public int getAlingHoriz() { |
821 |
return m_AlingHoriz;
|
822 |
} |
823 |
|
824 |
/**
|
825 |
* Devuelve el color que se aplica a los shapes seleccionados.
|
826 |
*
|
827 |
* @return DOCUMENT ME!
|
828 |
*/
|
829 |
public static Color getSelectionColor() { |
830 |
return selectionColor;
|
831 |
} |
832 |
|
833 |
/**
|
834 |
* Introduce el color que se aplica a los shapes seleccionados.
|
835 |
*
|
836 |
* @param selectionColor DOCUMENT ME!
|
837 |
*/
|
838 |
public static void setSelectionColor(Color selectionColor) { |
839 |
FSymbol.selectionColor = selectionColor; |
840 |
} |
841 |
|
842 |
/**
|
843 |
* Introduce el tama?o de la fuente.
|
844 |
*
|
845 |
* @param m_FontSize The m_FontSize to set.
|
846 |
*/
|
847 |
public void setFontSize(float m_FontSize) { |
848 |
this.m_FontSize = m_FontSize;
|
849 |
} |
850 |
|
851 |
/**
|
852 |
* Devuelve el tama?o de la fuente.
|
853 |
*
|
854 |
* @return Returns the m_FontSize.
|
855 |
*/
|
856 |
public float getFontSize() { |
857 |
return m_FontSize;
|
858 |
} |
859 |
public URI getIconURI() { |
860 |
return m_IconURI;
|
861 |
} |
862 |
public void setIconURI(URI iconURI) { |
863 |
m_IconURI = iconURI; |
864 |
ImageIcon prov;
|
865 |
try {
|
866 |
prov = new ImageIcon(iconURI.toURL()); |
867 |
m_Icon = prov.getImage(); |
868 |
} catch (MalformedURLException e) { |
869 |
// TODO Auto-generated catch block
|
870 |
e.printStackTrace(); |
871 |
} |
872 |
|
873 |
} |
874 |
} |