Statistics
| Revision:

root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / core / symbols / AbstractLineSymbol.java @ 10809

History | View | Annotate | Download (4.03 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: AbstractLineSymbol.java 10809 2007-03-20 16:02:24Z jaume $
45
* $Log$
46
* Revision 1.4  2007-03-20 16:00:00  jaume
47
* rename method
48
*
49
* Revision 1.3  2007/03/09 11:20:56  jaume
50
* Advanced symbology (start committing)
51
*
52
* Revision 1.2.2.3  2007/02/21 16:09:02  jaume
53
* *** empty log message ***
54
*
55
* Revision 1.2.2.2  2007/02/15 16:23:44  jaume
56
* *** empty log message ***
57
*
58
* Revision 1.2.2.1  2007/02/09 07:47:04  jaume
59
* Isymbol moved
60
*
61
* Revision 1.2  2007/01/24 17:58:22  jaume
62
* new features and architecture error fixes
63
*
64
* Revision 1.1  2007/01/16 11:50:44  jaume
65
* *** empty log message ***
66
*
67
*
68
*/
69
package com.iver.cit.gvsig.fmap.core.symbols;
70

    
71
import java.awt.Color;
72

    
73
import com.iver.cit.gvsig.fmap.core.FShape;
74
import com.iver.cit.gvsig.fmap.core.IGeometry;
75
import com.iver.cit.gvsig.fmap.core.styles.ILineStyle;
76
import com.iver.cit.gvsig.fmap.core.styles.SimpleLineStyle;
77
import com.iver.cit.gvsig.fmap.core.v02.FConstant;
78

    
79
/**
80
 * @author   jaume dominguez faus - jaume.dominguez@iver.es
81
 */
82
public abstract class AbstractLineSymbol extends AbstractSymbol implements ILineSymbol {
83
        /**
84
         * @uml.property  name="color"
85
         */
86
        private Color color;
87
        private ILineStyle lineStyle;
88

    
89
        /* (non-Javadoc)
90
         * @see com.iver.cit.gvsig.fmap.core.symbols.ILineSymbol#getColor()
91
         */
92
        /**
93
         * @return
94
         * @uml.property  name="color"
95
         */
96
        public final Color getColor() {
97
                return color;
98
        }
99

    
100
        /* (non-Javadoc)
101
         * @see com.iver.cit.gvsig.fmap.core.symbols.ILineSymbol#setColor(java.awt.Color)
102
         */
103
        /**
104
         * @param color
105
         * @uml.property  name="color"
106
         */
107
        public final void setLineColor(Color color) {
108
                this.color = color;
109
        }
110

    
111

    
112
        /* (non-Javadoc)
113
         * @see com.iver.cit.gvsig.fmap.core.symbols.ILineSymbol#getSymbolType()
114
         */
115
        public final int getSymbolType() {
116
                return FConstant.SYMBOL_TYPE_LINE;
117
        }
118

    
119
        /* (non-Javadoc)
120
         * @see com.iver.cit.gvsig.fmap.core.symbols.ILineSymbol#isSuitableFor(com.iver.cit.gvsig.fmap.core.IGeometry)
121
         */
122
        public boolean isSuitableFor(IGeometry geom) {
123
                switch(geom.getGeometryType()) {
124
                // pasted from FSymbol
125
                case FShape.LINE:
126
                case FShape.LINE + FShape.Z:
127
                case FShape.ARC:
128
                case FShape.ARC + FShape.Z:
129
                        return true;
130
                }
131
                return false;
132
        }
133

    
134
        /* (non-Javadoc)
135
         * @see com.iver.cit.gvsig.fmap.core.symbols.ILineSymbol#getLineStyle()
136
         */
137
        /**
138
         * @return
139
         * @uml.property  name="lineStyle"
140
         */
141
        public ILineStyle getLineStyle() {
142
                if (lineStyle == null)
143
                        lineStyle = new SimpleLineStyle();
144
                return lineStyle;
145
        }
146

    
147
        /* (non-Javadoc)
148
         * @see com.iver.cit.gvsig.fmap.core.symbols.ILineSymbol#setLineStyle(com.iver.cit.gvsig.fmap.core.styles.SimpleLineStyle)
149
         */
150
        /**
151
         * @param lineStyle
152
         * @uml.property  name="lineStyle"
153
         */
154
        public void setLineStyle(ILineStyle lineStyle) {
155
                this.lineStyle = lineStyle;
156
        }
157
        
158
        public int getAlpha() {
159
                return color.getAlpha();
160
        }
161
        
162
        public void setAlpha(int outlineAlpha) {
163
                color = new Color(color.getRed(), color.getGreen(), color.getBlue(), outlineAlpha);
164
        }
165

    
166
}