Statistics
| Revision:

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

History | View | Annotate | Download (5.13 KB)

1
/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 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.symbols;
42

    
43
import java.awt.Color;
44
import java.awt.Graphics2D;
45
import java.awt.Rectangle;
46
import java.awt.Shape;
47
import java.awt.geom.AffineTransform;
48

    
49
import javax.print.attribute.PrintRequestAttributeSet;
50

    
51
import com.iver.cit.gvsig.fmap.core.FShape;
52
import com.iver.cit.gvsig.fmap.core.IGeometry;
53
import com.iver.cit.gvsig.fmap.core.IPrintable;
54
import com.iver.utiles.IPersistance;
55
import com.iver.utiles.XMLEntity;
56

    
57
/**
58
 * @author   jaume dominguez faus - jaume.dominguez@iver.es
59
 */
60
public interface ISymbol extends IPersistance, IPrintable{
61
        public static Color SELECTION_COLOR = Color.YELLOW;
62
        
63
        /**
64
         * Returns the derived version of the symbol that will be used to draw the
65
         * feature when it is selected.
66
         * @return <b>ISymbol</b> applied to a feature when it has been selected.
67
         */
68
        public ISymbol getSymbolForSelection();
69

    
70
        public void draw(Graphics2D g, AffineTransform affineTransform, FShape shp);
71

    
72
        // In the future, we may need something like that, but now if
73
        // I put it, we should change the rendering process, and it will
74
        // be slowly.
75
        // El problema es que antes de renderizar algo, tenemos que calcular
76
        // c�mo va a quedar en pantalla, para saber su bounding box real y si
77
        // hay que dibujarlo o no. Pasa con los textos, pero en general
78
        // con cualquier s�mbolo de tipo puntual, tambi�n. En menor medida con
79
        // l�neas y pol�gonos.
80
        //
81
        // IDEA!!!:
82
        // Para no depender de leer un shape y pedirle al s�mbolo que toca
83
        // el bounding box para ver si hay que dibujarlo, se puede hacer una
84
        // pasada previa por la leyenda y ver los pixels que a�ade al bounding
85
        // box. (Se coge un punto, una l�nea o un pol�gono, y se calcula
86
        // su bounding box para esa escala. Si es mayor que el original del
87
        // shape, se calculan los pixels. Luego se pasan esos pixels a
88
        // coordenadas de mundo real, y se le suman al visibleExtent para que
89
        // se dibujen los trozos de texto que no se pintan, etc, etc.
90
        public int getPixExtentPlus(Graphics2D g, AffineTransform affineTransform, Shape shp);
91
        /**
92
         * Devuelve el rgb del s�mbolo cuando se dibuja como un punto.
93
         *
94
         * @return rgb del s�mbolo.
95
         */
96
        public int getOnePointRgb();
97

    
98
        /**
99
         * Use it to specify how do you want to write the symbol in .gvp project
100
         * @return
101
         */
102
        public XMLEntity getXMLEntity();
103

    
104
        /**
105
         * Called by the factory, this method will set up the symbol and after call it, the
106
         * symbol must be fully functional and ready to be used.
107
         */
108
        public void setXMLEntity(XMLEntity xml);
109

    
110

    
111
        /**
112
         * The description is a human-readable text used to label it when show in a symbol menu or something like that.
113
         * @return   description of this symbol.
114
         * @uml.property  name="description"
115
         */
116
        public String getDescription();
117

    
118
        /**
119
         * Tells whether the shape of the symbol will be drawn or not.
120
         *
121
         * @return <b>true</b> if Shape must be drawn. Useful if you are labelling
122
         */
123
        public boolean isShapeVisible();
124

    
125
        /**
126
         * Sets the description of this symbol
127
         * @param   desc, a string with the description
128
         * @see   ISymbol.getDescription();
129
         * @uml.property  name="description"
130
         */
131
        public void setDescription(String desc);
132

    
133
        /**
134
         * The use of this method -and its mechanism- is being valorated. It probably
135
         * will be <b>deprecated</b>.
136
         * @return FSymbol constants. I think it is better to use isSuitableFor
137
         *
138
         */
139
        public int getSymbolType();
140

    
141
        /**
142
         * True if this symbol is ok for the geometry. For example, a FillSymbol will
143
         * be suitable for a Polygon.
144
         * @param geom
145
         * @return
146
         */
147
        public boolean isSuitableFor(IGeometry geom);
148

    
149
        /**
150
         * Useful to render the symbol inside the TOC, or inside little
151
         * rectangles. For example, think about rendering a Label with size
152
         * in meters => You will need to specify a size in pixels.
153
         * Of course, you can also to choose to render a prepared image, etc.
154
         * @param g2
155
         * @param scaleInstance
156
         * @param r
157
         */
158
        public void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r);
159

    
160
}
161

    
162