Statistics
| Revision:

svn-gvsig-desktop / tags / J2ME_compat_v1_2_Build_1209 / libraries / libFMap / src / com / iver / cit / gvsig / fmap / core / styles / IMask.java @ 19509

History | View | Annotate | Download (3.54 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
package com.iver.cit.gvsig.fmap.core.styles;
42

    
43
import java.awt.BasicStroke;
44
import java.awt.Graphics2D;
45
import java.awt.Rectangle;
46
import java.awt.Shape;
47

    
48
import com.iver.cit.gvsig.fmap.core.FPolygon2D;
49
import com.iver.cit.gvsig.fmap.core.FShape;
50
import com.iver.cit.gvsig.fmap.core.GeneralPathX;
51
import com.iver.cit.gvsig.fmap.core.symbols.IFillSymbol;
52
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
53
import com.iver.utiles.XMLEntity;
54

    
55
/**
56
 * Interface for the style of a mask.
57
 *
58
 * @author jaume dominguez faus - jaume.dominguez@iver.es
59
 */
60
public interface IMask extends IStyle {
61

    
62
        public double getSize();
63

    
64
        public void setSize(double size);
65

    
66
        public IFillSymbol getFillSymbol();
67

    
68
        public void setFillSymbol(IFillSymbol fill);
69

    
70
        public FShape getHaloShape(Shape shp);
71

    
72
        /**
73
         * Class that implements the methods of the IMask interface showed above.
74
         *
75
         * @author jaume dominguez faus - jaume.dominguez@iver.es
76
         *
77
         */
78
        class BasicMask extends AbstractStyle implements IMask {
79
                private double size;
80
                private IFillSymbol fill;
81

    
82

    
83
                public double getSize() {
84
                        return size;
85
                }
86

    
87
                public void setSize(double size) {
88
                        this.size = size;
89
                }
90

    
91
                public IFillSymbol getFillSymbol() {
92
                        return fill;
93

    
94
                }
95

    
96
                public void setFillSymbol(IFillSymbol fill) {
97
                        this.fill = fill;
98
                }
99

    
100
                public void drawInsideRectangle(Graphics2D g, Rectangle r) {
101
                        // TODO Implement it
102
                        throw new Error("Not yet implemented!");
103

    
104
                }
105

    
106
                public FShape getHaloShape(Shape shp) {
107
                        BasicStroke stroke = new BasicStroke((int) /*falta CartographicSupport*/getSize());
108
                        Shape myShp = stroke.createStrokedShape(shp);
109
                        FShape haloShape = new FPolygon2D(new GeneralPathX(myShp.getBounds2D()));
110

    
111
                        return haloShape;
112
                }
113

    
114
                public boolean isSuitableFor(ISymbol symbol) {
115
                        // TODO Implement it
116
                        throw new Error("Not yet implemented!");
117

    
118
                }
119

    
120
                public void drawOutline(Graphics2D g, Rectangle r) {
121
                        // TODO Implement it
122
                        throw new Error("Not yet implemented!");
123

    
124
                }
125

    
126
                public String getClassName() {
127
                        return this.getClass().getName();
128
                }
129

    
130
                public XMLEntity getXMLEntity() {
131
                        // TODO Implement it
132
                        throw new Error("Not yet implemented!");
133

    
134
                }
135

    
136
                public void setXMLEntity(XMLEntity xml) {
137
                        // TODO Implement it
138
                        throw new Error("Not yet implemented!");
139

    
140
                }
141

    
142
        }
143
}