Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / rendering / styling / FStyle2D.java @ 360

History | View | Annotate | Download (3.27 KB)

1
/*
2
 * Created on 22-nov-2004
3
 *
4
 * TODO To change the template for this generated file go to
5
 * Window - Preferences - Java - Code Generation - Code and Comments
6
 */
7
package com.iver.cit.gvsig.fmap.rendering.styling;
8

    
9
import java.awt.Graphics2D;
10
import java.awt.Rectangle;
11
import java.awt.image.BufferedImage;
12

    
13
import org.geotools.renderer.style.Style2D;
14

    
15
import com.iver.cit.gvsig.fmap.rendering.FStyledShapePainter;
16

    
17
/**
18
 * @author FJP
19
 *
20
 * TODO To change the template for this generated type comment go to
21
 * Window - Preferences - Java - Code Generation - Code and Comments
22
 * 
23
 */
24
public class FStyle2D {
25
        public static final int POINT = 1;
26
    public static final int LINE = 2;
27
    public static final int POLYGON = 4;
28
    public static final int TEXT = 8;
29
    
30
    /**
31
         * RGB (incluye transparencia) que se utilizar? para la aceleraci?n gr?fica
32
         */
33
        private int rgbPoint;
34
        private int rgbLine;
35
        private int rgbPolygon;
36
        private int rgbText;
37
        private Style2D pointStyle2D;
38
        private Style2D lineStyle2D;
39
        private Style2D polygonStyle2D;
40
        private Style2D textStyle2D;
41
        private static BufferedImage img = new BufferedImage(1,1,BufferedImage.TYPE_INT_ARGB);
42
        private static FStyledShapePainter shpPainter = new FStyledShapePainter();
43
        private static Rectangle rect = new Rectangle(0,0,1,1);
44
                
45
        /**
46
         * @return Returns the rgb (incluye transparencia) que se utilizar? para la aceleraci?n gr?fica.
47
         */
48
        public int getRgbPoint() {
49
                return rgbPoint;
50
        }
51
        /**
52
         * @return Returns the rgbLine.
53
         */
54
        public int getRgbLine() {
55
                return rgbLine;
56
        }
57
        /**
58
         * @return Returns the rgbPolygon.
59
         */
60
        public int getRgbPolygon() {
61
                return rgbPolygon;
62
        }
63
        /**
64
         * @return Returns the rgbText.
65
         */
66
        public int getRgbText() {
67
                return rgbText;
68
        }
69
        
70
        /**
71
         * @return Returns the style2D.
72
         */
73
        public synchronized Style2D getLineStyle2D() {
74
                return lineStyle2D;
75
        }
76
        /**
77
         * @param style2D The style2D to set.
78
         */
79
        public synchronized void setLineStyle2D(Style2D style2D) {
80
                lineStyle2D = style2D;
81
                // Recalculamos el RGB
82
                Graphics2D g2 = img.createGraphics();
83
                
84
                shpPainter.paint(g2,rect,style2D,0);                
85
                rgbLine = img.getRGB(0,0);
86
                
87
        }
88
        
89
        /**
90
         * @return Returns the style2D.
91
         */
92
        public synchronized Style2D getPolygonStyle2D() {
93
                return polygonStyle2D;
94
        }
95
        /**
96
         * @param style2D The style2D to set.
97
         */
98
        public synchronized void setPolygonStyle2D(Style2D style2D) {
99
                polygonStyle2D = style2D;
100
                // Recalculamos el RGB
101
                Graphics2D g2 = img.createGraphics();
102
                
103
                shpPainter.paint(g2,rect,style2D,0);                
104
                rgbPolygon = img.getRGB(0,0);
105
                
106
        }
107
        
108
        /**
109
         * @return Returns the style2D.
110
         */
111
        public synchronized Style2D getPointStyle2D() {
112
                return pointStyle2D;
113
        }
114
        /**
115
         * @param style2D The style2D to set.
116
         */
117
        public synchronized void setPointStyle2D(Style2D style2D) {
118
                pointStyle2D = style2D;
119
                // Recalculamos el RGB
120
                Graphics2D g2 = img.createGraphics();
121
                
122
                shpPainter.paint(g2,rect,style2D,0);                
123
                rgbPoint = img.getRGB(0,0);
124
                
125
        }
126
        
127
        /**
128
         * @return Returns the style2D.
129
         */
130
        public synchronized Style2D getTextStyle2D() {
131
                return textStyle2D;
132
        }
133
        /**
134
         * @param style2D The style2D to set.
135
         */
136
        public synchronized void setTextStyle2D(Style2D style2D) {
137
                textStyle2D = style2D;
138
                // Recalculamos el RGB
139
                Graphics2D g2 = img.createGraphics();
140
                
141
                shpPainter.paint(g2,rect,style2D,0);                
142
                rgbText = img.getRGB(0,0);
143
                
144
        }
145

    
146
}