Statistics
| Revision:

root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / core / v02 / FSymbol.java @ 2976

History | View | Annotate | Download (23.9 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
import java.util.ArrayList;
62
import java.util.List;
63
import java.util.StringTokenizer;
64

    
65
import javax.swing.ImageIcon;
66

    
67
import com.iver.cit.gvsig.fmap.core.FShape;
68
import com.iver.utiles.StringUtilities;
69
import com.iver.utiles.XMLEntity;
70

    
71

    
72
/**
73
 * S?mbolo utilizado para guardar las caracter?sticas que se deben de aplicar a
74
 * los Shapes a dibujar.
75
 *
76
 * @author Vicente Caballero Navarro
77
 */
78
public class FSymbol {
79
        private static BufferedImage img = new BufferedImage(1, 1,
80
                        BufferedImage.TYPE_INT_ARGB);
81
        private static Rectangle rect = new Rectangle(0, 0, 1, 1);
82
        private static Color selectionColor = Color.YELLOW;
83
        private int m_symbolType;
84
        private int m_Style;
85
        private boolean m_useOutline;
86
        private Color m_Color;
87
        private Color m_outlineColor;
88
        private Font m_Font;
89
        private Color m_FontColor;
90
        private float m_FontSize;
91
        private int rgb;
92
    
93
        /**
94
         * Si <code>m_bUseFontSize</code> viene a false entonces m_FontSize viene
95
         * en unidades de mapa (metros)
96
         */
97
        private boolean m_bUseFontSizeInPixels;
98

    
99
        /**
100
         * <code>m_bDrawShape</code> indica si queremos dibujar el shape de fondo.
101
         * Es ?til cuando est?s etiquetando y no quieres que se dibuje el s?mbolo
102
         * que te sirve de base para etiquetar.
103
         */
104
        private boolean m_bDrawShape = true;
105
        private int m_Size;
106
        private Image m_Icon;
107
        private URI m_IconURI;
108
        private int m_Rotation;
109
        private Paint m_Fill;
110
        public String m_LinePattern = "0"; // Solo para poder mostrarlo cuando vamos a seleccionar un s?mbolo
111

    
112
        // En realidad lo podemos ver de BasicStroke, pero....
113
        // ya veremos si luego lo quitamos.
114
        private Stroke m_Stroke;
115

    
116
        //private float m_stroke=0;
117
        // public int m_Transparency; // Ya la lleva dentro del Color
118
        private boolean m_bUseSize; // Si est? a true, m_Size viene en coordenadas de mundo real.
119
        private int m_AlingVert;
120
        private int m_AlingHoriz;
121
        private String m_Descrip;
122
        public Color m_BackColor;
123
        public Paint m_BackFill;
124

    
125
    /**
126
     * Converts the comma-delimited string into a List of trimmed strings.
127
     *
128
     * @param linePattern a String with comma-delimited values
129
     * @param lineWidth DOCUMENT ME!
130
     *
131
     * @return a List of the Strings that were delimited by commas
132
     *
133
     * @throws IllegalArgumentException DOCUMENT ME!
134
     */
135
    public static float[] toArray(String linePattern, float lineWidth) {
136
        StringTokenizer st = new StringTokenizer(linePattern, ",");
137
        int numTokens = st.countTokens();
138

    
139
        float[] array = new float[numTokens];
140

    
141
        for (int i = 0; i < numTokens; i++) {
142
            String string = st.nextToken();
143
            array[i] = Float.parseFloat(string) * lineWidth;
144

    
145
            if (array[i] <= 0) {
146
                return null;
147
            }
148
        }
149

    
150
        return array;
151
    }
152

    
153
        /**
154
         * Crea un nuevo FSymbol.
155
         */
156
        FSymbol() {
157
        }
158

    
159
        /**
160
         * Creates a new FSymbol object.
161
         *
162
         * @param tipoSymbol Tipo de s?mbolo.
163
         * @param c Color.
164
         */
165
        public FSymbol(int tipoSymbol, Color c) {
166
                createSymbol(tipoSymbol, c);
167
        }
168

    
169
        /**
170
         * Crea un nuevo FSymbol.
171
         *
172
         * @param tipoSymbol Tipo de S?mbolo.
173
         */
174
        public FSymbol(int tipoSymbol) {
175
                int numreg = (int) (Math.random() * 100);
176
                Color colorAleatorio = new Color(((numreg * numreg) + 100) % 255,
177
                                (numreg + ((3 * numreg) + 100)) % 255, numreg % 255);
178

    
179
                createSymbol(tipoSymbol, colorAleatorio);
180
        }
181

    
182
        /**
183
         * A partir de un s?mbolo devuelve otro similar pero con el color de
184
         * selecci?n.
185
         *
186
         * @param sym S?mbolo a modificar.
187
         *
188
         * @return S?mbolo modificado.
189
         */
190
        public static FSymbol getSymbolForSelection(FSymbol sym) {
191
                FSymbol selecSymbol = sym.fastCloneSymbol();
192
                selecSymbol.setColor(getSelectionColor());
193
                selecSymbol.setFill(null);
194
                // 050215, jmorell: Si en los drivers cambiamos el estilo, aqu? tenemos que
195
                // actualizar los cambios. SYMBOL_STYLE_MARKER_SQUARE --> SYMBOL_STYLE_DGNSPECIAL.
196
                if ((selecSymbol.getStyle() == FConstant.SYMBOL_STYLE_FILL_TRANSPARENT)
197
                        || (selecSymbol.getStyle() == FConstant.SYMBOL_STYLE_DGNSPECIAL))
198
                    selecSymbol.setStyle(FConstant.SYMBOL_STYLE_FILL_SOLID);
199
                selecSymbol.rgb = getSelectionColor().getRGB();
200

    
201
                return selecSymbol;
202
        }
203

    
204
        /**
205
         * Clona el s?mbolo actual.
206
         *
207
         * @return Nuevo s?mbolo clonado.
208
         */
209
        public FSymbol cloneSymbol() {
210
                return createFromXML(getXMLEntity());
211
        }
212
        
213
        /**
214
         * Se usa para el s?mbolo de selecci?n. Es una forma
215
         * r?pida de clonar un s?mbolo, sin hacerlo via XML.
216
         * Vicente, no lo borres!!!
217
         * @return
218
         */
219
        public FSymbol fastCloneSymbol()
220
        {
221
                FSymbol nS = new FSymbol();
222

    
223
                
224
                nS.m_symbolType = m_symbolType; 
225
                nS.m_Style = m_Style;
226
                nS.m_useOutline = m_useOutline;
227
                nS.m_Color = m_Color;
228
                nS.m_outlineColor = m_outlineColor;
229
                nS.m_Font = m_Font;
230
                nS.m_FontColor = m_FontColor;
231
                nS.m_FontSize = m_FontSize;
232
                nS.m_bUseFontSizeInPixels = m_bUseFontSizeInPixels;
233
                nS.m_bDrawShape = m_bDrawShape;
234
                nS.m_Size = m_Size;
235
                nS.m_Icon = m_Icon;
236
                nS.m_IconURI = m_IconURI;
237
                nS.m_Rotation = m_Rotation;
238
                nS.m_Fill = m_Fill;
239
                nS.m_Stroke = m_Stroke;
240
                // nS.m_Transparency =m_Transparency ;
241
                nS.m_bUseSize = m_bUseSize;
242
                nS.m_AlingVert = m_AlingVert;
243
                nS.m_AlingHoriz = m_AlingHoriz;
244
                nS.m_Descrip = m_Descrip;
245
                nS.m_BackColor = m_BackColor;
246
                nS.m_BackFill = m_BackFill;
247
                
248
                nS.m_LinePattern = m_LinePattern;
249
                
250
                return nS;
251
        }
252
        
253

    
254
        /**
255
         * Crea un s?mbolo a partir del tipo y el color.
256
         *
257
         * @param tipoSymbol Tipo de s?mbolo.
258
         * @param c Color del s?mbolo a crear.
259
         */
260
        private void createSymbol(int tipoSymbol, Color c) {
261
                // OJO: HE HECHO COINCIDIR LOS TIPOS DE SIMBOLO 
262
                //FConstant.SYMBOL_TYPE_POINT, LINE Y FILL CON
263
                // FShape.POINT, LINE, POLYGON. EL .MULTI SE REFIERE
264
                // A MULTIPLES TIPO DENTRO DEL SHAPE, AS? QUE SER? UN
265
                // MULTISIMBOLO
266
                // Tipo de simbolo
267
                m_symbolType = tipoSymbol; // Para no recalcular el pixel, no usamos los set
268

    
269
                // Ponemos un estilo por defecto
270
                m_useOutline = true;
271
                m_Color = c;
272
                m_Stroke = null;
273
                m_Fill = null;
274

    
275
                m_FontColor = Color.BLACK;
276
                m_FontSize = 10;
277
                m_bUseFontSizeInPixels = true;
278

    
279
                m_Size = 2;
280

    
281
                switch (getSymbolType()) {
282
                        case FConstant.SYMBOL_TYPE_POINT:
283
                        case FConstant.SYMBOL_TYPE_POINTZ:
284
                        case FConstant.SYMBOL_TYPE_MULTIPOINT:
285
                                m_bUseSize = true; // Esto es lo primero que hay que hacer siempre
286

    
287
                                // para evitar un StackOverflow
288
                                m_useOutline = false;
289
                                setStyle(FConstant.SYMBOL_STYLE_MARKER_SQUARE);
290
                                setSize(5); //pixels
291

    
292
                                break;
293

    
294
                        case FConstant.SYMBOL_TYPE_LINE:
295
                        case FConstant.SYMBOL_TYPE_POLYLINEZ:
296
                        case FConstant.SYMBOL_TYPE_POLYGONZ:
297
                                setStroke(new BasicStroke());
298
                                setStyle(FConstant.SYMBOL_STYLE_LINE_SOLID);
299

    
300
                                break;
301

    
302
                        case FConstant.SYMBOL_TYPE_FILL:
303
                        case FShape.MULTI:
304
                            setStroke(new BasicStroke());
305
                                setStyle(FConstant.SYMBOL_STYLE_FILL_SOLID);
306

    
307
                                break;
308
                }
309

    
310
                m_outlineColor = c.darker();
311

    
312
                calculateRgb();
313
        }
314

    
315
        /**
316
         * Calcula el RGB del s?mbolo.
317
         */
318
        public void calculateRgb() {
319
                // Recalculamos el RGB
320
                Graphics2D g2 = img.createGraphics();
321

    
322
                FGraphicUtilities.DrawSymbol(g2, g2.getTransform(), rect, this);
323
                rgb = img.getRGB(0, 0);
324
        }
325

    
326
        /**
327
         * Devuelve el rgb del s?mbolo.
328
         *
329
         * @return rgb del s?mbolo.
330
         */
331
        public int getRgb() {
332
                return rgb;
333
        }
334

    
335
        /**
336
         * @see com.iver.cit.gvsig.gui.layout.fframes.IFFrame#getXMLEntity()
337
         */
338
        public XMLEntity getXMLEntity() {
339
                XMLEntity xml = new XMLEntity();
340
                xml.putProperty("className",this.getClass().getName());
341
                xml.putProperty("m_symbolType", getSymbolType());
342
                xml.putProperty("m_Style", getStyle());
343
                xml.putProperty("m_useOutline", isOutlined());
344

    
345
                if (getColor() != null) {
346
                        xml.putProperty("m_Color", StringUtilities.color2String(getColor()));
347
                }
348

    
349
                if (getOutlineColor() != null) {
350
                        xml.putProperty("m_outlineColor",
351
                                StringUtilities.color2String(getOutlineColor()));
352
                }
353

    
354
                if (getFont() != null) {
355
                        xml.putProperty("fontname", getFont().getName());
356
                        xml.putProperty("fontstyle", getFont().getStyle());
357
                
358
                        xml.putProperty("m_FontSize", getFontSize());
359
                        xml.putProperty("m_FontColor",
360
                                StringUtilities.color2String(getFontColor()));
361
                
362
                }
363
                xml.putProperty("m_bUseFontSize", isFontSizeInPixels());
364
                xml.putProperty("m_bDrawShape", isShapeVisible());
365
                xml.putProperty("m_Size", getSize());
366

    
367
                //xml.putProperty("m_Icon",m_Icon.);
368
                xml.putProperty("m_Rotation", getRotation());
369

    
370
                if (getFill() instanceof Color) {
371
                        xml.putProperty("m_Fill",
372
                                StringUtilities.color2String((Color) getFill()));
373
                }
374
                else
375
                        if (getFill() != null)
376
                        {
377
                            xml.putProperty("m_Fill", "WithFill");
378
                        }
379

    
380

    
381
                xml.putProperty("m_LinePattern", m_LinePattern);
382

    
383
                //Ancho del stroke en float
384
                if (getStroke() != null) {
385
                        xml.putProperty("m_stroke",
386
                                ((BasicStroke) getStroke()).getLineWidth());
387
                } else {
388
                        xml.putProperty("m_stroke", 0f);
389
                }
390

    
391
                xml.putProperty("m_bUseSize", isSizeInPixels());
392
                xml.putProperty("m_AlingVert", getAlingVert());
393
                xml.putProperty("m_AlingHoriz", getAlingHoriz());
394
                xml.putProperty("m_Descrip", getDescription());
395

    
396
                if (m_BackColor != null) {
397
                        xml.putProperty("m_BackColor",
398
                                StringUtilities.color2String(m_BackColor));
399
                }
400

    
401
                if (m_BackFill instanceof Color) {
402
                        xml.putProperty("m_BackFill",
403
                                StringUtilities.color2String((Color) m_BackFill));
404
                }
405

    
406
                xml.putProperty("rgb", rgb);
407
                
408
                if (m_Icon != null)
409
                {
410
                    xml.putProperty("m_IconURI", m_IconURI);                    
411
                }
412

    
413
                return xml;
414
        }
415
        /**
416
         * Crea el s?mbolo a partir del xml.
417
         *
418
         * @param xml xml que contiene la informaci?n para crear el s?mbolo.
419
         *
420
         * @return S?mbolo creado a partir del XML.
421
         */
422
        public static FSymbol createFromXML03(XMLEntity xml) {
423
                FSymbol symbol = new FSymbol();
424
                symbol.setSymbolType(xml.getIntProperty("m_symbolType"));
425
                symbol.setStyle(xml.getIntProperty("m_Style"));
426
                // System.out.println("createFromXML: m_Style=" + xml.getIntProperty("m_Style"));
427

    
428
                symbol.setOutlined(xml.getBooleanProperty("m_useOutline"));
429

    
430
                if (xml.contains("m_Color")) {
431
                        symbol.setColor(StringUtilities.string2Color(xml.getStringProperty(
432
                                                "m_Color")));
433
                }
434

    
435
                if (xml.contains("m_outlineColor")) {
436
                        symbol.setOutlineColor(StringUtilities.string2Color(
437
                                        xml.getStringProperty("m_outlineColor")));
438
                }
439

    
440
                if (xml.contains("m_FontColor")) {
441
                        symbol.setFont(new Font(xml.getStringProperty("fontname"),
442
                                        xml.getIntProperty("fontstyle"),
443
                                        (int) xml.getFloatProperty("m_FontSize")));
444
                        symbol.setFontColor(StringUtilities.string2Color(
445
                                        xml.getStringProperty("m_FontColor")));
446
                        symbol.setFontSize(xml.getFloatProperty("m_FontSize"));
447
                }
448

    
449
                symbol.setFontSizeInPixels(xml.getBooleanProperty("m_bUseFontSize"));
450
                symbol.setShapeVisible(xml.getBooleanProperty("m_bDrawShape"));
451
                symbol.setSize(xml.getIntProperty("m_Size"));
452

    
453
                //xml.putProperty("m_Icon",m_Icon.);
454
                symbol.setRotation(xml.getIntProperty("m_Rotation"));
455

    
456
                if (xml.contains("m_Fill")) {
457
                    // TODO: Si es un Fill de tipo imagen, deber?amos recuperar la imagen.
458
                    String strFill = xml.getStringProperty("m_Fill");
459
                    if (strFill.compareTo("WithFill") == 0)
460
                        symbol.setFill(FSymbolFactory.createPatternFill(symbol.getStyle(), symbol.getColor()));
461
                    else
462
                        symbol.setFill(StringUtilities.string2Color(strFill));
463
                }
464

    
465
                
466
                symbol.m_LinePattern = xml.getStringProperty("m_LinePattern");
467

    
468
                //Ancho del stroke en float
469
                symbol.setStroke(new BasicStroke(xml.getFloatProperty("m_stroke")));
470
                symbol.setSizeInPixels(xml.getBooleanProperty("m_bUseSize"));
471
                symbol.setAlingVert(xml.getIntProperty("m_AlingVert"));
472
                symbol.setAlingHoriz(xml.getIntProperty("m_AlingHoriz"));
473
                symbol.setDescription(xml.getStringProperty("m_Descrip"));
474

    
475
                if (xml.contains("m_BackColor")) {
476
                        symbol.m_BackColor = StringUtilities.string2Color(xml.getStringProperty(
477
                                                "m_BackColor"));
478
                }
479

    
480
                if (xml.contains("m_BackFill")) {
481
                        symbol.m_BackFill = StringUtilities.string2Color(xml.getStringProperty(
482
                                                "m_BackFill"));
483
                }
484

    
485
                symbol.rgb = xml.getIntProperty("rgb");
486
                
487
                if (xml.contains("m_IconURI")) {
488
                    try {
489
                symbol.setIconURI(new URI(xml.getStringProperty("m_IconURI")));
490
            } catch (URISyntaxException e) {
491
                // TODO Auto-generated catch block
492
                e.printStackTrace();
493
            }
494
                }
495

    
496
                return symbol;
497
        }
498

    
499
        /**
500
         * Crea el s?mbolo a partir del xml.
501
         *
502
         * @param xml xml que contiene la informaci?n para crear el s?mbolo.
503
         *
504
         * @return S?mbolo creado a partir del XML.
505
         */
506
        public static FSymbol createFromXML(XMLEntity xml) {
507
                FSymbol symbol = new FSymbol();
508
                symbol.setSymbolType(xml.getIntProperty("m_symbolType"));
509
                symbol.setStyle(xml.getIntProperty("m_Style"));
510
                // System.out.println("createFromXML: m_Style=" + xml.getIntProperty("m_Style"));
511

    
512
                symbol.setOutlined(xml.getBooleanProperty("m_useOutline"));
513

    
514
                if (xml.contains("m_Color")) {
515
                        symbol.setColor(StringUtilities.string2Color(xml.getStringProperty(
516
                                                "m_Color")));
517
                }
518

    
519
                if (xml.contains("m_outlineColor")) {
520
                        symbol.setOutlineColor(StringUtilities.string2Color(
521
                                        xml.getStringProperty("m_outlineColor")));
522
                }
523

    
524
                if (xml.contains("fontname")) {
525
                        symbol.setFont(new Font(xml.getStringProperty("fontname"),
526
                                        xml.getIntProperty("fontstyle"),
527
                                        (int) xml.getFloatProperty("m_FontSize")));
528
                
529
                        symbol.setFontColor(StringUtilities.string2Color(
530
                                        xml.getStringProperty("m_FontColor")));
531
                        symbol.setFontSize(xml.getFloatProperty("m_FontSize"));
532
                
533
                }
534
                symbol.setFontSizeInPixels(xml.getBooleanProperty("m_bUseFontSize"));
535
                symbol.setShapeVisible(xml.getBooleanProperty("m_bDrawShape"));
536
                symbol.setSize(xml.getIntProperty("m_Size"));
537

    
538
                //xml.putProperty("m_Icon",m_Icon.);
539
                symbol.setRotation(xml.getIntProperty("m_Rotation"));
540

    
541
                if (xml.contains("m_Fill")) {
542
                    // TODO: Si es un Fill de tipo imagen, deber?amos recuperar la imagen.
543
                    String strFill = xml.getStringProperty("m_Fill");
544
                    if (strFill.compareTo("WithFill") == 0)
545
                        symbol.setFill(FSymbolFactory.createPatternFill(symbol.getStyle(), symbol.getColor()));
546
                    else
547
                        symbol.setFill(StringUtilities.string2Color(strFill));
548
                }
549

    
550
                
551
                symbol.m_LinePattern = xml.getStringProperty("m_LinePattern");
552

    
553
                //Ancho del stroke en float
554
        float lineWidth = xml.getFloatProperty("m_stroke"); 
555
        if (symbol.m_LinePattern.compareTo("0") == 0)
556
        {
557
            symbol.setStroke(new BasicStroke(lineWidth));
558
        }
559
        else
560
        {
561
            symbol.setStroke(new BasicStroke(lineWidth, BasicStroke.CAP_ROUND,
562
                    BasicStroke.JOIN_BEVEL, 1.0f,
563
                        toArray(symbol.m_LinePattern, lineWidth), 0));
564
        }
565
        
566
                symbol.setSizeInPixels(xml.getBooleanProperty("m_bUseSize"));
567
                symbol.setAlingVert(xml.getIntProperty("m_AlingVert"));
568
                symbol.setAlingHoriz(xml.getIntProperty("m_AlingHoriz"));
569
                symbol.setDescription(xml.getStringProperty("m_Descrip"));
570

    
571
                if (xml.contains("m_BackColor")) {
572
                        symbol.m_BackColor = StringUtilities.string2Color(xml.getStringProperty(
573
                                                "m_BackColor"));
574
                }
575

    
576
                if (xml.contains("m_BackFill")) {
577
                        symbol.m_BackFill = StringUtilities.string2Color(xml.getStringProperty(
578
                                                "m_BackFill"));
579
                }
580

    
581
                symbol.rgb = xml.getIntProperty("rgb");
582
                
583
                if (xml.contains("m_IconURI")) {
584
                    try {
585
                symbol.setIconURI(new URI(xml.getStringProperty("m_IconURI")));
586
            } catch (URISyntaxException e) {
587
                // TODO Auto-generated catch block
588
                e.printStackTrace();
589
            }
590
                }
591

    
592
                return symbol;
593
        }
594

    
595
        /**
596
         * Introduce el estilo del s?mbolo.
597
         *
598
         * @param m_Style The m_Style to set.
599
         */
600
        public void setStyle(int m_Style) {
601
                this.m_Style = m_Style;
602

    
603
                //                 calculateRgb();
604
        }
605

    
606
        /**
607
         * Devuelve el estilo del s?mbolo.
608
         *
609
         * @return Returns the m_Style.
610
         */
611
        public int getStyle() {
612
                return m_Style;
613
        }
614

    
615
        /**
616
         * Introduce el tipo de s?mbolo.
617
         *
618
         * @param m_symbolType The m_symbolType to set.
619
         */
620
        public void setSymbolType(int m_symbolType) {
621
                this.m_symbolType = m_symbolType;
622
        }
623

    
624
        /**
625
         * Devuelve el tipo de s?mbolo.
626
         *
627
         * @return Returns the m_symbolType.
628
         */
629
        public int getSymbolType() {
630
                return m_symbolType;
631
        }
632

    
633
        /**
634
         * Introduce si el s?mbolo contiene linea de brode o no.
635
         *
636
         * @param m_useOutline The m_useOutline to set.
637
         */
638
        public void setOutlined(boolean m_useOutline) {
639
                this.m_useOutline = m_useOutline;
640

    
641
                //                 calculateRgb();
642
        }
643

    
644
        /**
645
         * Devuelve si el s?mbolo contiene o no linea de borde.
646
         *
647
         * @return Returns the m_useOutline.
648
         */
649
        public boolean isOutlined() {
650
                return m_useOutline;
651
        }
652

    
653
        /**
654
         * Introduce el color del s?mbolo.
655
         *
656
         * @param m_Color The m_Color to set.
657
         */
658
        public void setColor(Color m_Color) {
659
                this.m_Color = m_Color;
660
                calculateRgb();
661
        }
662

    
663
        /**
664
         * Devuelve el color del s?mbolo.
665
         *
666
         * @return Returns the m_Color.
667
         */
668
        public Color getColor() {
669
                return m_Color;
670
        }
671

    
672
        /**
673
         * Introduce el color de la l?nea de borde.
674
         *
675
         * @param m_outlineColor The m_outlineColor to set.
676
         */
677
        public void setOutlineColor(Color m_outlineColor) {
678
                this.m_outlineColor = m_outlineColor;
679

    
680
                //                 calculateRgb();
681
        }
682

    
683
        /**
684
         * Devuelve el color de la l?nea de borde.
685
         *
686
         * @return Returns the m_outlineColor.
687
         */
688
        public Color getOutlineColor() {
689
                return m_outlineColor;
690
        }
691

    
692
        /**
693
         * Introduce el Font del s?mbolo.
694
         *
695
         * @param m_Font The m_Font to set.
696
         */
697
        public void setFont(Font m_Font) {
698
                this.m_Font = m_Font;
699

    
700
                //                 calculateRgb();
701
        }
702

    
703
        /**
704
         * Devuelve el Font del s?mbolo.
705
         *
706
         * @return Returns the m_Font.
707
         */
708
        public Font getFont() {
709
                return m_Font;
710
        }
711

    
712
        /**
713
         * Introduce el color de la fuente.
714
         *
715
         * @param m_FontColor The m_FontColor to set.
716
         */
717
        public void setFontColor(Color m_FontColor) {
718
                this.m_FontColor = m_FontColor;
719

    
720
                //                 calculateRgb();
721
        }
722

    
723
        /**
724
         * Devuelve el color de la fuente.
725
         *
726
         * @return Returns the m_FontColor.
727
         */
728
        public Color getFontColor() {
729
                return m_FontColor;
730
        }
731

    
732
        /**
733
         * Introduce si se usa el tama?o de la fuente en pixels.
734
         *
735
         * @param m_bUseFontSize The m_bUseFontSize to set.
736
         */
737
        public void setFontSizeInPixels(boolean m_bUseFontSize) {
738
                this.m_bUseFontSizeInPixels = m_bUseFontSize;
739

    
740
                // calculateRgb();
741
        }
742

    
743
        /**
744
         * Devuelve true si el tama?o de la fuente esta seleccionado en pixels.
745
         *
746
         * @return Returns the m_bUseFontSize.
747
         */
748
        public boolean isFontSizeInPixels() {
749
                return m_bUseFontSizeInPixels;
750
        }
751

    
752
        /**
753
         * Introduce si el shape e visible o no lo es.
754
         *
755
         * @param m_bDrawShape The m_bDrawShape to set.
756
         */
757
        public void setShapeVisible(boolean m_bDrawShape) {
758
                this.m_bDrawShape = m_bDrawShape;
759

    
760
                //                 calculateRgb();
761
        }
762

    
763
        /**
764
         * Devuelve true si el shape es visible.
765
         *
766
         * @return Returns the m_bDrawShape.
767
         */
768
        public boolean isShapeVisible() {
769
                return m_bDrawShape;
770
        }
771

    
772
        /**
773
         * Introduce el tama?o del s?mbolo.
774
         *
775
         * @param m_Size The m_Size to set.
776
         */
777
        public void setSize(int m_Size) {
778
                this.m_Size = m_Size;
779

    
780
                //                 calculateRgb();
781
        }
782

    
783
        /**
784
         * Devuelve el tama?o del s?mbolo.
785
         *
786
         * @return Returns the m_Size.
787
         */
788
        public int getSize() {
789
                return m_Size;
790
        }
791

    
792
        /**
793
         * Introduce la imagen que hace de icono.
794
         *
795
         * @param m_Icon The m_Icon to set.
796
         */
797
        public void setIcon(Image m_Icon) {
798
                this.m_Icon = m_Icon;
799

    
800
                //                 calculateRgb();
801
        }
802

    
803
        /**
804
         * Devuelve el icono.
805
         *
806
         * @return Returns the m_Icon.
807
         */
808
        public Image getIcon() {
809
                return m_Icon;
810
        }
811

    
812
        /**
813
         * Introduce la rotaci?n.
814
         *
815
         * @param m_Rotation The m_Rotation to set.
816
         */
817
        public void setRotation(int m_Rotation) {
818
                this.m_Rotation = m_Rotation;
819

    
820
                //                 calculateRgb();
821
        }
822

    
823
        /**
824
         * Devuelve la rotaci?n.
825
         *
826
         * @return Returns the m_Rotation.
827
         */
828
        public int getRotation() {
829
                return m_Rotation;
830
        }
831

    
832
        /**
833
         * Introduce el relleno.
834
         *
835
         * @param m_Fill The m_Fill to set.
836
         */
837
        public void setFill(Paint m_Fill) {
838
                this.m_Fill = m_Fill;
839

    
840
                //                 calculateRgb();
841
        }
842

    
843
        /**
844
         * Devuelve el relleno.
845
         *
846
         * @return Returns the m_Fill.
847
         */
848
        public Paint getFill() {
849
                return m_Fill;
850
        }
851

    
852
        /**
853
         * Introduce el Stroke.
854
         *
855
         * @param m_Stroke The m_Stroke to set.
856
         */
857
        public void setStroke(Stroke m_Stroke) {
858
                this.m_Stroke = m_Stroke;
859

    
860
                //                 calculateRgb();
861
        }
862

    
863
        /**
864
         * Devuelve el Stroke.
865
         *
866
         * @return Returns the m_Stroke.
867
         */
868
        public Stroke getStroke() {
869
                return m_Stroke;
870
        }
871

    
872
        /**
873
         * Introduce si el tama?o del simbolo est? en pixels.
874
         *
875
         * @param m_bUseSize The m_bUseSize to set.
876
         */
877
        public void setSizeInPixels(boolean m_bUseSize) {
878
                this.m_bUseSize = m_bUseSize;
879

    
880
                //                 calculateRgb();
881
        }
882

    
883
        /**
884
         * Devuelve si el tama?o del s?mbolo est? en pixels.
885
         *
886
         * @return Returns the m_bUseSize.
887
         */
888
        public boolean isSizeInPixels() {
889
                return m_bUseSize;
890
        }
891

    
892
        /**
893
         * Introduce la descripci?n del s?mbolo.
894
         *
895
         * @param m_Descrip The m_Descrip to set.
896
         */
897
        public void setDescription(String m_Descrip) {
898
                this.m_Descrip = m_Descrip;
899
        }
900

    
901
        /**
902
         * Devuelve la descripci?n del s?mbolo.
903
         *
904
         * @return Returns the m_Descrip.
905
         */
906
        public String getDescription() {
907
                return m_Descrip;
908
        }
909

    
910
        /**
911
         * Introduce la alineaci?n en vertical.
912
         *
913
         * @param m_AlingVert The m_AlingVert to set.
914
         */
915
        public void setAlingVert(int m_AlingVert) {
916
                this.m_AlingVert = m_AlingVert;
917

    
918
                //                 calculateRgb();
919
        }
920

    
921
        /**
922
         * Devuelve la alineaci?n en vertical.
923
         *
924
         * @return Returns the m_AlingVert.
925
         */
926
        public int getAlingVert() {
927
                return m_AlingVert;
928
        }
929

    
930
        /**
931
         * Introduce la alineaci?n en horizontal.
932
         *
933
         * @param m_AlingHoriz The m_AlingHoriz to set.
934
         */
935
        public void setAlingHoriz(int m_AlingHoriz) {
936
                this.m_AlingHoriz = m_AlingHoriz;
937

    
938
                // calculateRgb();
939
        }
940

    
941
        /**
942
         * Devuelve la alineaci?n en horizontal.
943
         *
944
         * @return Returns the m_AlingHoriz.
945
         */
946
        public int getAlingHoriz() {
947
                return m_AlingHoriz;
948
        }
949

    
950
        /**
951
         * Devuelve el color que se aplica a los shapes seleccionados.
952
         *
953
         * @return DOCUMENT ME!
954
         */
955
        public static Color getSelectionColor() {
956
                return selectionColor;
957
        }
958

    
959
        /**
960
         * Introduce el color que se aplica a los shapes seleccionados.
961
         *
962
         * @param selectionColor DOCUMENT ME!
963
         */
964
        public static void setSelectionColor(Color selectionColor) {
965
                FSymbol.selectionColor = selectionColor;
966
        }
967

    
968
        /**
969
         * Introduce el tama?o de la fuente.
970
         *
971
         * @param m_FontSize The m_FontSize to set.
972
         */
973
        public void setFontSize(float m_FontSize) {
974
                this.m_FontSize = m_FontSize;
975
        }
976

    
977
        /**
978
         * Devuelve el tama?o de la fuente.
979
         *
980
         * @return Returns the m_FontSize.
981
         */
982
        public float getFontSize() {
983
                return m_FontSize;
984
        }
985
    public URI getIconURI() {
986
        return m_IconURI;
987
    }
988
    public void setIconURI(URI iconURI) {        
989
        m_IconURI = iconURI;
990
        ImageIcon prov;
991
        try {
992
            prov = new ImageIcon(iconURI.toURL());
993
            m_Icon = prov.getImage();
994
        } catch (MalformedURLException e) {
995
            // TODO Auto-generated catch block
996
            e.printStackTrace();
997
        }
998
            
999
    }
1000

    
1001
}