Revision 38005
tags/v2_0_0_Build_2045/libraries/libFMap_mapcontext/resources-test/log4j.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" ?> |
|
2 |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> |
|
3 |
|
|
4 |
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> |
|
5 |
|
|
6 |
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> |
|
7 |
<layout class="org.apache.log4j.PatternLayout"> |
|
8 |
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n %m%n" /> |
|
9 |
</layout> |
|
10 |
</appender> |
|
11 |
|
|
12 |
<category name="org.gvsig.tools"> |
|
13 |
<priority value="DEBUG" /> |
|
14 |
</category> |
|
15 |
<category name="org.gvsig.fmap.mapcontext"> |
|
16 |
<priority value="DEBUG" /> |
|
17 |
</category> |
|
18 |
|
|
19 |
<root> |
|
20 |
<priority value="INFO" /> |
|
21 |
<appender-ref ref="CONSOLE" /> |
|
22 |
</root> |
|
23 |
</log4j:configuration> |
tags/v2_0_0_Build_2045/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContextDrawer.java | ||
---|---|---|
1 |
package org.gvsig.fmap.mapcontext; |
|
2 |
|
|
3 |
import java.awt.Graphics2D; |
|
4 |
import java.awt.image.BufferedImage; |
|
5 |
|
|
6 |
import org.gvsig.compat.print.PrintAttributes; |
|
7 |
import org.gvsig.fmap.dal.exception.ReadException; |
|
8 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
|
9 |
import org.gvsig.tools.task.Cancellable; |
|
10 |
|
|
11 |
public interface MapContextDrawer { |
|
12 |
|
|
13 |
public void setMapContext(MapContext mapContext); |
|
14 |
public void setViewPort(ViewPort viewPort); |
|
15 |
public void draw(FLayers root, BufferedImage image, Graphics2D g, Cancellable cancel, |
|
16 |
double scale) throws ReadException; |
|
17 |
public void print(FLayers root, Graphics2D g, Cancellable cancel, |
|
18 |
double scale, PrintAttributes properties) throws ReadException; |
|
19 |
public void dispose(); |
|
20 |
} |
|
0 | 21 |
tags/v2_0_0_Build_2045/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/ExtentHistory.java | ||
---|---|---|
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 org.gvsig.fmap.mapcontext; |
|
42 |
|
|
43 |
import java.awt.geom.Rectangle2D; |
|
44 |
|
|
45 |
import org.gvsig.tools.ToolsLocator; |
|
46 |
import org.gvsig.tools.dynobject.DynStruct; |
|
47 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
48 |
import org.gvsig.tools.persistence.Persistent; |
|
49 |
import org.gvsig.tools.persistence.PersistentState; |
|
50 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
51 |
|
|
52 |
/** |
|
53 |
* <p><code>ExtentHistory</code> is designed for managing a history of extents.</p> |
|
54 |
* |
|
55 |
* <p>Note: An <i>extent</i> is a re.setMandatory(true)ctangular area, with information of its top-left 2D corner.</p> |
|
56 |
* |
|
57 |
* @author Vicente Caballero Navarro |
|
58 |
*/ |
|
59 |
public class ExtentHistory implements Persistent { |
|
60 |
|
|
61 |
/** |
|
62 |
* <p>Maximum number of extents that can store.</p> |
|
63 |
*/ |
|
64 |
private int NUMREC; |
|
65 |
|
|
66 |
/** |
|
67 |
* <p>Array with the extents.</p> |
|
68 |
* |
|
69 |
* @see #hasPrevious() |
|
70 |
* @see #put(Rectangle2D) |
|
71 |
* @see #get() |
|
72 |
* @see #removePrev() |
|
73 |
*/ |
|
74 |
private Rectangle2D[] extents; |
|
75 |
|
|
76 |
/** |
|
77 |
* <p>Number of extents stored.</p> |
|
78 |
* |
|
79 |
* @see #hasPrevious() |
|
80 |
* @see #put(Rectangle2D) |
|
81 |
* @see #get() |
|
82 |
* @see #removePrev() |
|
83 |
*/ |
|
84 |
private int num = 0; |
|
85 |
|
|
86 |
|
|
87 |
/** |
|
88 |
* <p>Creates a new instance of <code>ExtentsHistory</code> with an history of 10 extents.</p> |
|
89 |
*/ |
|
90 |
public ExtentHistory() { |
|
91 |
this(10); |
|
92 |
} |
|
93 |
|
|
94 |
|
|
95 |
/** |
|
96 |
* <p>Creates a new instance of <code>ExtentsHistory</code> with an history of <code>numEntries</code> extents.</p> |
|
97 |
* |
|
98 |
* @param numEntries the maximum number of extents that will store the instance |
|
99 |
*/ |
|
100 |
public ExtentHistory(int numEntries) { |
|
101 |
NUMREC = numEntries; |
|
102 |
extents = new Rectangle2D[NUMREC]; |
|
103 |
} |
|
104 |
|
|
105 |
/** |
|
106 |
* <p>Appends the specified extent to the end of this history.</p> |
|
107 |
* |
|
108 |
* @param ext the new extent |
|
109 |
* |
|
110 |
* @see #get() |
|
111 |
* @see #hasPrevious() |
|
112 |
*/ |
|
113 |
public void put(Rectangle2D ext) { |
|
114 |
if ((ext != null) && ((num < 1) || (ext != extents[num - 1]))) { |
|
115 |
if (num < (NUMREC)) { |
|
116 |
extents[num] = ext; |
|
117 |
num = num + 1; |
|
118 |
} else { |
|
119 |
for (int i = 0; i < (NUMREC - 1); i++) { |
|
120 |
extents[i] = extents[i + 1]; |
|
121 |
} |
|
122 |
|
|
123 |
extents[num - 1] = ext; |
|
124 |
} |
|
125 |
} |
|
126 |
} |
|
127 |
|
|
128 |
/** |
|
129 |
* <p>Returns <code>true</code> if there are extents registered.</p> |
|
130 |
* |
|
131 |
* @return <code>true</code> if there are extents registered; <code>false</code> otherwise |
|
132 |
* |
|
133 |
* @see #put(Rectangle2D) |
|
134 |
* @see #removePrev() |
|
135 |
* @see #get() |
|
136 |
*/ |
|
137 |
public boolean hasPrevious() { |
|
138 |
return num > 0; |
|
139 |
} |
|
140 |
|
|
141 |
/** |
|
142 |
* <p>Returns the last extent in the history.</p> |
|
143 |
* |
|
144 |
* @return the last extent in the history |
|
145 |
* |
|
146 |
* @see #put(Rectangle2D) |
|
147 |
* @see #getXMLEntity() |
|
148 |
*/ |
|
149 |
public Rectangle2D get() { |
|
150 |
if (num <= 0) { |
|
151 |
return null; |
|
152 |
} |
|
153 |
Rectangle2D ext = extents[num - 1]; |
|
154 |
|
|
155 |
return ext; |
|
156 |
} |
|
157 |
|
|
158 |
/** |
|
159 |
* <p>Extracts (removing) the last extent from the history.</p> |
|
160 |
* |
|
161 |
* @return last extent in the history |
|
162 |
* |
|
163 |
* @see #hasPrevious() |
|
164 |
*/ |
|
165 |
public Rectangle2D removePrev() { |
|
166 |
if (num <= 0) { |
|
167 |
return null; |
|
168 |
} |
|
169 |
Rectangle2D ext = extents[--num]; |
|
170 |
return ext; |
|
171 |
} |
|
172 |
|
|
173 |
public void loadFromState(PersistentState state) |
|
174 |
throws PersistenceException { |
|
175 |
|
|
176 |
num = state.getInt("num"); |
|
177 |
NUMREC = state.getInt("numrec"); |
|
178 |
extents = (Rectangle2D[]) state.getArray("extents", Rectangle2D.class); |
|
179 |
} |
|
180 |
|
|
181 |
/** |
|
182 |
* <p> |
|
183 |
* Returns information of this object. All information is stored as |
|
184 |
* properties:<br> |
|
185 |
* </p> |
|
186 |
* <p> |
|
187 |
* <b>Properties:</b> |
|
188 |
* <ul> |
|
189 |
* <li><i>className</i>: name of this class. |
|
190 |
* <li><i>num</i>: number of extents registered. |
|
191 |
* <li><i>numrec</i>: maximum number of extents that can register. |
|
192 |
* <li><i>extents</i>: . |
|
193 |
* </ul> |
|
194 |
* </p> |
|
195 |
* |
|
196 |
*/ |
|
197 |
public void saveToState(PersistentState state) throws PersistenceException { |
|
198 |
|
|
199 |
state.set("num", num); |
|
200 |
state.set("numrec", NUMREC); |
|
201 |
state.set("extents", extents); |
|
202 |
} |
|
203 |
|
|
204 |
|
|
205 |
public static void registerPersistent() { |
|
206 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
207 |
DynStruct definition = manager.addDefinition( |
|
208 |
ExtentHistory.class, |
|
209 |
"ExtentHistory", |
|
210 |
"ExtentHistory Persistence definition", |
|
211 |
null, |
|
212 |
null |
|
213 |
); |
|
214 |
definition.addDynFieldInt("num").setMandatory(true); |
|
215 |
definition.addDynFieldInt("numrec").setMandatory(true); |
|
216 |
definition.addDynFieldArray("extents").setClassOfItems(Rectangle2D.class).setMandatory(true); |
|
217 |
} |
|
218 |
} |
tags/v2_0_0_Build_2045/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/CartographicSupport.java | ||
---|---|---|
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 org.gvsig.fmap.mapcontext.rendering.symbols; |
|
42 |
|
|
43 |
import org.gvsig.fmap.geom.Geometry; |
|
44 |
import org.gvsig.fmap.mapcontext.ViewPort; |
|
45 |
|
|
46 |
/** |
|
47 |
* <p>This interface enables Cartographic support for those graphical elements that require |
|
48 |
* additional runtime information rather than the feature itself geometric definitions.<br></p> |
|
49 |
* |
|
50 |
* <p>It allows to realworld's measure units dimensioning.<br></p> |
|
51 |
* |
|
52 |
* <p>It also supplies a toolkit to perform operations with centralized static methods. |
|
53 |
* @see CartographicSupportToolkit inner class' methods<br></p> |
|
54 |
* |
|
55 |
* @author jaume dominguez faus - jaume.dominguez@iver.es |
|
56 |
*/ |
|
57 |
public interface CartographicSupport { |
|
58 |
public static final int WORLD = 0; |
|
59 |
public static final int PAPER = 1; |
|
60 |
|
|
61 |
/** |
|
62 |
* Defines the unit used to express measures. It is the position of the unit in the <b>MapContext.NAMES</b> array. |
|
63 |
* @param unitIndex, the index of the unit in the MapContext.NAMES array |
|
64 |
*/ |
|
65 |
public abstract void setUnit(int unitIndex); |
|
66 |
/** |
|
67 |
* Returns the unit used to express measures. It is the position of the unit in the <b>MapContext.NAMES</b> array. |
|
68 |
* @returns an <b>int</b> with the index of the unit in the MapContext.NAMES array, or -1 if the size is specified in pixel |
|
69 |
*/ |
|
70 |
public abstract int getUnit(); |
|
71 |
|
|
72 |
/** |
|
73 |
* Returns the <b>Reference System</b> used to draw the elements of the image.<br> |
|
74 |
* <p> |
|
75 |
* The elements have to be scaled to <b>pixel</b> when the image is bein drawn in |
|
76 |
* order to compose the map. The elements of the map may define its size in |
|
77 |
* other units than pixel.<br> |
|
78 |
* </p> |
|
79 |
* <p><b>CartographicSupport</b> enables the elements to define the size in |
|
80 |
* measure units but these units may refer to different reference system. Two |
|
81 |
* kinds of Reference Systems are allowed in this context: <b>CartographicSupport.WORLD</b>, |
|
82 |
* and <b>CartographicSupport.PAPER</b>. |
|
83 |
* <br></p> |
|
84 |
* <p> |
|
85 |
* Depending on which <b>Reference System</b> is used the unit used by this element |
|
86 |
* refers to distances in the real world (then they are map's CRS-dependant) |
|
87 |
* or screen or printer output (then they are output DPI-dependant)<br> |
|
88 |
* </p> |
|
89 |
* <p> |
|
90 |
* In case the unit used is <b>pixel</b> then the reference system does not |
|
91 |
* have any effect since the source unit is the same than the target unit. |
|
92 |
* <br> |
|
93 |
* </p> |
|
94 |
* @return |
|
95 |
*/ |
|
96 |
public abstract int getReferenceSystem(); |
|
97 |
|
|
98 |
/** |
|
99 |
* Sets the <b>Reference System</b> that defines how this units have to be |
|
100 |
* handled. Possible values are: |
|
101 |
* <ol> |
|
102 |
* <li><b>CartographySupport.WORLD</b>: Defines that the unit values refer |
|
103 |
* to distances in the world. So, the size of the element displayed <b>depends |
|
104 |
* directly on the scale and CRS</b> used by the map. The size of the elements |
|
105 |
* defined to use CartographicSupport.WORLD will match exactly to their |
|
106 |
* actual size in the real world.</li> |
|
107 |
* <li><b>CartographySupport.PAPER</b>: Defines that the unit values refer |
|
108 |
* to the length that the element will have regardless where it appears. If |
|
109 |
* ReferenceSystem is <b>CartographySupport.PAPER</b>, and the length is (e.g.) |
|
110 |
* millimeters the element will be displayed with the <b>same</b> amount of |
|
111 |
* millimeters of length whether in the <b>screen</b> or the <b>printer</b> |
|
112 |
* (screen DPI and printer DPI must be correctly configured).</li> |
|
113 |
* </ol> |
|
114 |
*/ |
|
115 |
public abstract void setReferenceSystem(int referenceSystem); |
|
116 |
|
|
117 |
/** |
|
118 |
* Computes and sets the size (in pixels) of the cartographic element according |
|
119 |
* to the current rendering context (output dpi, map scale, map units) and the |
|
120 |
* symbol cartgraphic settings (unit, size, and unit reference system). |
|
121 |
* |
|
122 |
* @param viewPort, the ViewPort containing the symbol. |
|
123 |
* @param dpi, current output dpi (screen or printer) |
|
124 |
* @param shp, used only for MultiShapeSymbols in order to discriminate the internal symbol to be applied |
|
125 |
* @return a double containing the previous defined size |
|
126 |
*/ |
|
127 |
public abstract double toCartographicSize(ViewPort viewPort, double dpi, Geometry geom); |
|
128 |
|
|
129 |
/** |
|
130 |
* Sets the size of the cartographic element in pixels. |
|
131 |
* |
|
132 |
* @param cartographicSize, the size in pixels of the element |
|
133 |
* @param shp, used only for MultiShapeSymbols in order to discriminate the internal symbol to be applied |
|
134 |
*/ |
|
135 |
public abstract void setCartographicSize(double cartographicSize, Geometry geom); |
|
136 |
|
|
137 |
/** |
|
138 |
* Gets the size (in pixels) of the cartographic element according |
|
139 |
* to the current rendering context (output dpi, map scale, map units) and the |
|
140 |
* symbol cartgraphic settings (unit, size, and unit reference system). |
|
141 |
* @param viewPort |
|
142 |
* @param dpi |
|
143 |
* @param shp |
|
144 |
* @return double containing the size in [screen/printer] pixels for the current symbol |
|
145 |
*/ |
|
146 |
public abstract double getCartographicSize(ViewPort viewPort, double dpi, Geometry geom); |
|
147 |
|
|
148 |
|
|
149 |
} |
tags/v2_0_0_Build_2045/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/ITextSymbol.java | ||
---|---|---|
1 |
package org.gvsig.fmap.mapcontext.rendering.symbols; |
|
2 |
|
|
3 |
import java.awt.Color; |
|
4 |
import java.awt.Font; |
|
5 |
import java.awt.Rectangle; |
|
6 |
|
|
7 |
import org.gvsig.fmap.geom.Geometry; |
|
8 |
import org.gvsig.fmap.geom.primitive.Point; |
|
9 |
|
|
10 |
|
|
11 |
/** |
|
12 |
* |
|
13 |
* ITextSymbol.java<br> |
|
14 |
* Represents an ISymbol that draws a text. |
|
15 |
* |
|
16 |
* @author jaume dominguez faus - jaume.dominguez@iver.es Dec 11, 2007 |
|
17 |
* |
|
18 |
*/ |
|
19 |
public interface ITextSymbol extends ISymbol { |
|
20 |
|
|
21 |
public static final String SYMBOL_NAME = "text"; |
|
22 |
|
|
23 |
public final static int SYMBOL_STYLE_ALIGNMENT_LEFT = 94; |
|
24 |
public final static int SYMBOL_STYLE_ALIGNMENT_RIGHT = 95; |
|
25 |
public final static int SYMBOL_STYLE_ALIGNMENT_CENTERED = 96; |
|
26 |
public final static int SYMBOL_STYLE_ALIGNMENT_JUSTIFY = 97; |
|
27 |
/** |
|
28 |
* Establishes the font that will be used to render this ITextSymbol. |
|
29 |
* @param font |
|
30 |
*/ |
|
31 |
public abstract void setFont(Font font); |
|
32 |
|
|
33 |
/** |
|
34 |
* Returns the currently set font. |
|
35 |
* @return Font |
|
36 |
*/ |
|
37 |
public abstract Font getFont(); |
|
38 |
|
|
39 |
/** |
|
40 |
* Returns the currently color set to be applied to the text |
|
41 |
* @return Color |
|
42 |
*/ |
|
43 |
public abstract Color getTextColor(); |
|
44 |
|
|
45 |
/** |
|
46 |
* Sets the color of the text |
|
47 |
* @param color |
|
48 |
*/ |
|
49 |
public abstract void setTextColor(Color color); |
|
50 |
|
|
51 |
/** |
|
52 |
* Returns the text contained by this symbol |
|
53 |
* @return |
|
54 |
* @deprecated ?do i need it? |
|
55 |
*/ |
|
56 |
public abstract String getText(); |
|
57 |
|
|
58 |
/** |
|
59 |
* Sets the text to be rendered by this symbol |
|
60 |
* @param text, a String |
|
61 |
*/ |
|
62 |
public abstract void setText(String text); |
|
63 |
|
|
64 |
/** |
|
65 |
* Sets the font size currently set to this symbol |
|
66 |
* @param d |
|
67 |
*/ |
|
68 |
public abstract void setFontSize(double d); |
|
69 |
|
|
70 |
/** |
|
71 |
* Computes a Geometry wrapping the text to be applied |
|
72 |
* @param p target location |
|
73 |
* @return |
|
74 |
*/ |
|
75 |
public abstract Geometry getTextWrappingShape(Point p); |
|
76 |
|
|
77 |
public abstract Rectangle getBounds(); |
|
78 |
|
|
79 |
public abstract void setAutoresizeEnabled(boolean autoresizeFlag); |
|
80 |
|
|
81 |
public abstract boolean isAutoresizeEnabled(); |
|
82 |
} |
tags/v2_0_0_Build_2045/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/styles/ILabelStyle.java | ||
---|---|---|
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: ILabelStyle.java 20989 2008-05-28 11:05:57Z jmvivo $ |
|
45 |
* $Log$ |
|
46 |
* Revision 1.10 2007-08-16 06:55:30 jvidal |
|
47 |
* javadoc updated |
|
48 |
* |
|
49 |
* Revision 1.9 2007/08/13 11:36:30 jvidal |
|
50 |
* javadoc |
|
51 |
* |
|
52 |
* Revision 1.8 2007/05/08 08:47:39 jaume |
|
53 |
* *** empty log message *** |
|
54 |
* |
|
55 |
* Revision 1.7 2007/04/05 16:07:14 jaume |
|
56 |
* Styled labeling stuff |
|
57 |
* |
|
58 |
* Revision 1.6 2007/04/04 15:42:03 jaume |
|
59 |
* *** empty log message *** |
|
60 |
* |
|
61 |
* Revision 1.5 2007/04/04 15:41:05 jaume |
|
62 |
* *** empty log message *** |
|
63 |
* |
|
64 |
* Revision 1.4 2007/04/02 16:34:56 jaume |
|
65 |
* Styled labeling (start commiting) |
|
66 |
* |
|
67 |
* Revision 1.3 2007/03/29 16:02:01 jaume |
|
68 |
* *** empty log message *** |
|
69 |
* |
|
70 |
* Revision 1.2 2007/03/09 11:20:56 jaume |
|
71 |
* Advanced symbology (start committing) |
|
72 |
* |
|
73 |
* Revision 1.1.2.1 2007/02/15 16:23:44 jaume |
|
74 |
* *** empty log message *** |
|
75 |
* |
|
76 |
* Revision 1.1.2.1 2007/02/09 07:47:05 jaume |
|
77 |
* Isymbol moved |
|
78 |
* |
|
79 |
* |
|
80 |
*/ |
|
81 |
package org.gvsig.fmap.mapcontext.rendering.symbols.styles; |
|
82 |
|
|
83 |
import java.awt.Dimension; |
|
84 |
import java.awt.geom.Point2D; |
|
85 |
import java.awt.geom.Rectangle2D; |
|
86 |
|
|
87 |
|
|
88 |
/** |
|
89 |
* Defines the style that a Label symbol can contain which typically define |
|
90 |
* a background of the label as an Image, the texts that the label holds |
|
91 |
* and their position within the label in rendering time. |
|
92 |
* |
|
93 |
* @author jaume dominguez faus - jaume.dominguez@iver.es |
|
94 |
* |
|
95 |
*/ |
|
96 |
public interface ILabelStyle extends IStyle { |
|
97 |
/** |
|
98 |
* @return int, the amount of fields this style allows |
|
99 |
*/ |
|
100 |
public int getFieldCount(); |
|
101 |
|
|
102 |
/** |
|
103 |
* Sets the texts that will appear in the label. |
|
104 |
* @param texts |
|
105 |
*/ |
|
106 |
public void setTextFields(String[] texts); |
|
107 |
|
|
108 |
|
|
109 |
/** |
|
110 |
* Returns an array of rectangles defining the text boxes where text is |
|
111 |
* placed. |
|
112 |
* @return |
|
113 |
*/ |
|
114 |
public Rectangle2D[] getTextBounds(); |
|
115 |
|
|
116 |
public Dimension getSize(); |
|
117 |
|
|
118 |
/** |
|
119 |
* Returns the position of the point labeled by this label in percent units relative |
|
120 |
* to the label bounds. It determines the offset to be applied to the label to be |
|
121 |
* placed and allows the user to use custom styles. |
|
122 |
*/ |
|
123 |
public Point2D getMarkerPoint(); |
|
124 |
|
|
125 |
/** |
|
126 |
* Sets the position of the point labeled by this in percent units relative to the |
|
127 |
* label bounds |
|
128 |
* @param p |
|
129 |
* @throws IllegalArgumentException if the point coordinates are >0.0 or <1.0 |
|
130 |
*/ |
|
131 |
public void setMarkerPoint(Point2D p) throws IllegalArgumentException; |
|
132 |
|
|
133 |
/** |
|
134 |
* Sets a TextFieldArea using its index. With this method the user can |
|
135 |
* modify the size of the rectangle for the TextFieldArea |
|
136 |
* @param index |
|
137 |
* @param rect |
|
138 |
*/ |
|
139 |
public void setTextFieldArea(int index, Rectangle2D rect); |
|
140 |
|
|
141 |
/** |
|
142 |
* Adds a new TextFieldArea with an specific size which is defined as a rectangle. |
|
143 |
* @param index,int |
|
144 |
* @param rect,Rectangle2D |
|
145 |
*/ |
|
146 |
public void addTextFieldArea(Rectangle2D rect); |
|
147 |
|
|
148 |
/** |
|
149 |
* Delete the TextFieldArea specified by its index. |
|
150 |
* @param index,int |
|
151 |
*/ |
|
152 |
public void deleteTextFieldArea(int index); |
|
153 |
|
|
154 |
/** |
|
155 |
* Sets the size for a laber and stablishes an unit scale factor to not change |
|
156 |
* too much its content |
|
157 |
* @param width |
|
158 |
* @param height |
|
159 |
*/ |
|
160 |
public void setSize(double width, double height); |
|
161 |
|
|
162 |
} |
tags/v2_0_0_Build_2045/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/styles/IStyle.java | ||
---|---|---|
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: IStyle.java 20989 2008-05-28 11:05:57Z jmvivo $ |
|
45 |
* $Log$ |
|
46 |
* Revision 1.7 2007-09-20 09:33:15 jaume |
|
47 |
* Refactored: fixed name of IPersistAnce to IPersistence |
|
48 |
* |
|
49 |
* Revision 1.6 2007/09/19 16:19:27 jaume |
|
50 |
* removed unnecessary imports |
|
51 |
* |
|
52 |
* Revision 1.5 2007/08/22 09:49:00 jvidal |
|
53 |
* javadoc updated |
|
54 |
* |
|
55 |
* Revision 1.4 2007/08/16 06:55:30 jvidal |
|
56 |
* javadoc updated |
|
57 |
* |
|
58 |
* Revision 1.3 2007/08/13 11:36:41 jvidal |
|
59 |
* javadoc |
|
60 |
* |
|
61 |
* Revision 1.2 2007/04/04 15:41:05 jaume |
|
62 |
* *** empty log message *** |
|
63 |
* |
|
64 |
* Revision 1.1 2007/03/09 11:20:56 jaume |
|
65 |
* Advanced symbology (start committing) |
|
66 |
* |
|
67 |
* Revision 1.1.2.2 2007/02/15 16:23:44 jaume |
|
68 |
* *** empty log message *** |
|
69 |
* |
|
70 |
* Revision 1.1.2.1 2007/02/09 07:47:05 jaume |
|
71 |
* Isymbol moved |
|
72 |
* |
|
73 |
* |
|
74 |
*/ |
|
75 |
package org.gvsig.fmap.mapcontext.rendering.symbols.styles; |
|
76 |
|
|
77 |
import java.awt.Graphics2D; |
|
78 |
import java.awt.Rectangle; |
|
79 |
|
|
80 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
81 |
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolDrawingException; |
|
82 |
import org.gvsig.tools.lang.Cloneable; |
|
83 |
import org.gvsig.tools.persistence.Persistent; |
|
84 |
|
|
85 |
/** |
|
86 |
* Used by Objects that have to define an style for them.This interface has |
|
87 |
* methods to stablish a description and get it,to specify if an object |
|
88 |
* that implements this interface is suitable for a kind of symbol and other |
|
89 |
* methods to draw symbols. |
|
90 |
* @author jaume dominguez faus - jaume.dominguez@iver.es |
|
91 |
*/ |
|
92 |
public interface IStyle extends Persistent, Cloneable { |
|
93 |
/** |
|
94 |
* Defines the description of a symbol.It will be specified with an |
|
95 |
* string. |
|
96 |
* @param desc,String |
|
97 |
*/ |
|
98 |
public abstract void setDescription(String desc); |
|
99 |
/** |
|
100 |
* Returns the description of a symbol |
|
101 |
* @return Description of a symbol |
|
102 |
*/ |
|
103 |
public abstract String getDescription(); |
|
104 |
/** |
|
105 |
* Useful to render the symbol inside the TOC, or inside little |
|
106 |
* rectangles. For example, think about rendering a Label with size |
|
107 |
* in meters => You will need to specify a size in pixels. |
|
108 |
* Of course. You may also preffer to render a prepared image, etc. |
|
109 |
* @param g Graphics2D |
|
110 |
* @param r Rectangle |
|
111 |
*/ |
|
112 |
public abstract void drawInsideRectangle(Graphics2D g, Rectangle r) throws SymbolDrawingException; |
|
113 |
|
|
114 |
/** |
|
115 |
* True if this symbol is ok for the style or class. |
|
116 |
* @param symbol ISymbol |
|
117 |
*/ |
|
118 |
|
|
119 |
public abstract boolean isSuitableFor(ISymbol symbol); |
|
120 |
|
|
121 |
/** |
|
122 |
* Used to show an outline of the style to graphically show its properties. |
|
123 |
* @param g, the Graphics2D where to draw |
|
124 |
* @param r, the bounds of the style inside such Graphics2D |
|
125 |
*/ |
|
126 |
public abstract void drawOutline(Graphics2D g, Rectangle r) throws SymbolDrawingException; |
|
127 |
} |
tags/v2_0_0_Build_2045/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/IWarningSymbol.java | ||
---|---|---|
1 |
package org.gvsig.fmap.mapcontext.rendering.symbols; |
|
2 |
|
|
3 |
public interface IWarningSymbol extends ISymbol { |
|
4 |
|
|
5 |
public static final String SYMBOL_NAME = "warning"; |
|
6 |
|
|
7 |
void setDrawExceptionType(int symbolDrawExceptionType); |
|
8 |
|
|
9 |
void setMessage(String message); |
|
10 |
|
|
11 |
void setDescription(String description); |
|
12 |
|
|
13 |
} |
tags/v2_0_0_Build_2045/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolException.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2009 {gvSIG} {{Task}} |
|
26 |
*/ |
|
27 |
package org.gvsig.fmap.mapcontext.rendering.symbols; |
|
28 |
|
|
29 |
import org.gvsig.fmap.mapcontext.MapContextException; |
|
30 |
import org.gvsig.tools.exception.BaseException; |
|
31 |
|
|
32 |
/** |
|
33 |
* Parent exception of symbol related exceptions. |
|
34 |
* @author <a href="mailto:cordinyana@gvsig.org">C?sar Ordi?ana</a> |
|
35 |
*/ |
|
36 |
public abstract class SymbolException extends MapContextException { |
|
37 |
|
|
38 |
private static final long serialVersionUID = -5432842435290441524L; |
|
39 |
|
|
40 |
/** |
|
41 |
* @see BaseException#BaseException(String, String, long) |
|
42 |
*/ |
|
43 |
public SymbolException(String message, String key, long code) { |
|
44 |
super(message, key, code); |
|
45 |
} |
|
46 |
|
|
47 |
/** |
|
48 |
* @see BaseException#BaseException(String, Throwable, String, long) |
|
49 |
*/ |
|
50 |
public SymbolException(String message, Throwable cause, String key, |
|
51 |
long code) { |
|
52 |
super(message, cause, key, code); |
|
53 |
} |
|
54 |
} |
tags/v2_0_0_Build_2045/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/IMultiLayerSymbol.java | ||
---|---|---|
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: IMultiLayerSymbol.java 20989 2008-05-28 11:05:57Z jmvivo $ |
|
45 |
* $Log$ |
|
46 |
* Revision 1.5 2007-08-16 06:55:19 jvidal |
|
47 |
* javadoc updated |
|
48 |
* |
|
49 |
* Revision 1.4 2007/08/09 08:04:36 jvidal |
|
50 |
* javadoc |
|
51 |
* |
|
52 |
* Revision 1.3 2007/08/09 07:57:42 jvidal |
|
53 |
* javadoc |
|
54 |
* |
|
55 |
* Revision 1.2 2007/03/09 11:20:56 jaume |
|
56 |
* Advanced symbology (start committing) |
|
57 |
* |
|
58 |
* Revision 1.1.2.1 2007/02/16 10:54:12 jaume |
|
59 |
* multilayer splitted to multilayerline, multilayermarker,and multilayerfill |
|
60 |
* |
|
61 |
* |
|
62 |
*/ |
|
63 |
package org.gvsig.fmap.mapcontext.rendering.symbols; |
|
64 |
|
|
65 |
|
|
66 |
/** |
|
67 |
* Allows to create multi layer symbols using the composition of |
|
68 |
* several symbols of the same type.Depending on the type of the symbols that are |
|
69 |
* used to compose the final symbol, the user will have MultiLayerMarkerSymbol, |
|
70 |
* MultiLayerLineSymbol,... |
|
71 |
* |
|
72 |
*/ |
|
73 |
|
|
74 |
public interface IMultiLayerSymbol extends ISymbol { |
|
75 |
|
|
76 |
/** |
|
77 |
* Establishes a concret symbol for a layer |
|
78 |
* |
|
79 |
* @param index, index of the layer |
|
80 |
* @param layer, symbol to be "applied" to the layer |
|
81 |
* @throws IndexOutOfBoundsException |
|
82 |
*/ |
|
83 |
public abstract void setLayer(int index, ISymbol layer) |
|
84 |
throws IndexOutOfBoundsException; |
|
85 |
/** |
|
86 |
* Changes the position of two layers in a multilayersymbol |
|
87 |
* @param index1, index of the layer |
|
88 |
* @param index2, index of the layer |
|
89 |
*/ |
|
90 |
public abstract void swapLayers(int index1, int index2); |
|
91 |
/** |
|
92 |
* Obtains the symbol that "contains" a layer whose index is the argument of the method. |
|
93 |
* @param layerIndex |
|
94 |
* @return |
|
95 |
*/ |
|
96 |
public abstract ISymbol getLayer(int layerIndex); |
|
97 |
/** |
|
98 |
* Returns the number of layers |
|
99 |
* @return int |
|
100 |
*/ |
|
101 |
public abstract int getLayerCount(); |
|
102 |
|
|
103 |
/** |
|
104 |
* Stacks a new symbol to the symbol list. The symbol is appended to the |
|
105 |
* list and, in terms of use, it will be the last symbol to be processed. |
|
106 |
* @param ISymbol newLayer |
|
107 |
*/ |
|
108 |
public abstract void addLayer(ISymbol newLayer); |
|
109 |
/** |
|
110 |
* Stacks a new symbol to the symbol list. The symbol is appended to the |
|
111 |
* list in the specified position. |
|
112 |
* @param ISymbol newLayer |
|
113 |
*/ |
|
114 |
public abstract void addLayer(ISymbol newLayer, int layerIndex) |
|
115 |
throws IndexOutOfBoundsException; |
|
116 |
|
|
117 |
/** |
|
118 |
* TODO maybe push it up to ISymbol |
|
119 |
* @param layer |
|
120 |
* @return true if this symbol contains the removed one |
|
121 |
*/ |
|
122 |
public abstract boolean removeLayer(ISymbol layer); |
|
123 |
|
|
124 |
} |
tags/v2_0_0_Build_2045/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolPreferences.java | ||
---|---|---|
1 |
|
|
2 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
5 |
* of the Valencian Government (CIT) |
|
6 |
* |
|
7 |
* This program is free software; you can redistribute it and/or |
|
8 |
* modify it under the terms of the GNU General Public License |
|
9 |
* as published by the Free Software Foundation; either version 2 |
|
10 |
* of the License, or (at your option) any later version. |
|
11 |
* |
|
12 |
* This program is distributed in the hope that it will be useful, |
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
* GNU General Public License for more details. |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License |
|
18 |
* along with this program; if not, write to the Free Software |
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
* MA 02110-1301, USA. |
|
21 |
* |
|
22 |
*/ |
|
23 |
|
|
24 |
/* |
|
25 |
* AUTHORS (In addition to CIT): |
|
26 |
* 2009 {} {{Task}} |
|
27 |
*/ |
|
28 |
package org.gvsig.fmap.mapcontext.rendering.symbols; |
|
29 |
|
|
30 |
import java.awt.Color; |
|
31 |
import java.awt.Font; |
|
32 |
|
|
33 |
/** |
|
34 |
* Preferences for symbol configuration and default values. |
|
35 |
* |
|
36 |
* @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team |
|
37 |
*/ |
|
38 |
public interface SymbolPreferences { |
|
39 |
|
|
40 |
/** |
|
41 |
* Returns the file extension to use for persisted symbols. |
|
42 |
* |
|
43 |
* @return the symbol file extension |
|
44 |
*/ |
|
45 |
String getSymbolFileExtension(); |
|
46 |
|
|
47 |
/** |
|
48 |
* Sets the file extension to use for persisted symbols. |
|
49 |
* |
|
50 |
* @param extension |
|
51 |
* the file extension to use for persisted symbols |
|
52 |
*/ |
|
53 |
void setSymbolFileExtension(String extension); |
|
54 |
|
|
55 |
/** |
|
56 |
* Returns the default color to use for symbols. |
|
57 |
* |
|
58 |
* @return the symbol default color |
|
59 |
*/ |
|
60 |
Color getDefaultSymbolColor(); |
|
61 |
|
|
62 |
/** |
|
63 |
* Sets the default color to use for symbols. |
|
64 |
* |
|
65 |
* @param defaultSymbolColor |
|
66 |
* the symbol default color |
|
67 |
*/ |
|
68 |
void setDefaultSymbolColor(Color defaultSymbolColor); |
|
69 |
|
|
70 |
/** |
|
71 |
* Sets the default color for symbols to the original value. |
|
72 |
*/ |
|
73 |
void resetDefaultSymbolColor(); |
|
74 |
|
|
75 |
/** |
|
76 |
* Returns the default fill color to use for symbols. |
|
77 |
* |
|
78 |
* @return the default fill color |
|
79 |
*/ |
|
80 |
Color getDefaultSymbolFillColor(); |
|
81 |
|
|
82 |
/** |
|
83 |
* Sets the default fill color to use for symbols. |
|
84 |
* |
|
85 |
* @param defaultSymbolFillColor |
|
86 |
* the default fill color |
|
87 |
*/ |
|
88 |
void setDefaultSymbolFillColor(Color defaultSymbolFillColor); |
|
89 |
|
|
90 |
/** |
|
91 |
* Sets the default fill color for symbols to the original value. |
|
92 |
*/ |
|
93 |
void resetDefaultSymbolFillColor(); |
|
94 |
|
|
95 |
/** |
|
96 |
* Returns if the default symbol fill color has been generated in a aleatory |
|
97 |
* way. |
|
98 |
* |
|
99 |
* @return if the default symbol fill color is aleatory |
|
100 |
*/ |
|
101 |
boolean isDefaultSymbolFillColorAleatory(); |
|
102 |
|
|
103 |
/** |
|
104 |
* Sets if the default symbol fill color has been generated in a aleatory |
|
105 |
* way. |
|
106 |
* |
|
107 |
* @param defaultSymbolFillColorAleatory |
|
108 |
* if the default symbol fill color is aleatory |
|
109 |
*/ |
|
110 |
void setDefaultSymbolFillColorAleatory( |
|
111 |
boolean defaultSymbolFillColorAleatory); |
|
112 |
|
|
113 |
/** |
|
114 |
* Sets if the default symbol fill color is aleatory to the default value. |
|
115 |
*/ |
|
116 |
void resetDefaultSymbolFillColorAleatory(); |
|
117 |
|
|
118 |
/** |
|
119 |
* Returns the default font to use for symbols. |
|
120 |
* |
|
121 |
* @return the default symbol font |
|
122 |
*/ |
|
123 |
Font getDefaultSymbolFont(); |
|
124 |
|
|
125 |
/** |
|
126 |
* Sets the default font to use for symbols. |
|
127 |
* |
|
128 |
* @param defaultSymbolFont |
|
129 |
* the default symbol font |
|
130 |
*/ |
|
131 |
void setDefaultSymbolFont(Font defaultSymbolFont); |
|
132 |
|
|
133 |
/** |
|
134 |
* Sets the default font to use for symbols to the original value. |
|
135 |
*/ |
|
136 |
void resetDefaultSymbolFont(); |
|
137 |
|
|
138 |
/** |
|
139 |
* Returns the path to the symbol library, where the persisted symbols can |
|
140 |
* be found. |
|
141 |
* |
|
142 |
* @return the path to the symbol library |
|
143 |
*/ |
|
144 |
String getSymbolLibraryPath(); |
|
145 |
|
|
146 |
/** |
|
147 |
* Sets the path to the symbol library, where the persisted symbols can be |
|
148 |
* found. |
|
149 |
* |
|
150 |
* @param symbolLibraryPath |
|
151 |
* the path to the symbol library |
|
152 |
*/ |
|
153 |
void setSymbolLibraryPath(String symbolLibraryPath); |
|
154 |
|
|
155 |
/** |
|
156 |
* Sets the path to the symbol library to the original value. |
|
157 |
*/ |
|
158 |
void resetSymbolLibraryPath(); |
|
159 |
|
|
160 |
/** |
|
161 |
* Returns the unit that will be used when creating new symbols with |
|
162 |
* Cartographic support. |
|
163 |
* |
|
164 |
* @return the default cartographic support measure unit |
|
165 |
* @see CartographicSupport#getUnit() |
|
166 |
*/ |
|
167 |
int getDefaultCartographicSupportMeasureUnit(); |
|
168 |
|
|
169 |
/** |
|
170 |
* Sets the unit that will be used when creating new symbols with |
|
171 |
* Cartographic support. |
|
172 |
* |
|
173 |
* @param defaultCartographicSupportMeasureUnit |
|
174 |
* the default cartographic support measure unit |
|
175 |
* @see CartographicSupport#setUnit() |
|
176 |
*/ |
|
177 |
void setDefaultCartographicSupportMeasureUnit( |
|
178 |
int defaultCartographicSupportMeasureUnit); |
|
179 |
|
|
180 |
/** |
|
181 |
* Returns the reference system that will be used when creating new symbols |
|
182 |
* with Cartographic support. |
|
183 |
* |
|
184 |
* @return the cartographic reference system |
|
185 |
* @see CartographicSupport#PAPER |
|
186 |
* @see CartographicSupport#WORLD |
|
187 |
*/ |
|
188 |
int getDefaultCartographicSupportReferenceSystem(); |
|
189 |
|
|
190 |
/** |
|
191 |
* Sets the reference system that will be used when creating new symbols |
|
192 |
* with Cartographic support. |
|
193 |
* |
|
194 |
* @param defaultCartographicSupportReferenceSystem |
|
195 |
* the cartographic reference system |
|
196 |
* @see CartographicSupport#PAPER |
|
197 |
* @see CartographicSupport#WORLD |
|
198 |
*/ |
|
199 |
void setDefaultCartographicSupportReferenceSystem( |
|
200 |
int defaultCartographicSupportReferenceSystem); |
|
201 |
} |
tags/v2_0_0_Build_2045/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/IPrintable.java | ||
---|---|---|
1 |
package org.gvsig.fmap.mapcontext.rendering.symbols; |
|
2 |
|
|
3 |
import java.awt.Graphics2D; |
|
4 |
import java.awt.geom.AffineTransform; |
|
5 |
|
|
6 |
import org.gvsig.compat.print.PrintAttributes; |
|
7 |
import org.gvsig.fmap.geom.Geometry; |
|
8 |
|
|
9 |
public interface IPrintable { |
|
10 |
public void print(Graphics2D g, |
|
11 |
AffineTransform at, |
|
12 |
Geometry shape, |
|
13 |
PrintAttributes properties); |
|
14 |
} |
tags/v2_0_0_Build_2045/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/ISymbol.java | ||
---|---|---|
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 org.gvsig.fmap.mapcontext.rendering.symbols; |
|
42 |
|
|
43 |
import java.awt.Color; |
|
44 |
import java.awt.Graphics2D; |
|
45 |
import java.awt.Rectangle; |
|
46 |
import java.awt.geom.AffineTransform; |
|
47 |
|
|
48 |
import org.gvsig.compat.print.PrintAttributes; |
|
49 |
import org.gvsig.fmap.dal.feature.Feature; |
|
50 |
import org.gvsig.fmap.geom.Geometry; |
|
51 |
import org.gvsig.fmap.mapcontext.ViewPort; |
|
52 |
import org.gvsig.tools.persistence.Persistent; |
|
53 |
import org.gvsig.tools.task.Cancellable; |
|
54 |
import org.gvsig.tools.lang.Cloneable; |
|
55 |
|
|
56 |
|
|
57 |
/** |
|
58 |
* |
|
59 |
* Interface for symbols.It is the most general one which is implemented by other |
|
60 |
* specific symbols.For this reason this interface has a method to obtain the derived |
|
61 |
* version of a common symbol(apart from others). The main purpose is to offer a set of |
|
62 |
* symbols that will be part of the FMap kernel and allow the developer to add new symbols |
|
63 |
* without changes in the initial implementation. |
|
64 |
* |
|
65 |
* |
|
66 |
* @author jaume dominguez faus - jaume.dominguez@iver.es |
|
67 |
*/ |
|
68 |
public interface ISymbol extends Persistent, IPrintable, Cloneable { |
|
69 |
|
|
70 |
public static Color SELECTION_COLOR = Color.YELLOW; |
|
71 |
|
|
72 |
/** |
|
73 |
* Returns the derived version of the symbol that will be used to draw the |
|
74 |
* feature when it is selected. |
|
75 |
* @return <b>ISymbol</b> applied to a feature when it has been selected. |
|
76 |
*/ |
|
77 |
public ISymbol getSymbolForSelection(); |
|
78 |
|
|
79 |
/** |
|
80 |
* Used when a symbol is going to be drawn.The method to do |
|
81 |
* it will depend on the derived version of the symbol. |
|
82 |
* @param g |
|
83 |
* @param affineTransform |
|
84 |
* @param shp |
|
85 |
* @param cancel TODO |
|
86 |
*/ |
|
87 |
public void draw(Graphics2D g, AffineTransform affineTransform, Geometry geom, Feature f, Cancellable cancel); |
|
88 |
|
|
89 |
/** |
|
90 |
* <p> |
|
91 |
* Returns <b>the distance between the shape's bounding box and the |
|
92 |
* symbol-that-represents-this-shape's bounding box</b> in a two-length-float |
|
93 |
* array passed as parameter.<br> |
|
94 |
* </p> |
|
95 |
* <p> |
|
96 |
* After this method returns, the float array passed will contain two values |
|
97 |
* representing <b>the amount of pixels</b> separating each of the X (first element) |
|
98 |
* and Y (second element) axes.<br> |
|
99 |
* </p> |
|
100 |
* <p> |
|
101 |
* This distance maybe dependent on: |
|
102 |
* <ol> |
|
103 |
* <li> |
|
104 |
* <b>The ViewPort</b>: if the symbol is an instance of CartographicSupport |
|
105 |
* the units it uses are not pixels and the reference system is |
|
106 |
* CarthographicSupport.WORLD. |
|
107 |
* </li> |
|
108 |
* <li> |
|
109 |
* <b>The target rendering context's dpi (dots-per-inch)</b>: if the symbol |
|
110 |
* is an instance of CartographicSupport the units it uses are not pixels and |
|
111 |
* CarthographicSupport.PAPER. |
|
112 |
* </li> |
|
113 |
* </ol> |
|
114 |
* <br> |
|
115 |
* </p> |
|
116 |
* <p> |
|
117 |
* And in any other case, if the unit of the symbol is pixels or the symbol is not |
|
118 |
* even an instance of CartographicSupport, the returning values are only |
|
119 |
* defined by the symbol and are not calculated. |
|
120 |
* </p> |
|
121 |
* @param ViewPort viewPort |
|
122 |
* @param Shape shp |
|
123 |
* @param int dpi |
|
124 |
* @param float[] distances, the array of floats where to store the distances in x and y axis |
|
125 |
*/ |
|
126 |
public void getPixExtentPlus(Geometry geom, float[] distances, ViewPort viewPort, int dpi); |
|
127 |
|
|
128 |
|
|
129 |
/** |
|
130 |
* Informs that the geometry will be represented with that symbol in just one pixel or dot |
|
131 |
* |
|
132 |
* |
|
133 |
* |
|
134 |
* @param geom |
|
135 |
* @param positionOfDotOrPixel (out) filled with pixel or dot location |
|
136 |
* @param viewPort |
|
137 |
* @param dpi |
|
138 |
* @return |
|
139 |
*/ |
|
140 |
public boolean isOneDotOrPixel(Geometry geom, double[] positionOfDotOrPixel, |
|
141 |
ViewPort viewPort, int dpi); |
|
142 |
|
|
143 |
/** |
|
144 |
* Returns the rgb of the symbol when it is drawn like a point. |
|
145 |
* |
|
146 |
* @return rgb of the symbol. |
|
147 |
*/ |
|
148 |
public int getOnePointRgb(); |
|
149 |
|
|
150 |
|
|
151 |
|
|
152 |
|
|
153 |
|
|
154 |
/** |
|
155 |
* The description is a human-readable text used to label it when show in a symbol menu or something like that. |
|
156 |
* @return description of this symbol. |
|
157 |
* @uml.property name="description" |
|
158 |
*/ |
|
159 |
public String getDescription(); |
|
160 |
|
|
161 |
/** |
|
162 |
* Tells whether the shape of the symbol will be drawn or not. |
|
163 |
* |
|
164 |
* @return <b>true</b> if Shape must be drawn. Useful if you are labelling |
|
165 |
*/ |
|
166 |
public boolean isShapeVisible(); |
|
167 |
|
|
168 |
/** |
|
169 |
* Sets the description of this symbol |
|
170 |
* @param desc, a string with the description |
|
171 |
* @see ISymbol.getDescription(); |
|
172 |
* @uml.property name="description" |
|
173 |
*/ |
|
174 |
public void setDescription(String desc); |
|
175 |
|
|
176 |
/** |
|
177 |
* The use of this method -and its mechanism- is being valorated. It probably |
|
178 |
* will be <b>deprecated</b>. |
|
179 |
* @return FSymbol constants. I think it is better to use isSuitableFor |
|
180 |
* |
|
181 |
*/ |
|
182 |
public int getSymbolType(); |
|
183 |
|
|
184 |
/** |
|
185 |
* True if this symbol is ok for the geometry. For example, a FillSymbol will |
|
186 |
* be suitable for a Polygon. |
|
187 |
* @param geom |
|
188 |
* @return |
|
189 |
*/ |
|
190 |
public boolean isSuitableFor(Geometry geom); |
|
191 |
|
|
192 |
/** |
|
193 |
* Useful to render the symbol inside the TOC, or inside little |
|
194 |
* rectangles. For example, think about rendering a Label with size |
|
195 |
* in meters => You will need to specify a size in pixels. |
|
196 |
* Of course, you can also to choose to render a prepared image, etc. |
|
197 |
* @param scaleInstance |
|
198 |
* @param r |
|
199 |
* @param properties TODO |
|
200 |
* @param g2 |
|
201 |
* @throws SymbolDrawingException TODO |
|
202 |
*/ |
|
203 |
public void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r, PrintAttributes properties) throws SymbolDrawingException; |
|
204 |
|
|
205 |
/** |
|
206 |
* Returns the {@link Color} to use to render the symbol. |
|
207 |
* @param |
|
208 |
* @return the {@link Color} to use to render the symbol |
|
209 |
*/ |
|
210 |
public Color getColor(); |
|
211 |
|
|
212 |
/** |
|
213 |
* Sets the {@link Color} to use to render the symbol. |
|
214 |
* @param color to render the symbol |
|
215 |
*/ |
|
216 |
public void setColor(Color color); |
|
217 |
} |
tags/v2_0_0_Build_2045/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/SymbolDrawingException.java | ||
---|---|---|
1 |
package org.gvsig.fmap.mapcontext.rendering.symbols; |
|
2 |
|
|
3 |
import org.gvsig.fmap.mapcontext.Messages; |
|
4 |
|
|
5 |
/** |
|
6 |
* Exception thrown when a symbol cannot be drawn. The type of the exception |
|
7 |
* will determine the cause. |
|
8 |
* <ol> |
|
9 |
* <li><b>Unsupported set of settings</b>: getType() == SymbolDrawingException.UNSUPPORTED_SET_OF_SETTINGS</li> |
|
10 |
* <li><b>Shape type mismatch</b>: getType() == SymbolDrawingException.SHAPETYPE_MISMATCH</li> |
|
11 |
* </ol> |
|
12 |
* |
|
13 |
* @author jaume dominguez faus - jaume.dominguez@iver.es |
Also available in: Unified diff