Statistics
| Revision:

root / trunk / extensions / extGraph_predes / src / com / iver / cit / gvsig / fmap / core / symbols / SimpleFillSymbol.java @ 8537

History | View | Annotate | Download (4.17 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41

    
42
/* CVS MESSAGES:
43
*
44
* $Id: SimpleFillSymbol.java 8537 2006-11-06 16:06:52Z jaume $
45
* $Log$
46
* Revision 1.2  2006-11-06 16:06:52  jaume
47
* *** empty log message ***
48
*
49
* Revision 1.1  2006/10/30 19:30:35  jaume
50
* *** empty log message ***
51
*
52
*
53
*/
54
package com.iver.cit.gvsig.fmap.core.symbols;
55

    
56
import java.awt.Color;
57
import java.awt.Graphics2D;
58
import java.awt.Rectangle;
59
import java.awt.Shape;
60
import java.awt.geom.AffineTransform;
61

    
62
import com.iver.cit.gvsig.fmap.core.FShape;
63
import com.iver.cit.gvsig.fmap.core.ISymbol;
64
//import com.iver.cit.gvsig.fmap.core.styles.SimpleStyle;
65
import com.iver.utiles.StringUtilities;
66
import com.iver.utiles.XMLEntity;
67

    
68
public class SimpleFillSymbol extends AbstractFillSymbol {
69

    
70
//        private SimpleStyle style;
71

    
72
        public ISymbol getSymbolForSelection() {
73
                // TODO Auto-generated method stub
74
                throw new Error("Not yet implemented!");
75
        }
76

    
77
        public void draw(Graphics2D g, AffineTransform affineTransform, FShape shp) {
78
                // TODO Auto-generated method stub
79
                throw new Error("Not yet implemented!");
80
        }
81

    
82
        public int getPixExtentPlus(Graphics2D g, AffineTransform affineTransform,
83
                        Shape shp) {
84
                // TODO Auto-generated method stub
85
                throw new Error("Not yet implemented!");
86
        }
87

    
88
        public int getOnePointRgb() {
89
                // TODO Auto-generated method stub
90
                throw new Error("Not yet implemented!");
91
        }
92

    
93
        public XMLEntity getXMLEntity() {
94
                XMLEntity xml = new XMLEntity();
95

    
96
                // the class name
97
                xml.putProperty("className", getClassName());
98

    
99
                // color
100
                xml.putProperty("color", StringUtilities.color2String(color));
101

    
102
                // outline
103
                xml.putProperty("outline", StringUtilities.color2String(outline));
104

    
105
                // description
106
                xml.putProperty("desc", desc);
107

    
108
                // is shape visible
109
                xml.putProperty("isShapeVisible", isShapeVisible);
110

    
111
                // layers
112
                if (layers!=null)
113
                        for (int i = 0; i < layers.length; i++) {
114
                                xml.addChild(layers[i].getXMLEntity());
115
                        }
116
                return xml;
117
        }
118

    
119
        public int getSymbolType() {
120
                // TODO Auto-generated method stub
121
                throw new Error("Not yet implemented!");
122
        }
123

    
124
        public void drawInsideRectangle(Graphics2D g,
125
                        AffineTransform scaleInstance, Rectangle r) {
126
                int height = (int) r.getHeight();
127
                int width = (int) r.getWidth();
128
                g.setColor(color);
129
                for (int i = 0; i < height; i++) {
130
                        g.drawLine(0, i, width, i);
131
                }
132
                g.setColor(outline);
133
                // TODO canviar esto per draw de AbstractLineSymbol
134
                g.drawRect(0, 0, width, height);
135

    
136
                for (int i = 0; layers != null && i < layers.length; i++) {
137
                        layers[i].drawInsideRectangle(g, scaleInstance, r);
138
                }
139
        }
140

    
141
        public String getClassName() {
142
                return getClass().getName();
143
        }
144

    
145
        public void setXMLEntity(XMLEntity xml) {
146
                // color
147
                color = StringUtilities.string2Color(xml.getStringProperty("color"));
148

    
149
                // outline
150
                outline = StringUtilities.string2Color(xml.getStringProperty("outline"));
151

    
152
                // description
153
                desc = xml.getStringProperty("desc");
154

    
155
                // is shape visible
156
                isShapeVisible = xml.getBooleanProperty("isShapeVisible");
157

    
158
                // layers
159
                layers = new ISymbol[xml.getChildrenCount()];
160
                for (int i = 0; i < layers.length; i++) {
161
                        layers[i] = SymbolFactory.createFromXML(xml.getChild(i), null);
162
                }
163
        }
164

    
165
}