svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_mapcontext / src / org / gvsig / fmap / mapcontext / rendering / symbols / CartographicSupport.java @ 28879
History | View | Annotate | Download (6.03 KB)
1 | 21200 | vcaballero | /* 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 | |||
48 | /**
|
||
49 | * <p>This interface enables Cartographic support for those graphical elements that require
|
||
50 | * additional runtime information rather than the feature itself geometric definitions.<br></p>
|
||
51 | *
|
||
52 | * <p>It allows to realworld's measure units dimensioning.<br></p>
|
||
53 | *
|
||
54 | * <p>It also supplies a toolkit to perform operations with centralized static methods.
|
||
55 | * @see CartographicSupportToolkit inner class' methods<br></p>
|
||
56 | *
|
||
57 | * @author jaume dominguez faus - jaume.dominguez@iver.es
|
||
58 | */
|
||
59 | public interface CartographicSupport { |
||
60 | public static final int WORLD = 0; |
||
61 | public static final int PAPER = 1; |
||
62 | |||
63 | /**
|
||
64 | * Defines the unit used to express measures. It is the position of the unit in the <b>MapContext.NAMES</b> array.
|
||
65 | * @param unitIndex, the index of the unit in the MapContext.NAMES array
|
||
66 | */
|
||
67 | public abstract void setUnit(int unitIndex); |
||
68 | /**
|
||
69 | * Returns the unit used to express measures. It is the position of the unit in the <b>MapContext.NAMES</b> array.
|
||
70 | * @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
|
||
71 | */
|
||
72 | public abstract int getUnit(); |
||
73 | |||
74 | /**
|
||
75 | * Returns the <b>Reference System</b> used to draw the elements of the image.<br>
|
||
76 | * <p>
|
||
77 | * The elements have to be scaled to <b>pixel</b> when the image is bein drawn in
|
||
78 | * order to compose the map. The elements of the map may define its size in
|
||
79 | * other units than pixel.<br>
|
||
80 | * </p>
|
||
81 | * <p><b>CartographicSupport</b> enables the elements to define the size in
|
||
82 | * measure units but these units may refer to different reference system. Two
|
||
83 | * kinds of Reference Systems are allowed in this context: <b>CartographicSupport.WORLD</b>,
|
||
84 | * and <b>CartographicSupport.PAPER</b>.
|
||
85 | * <br></p>
|
||
86 | * <p>
|
||
87 | * Depending on which <b>Reference System</b> is used the unit used by this element
|
||
88 | * refers to distances in the real world (then they are map's CRS-dependant)
|
||
89 | * or screen or printer output (then they are output DPI-dependant)<br>
|
||
90 | * </p>
|
||
91 | * <p>
|
||
92 | * In case the unit used is <b>pixel</b> then the reference system does not
|
||
93 | * have any effect since the source unit is the same than the target unit.
|
||
94 | * <br>
|
||
95 | * </p>
|
||
96 | * @return
|
||
97 | */
|
||
98 | public abstract int getReferenceSystem(); |
||
99 | |||
100 | /**
|
||
101 | * Sets the <b>Reference System</b> that defines how this units have to be
|
||
102 | * handled. Possible values are:
|
||
103 | * <ol>
|
||
104 | * <li><b>CartographySupport.WORLD</b>: Defines that the unit values refer
|
||
105 | * to distances in the world. So, the size of the element displayed <b>depends
|
||
106 | * directly on the scale and CRS</b> used by the map. The size of the elements
|
||
107 | * defined to use CartographicSupport.WORLD will match exactly to their
|
||
108 | * actual size in the real world.</li>
|
||
109 | * <li><b>CartographySupport.PAPER</b>: Defines that the unit values refer
|
||
110 | * to the length that the element will have regardless where it appears. If
|
||
111 | * ReferenceSystem is <b>CartographySupport.PAPER</b>, and the length is (e.g.)
|
||
112 | * millimeters the element will be displayed with the <b>same</b> amount of
|
||
113 | * millimeters of length whether in the <b>screen</b> or the <b>printer</b>
|
||
114 | * (screen DPI and printer DPI must be correctly configured).</li>
|
||
115 | * </ol>
|
||
116 | */
|
||
117 | public abstract void setReferenceSystem(int referenceSystem); |
||
118 | |||
119 | /**
|
||
120 | * Computes and sets the size (in pixels) of the cartographic element according
|
||
121 | * to the current rendering context (output dpi, map scale, map units) and the
|
||
122 | * symbol cartgraphic settings (unit, size, and unit reference system).
|
||
123 | *
|
||
124 | * @param viewPort, the ViewPort containing the symbol.
|
||
125 | * @param dpi, current output dpi (screen or printer)
|
||
126 | * @param shp, used only for MultiShapeSymbols in order to discriminate the internal symbol to be applied
|
||
127 | * @return a double containing the previous defined size
|
||
128 | */
|
||
129 | public abstract double toCartographicSize(ViewPort viewPort, double dpi, Geometry geom); |
||
130 | |||
131 | /**
|
||
132 | * Sets the size of the cartographic element in pixels.
|
||
133 | *
|
||
134 | * @param cartographicSize, the size in pixels of the element
|
||
135 | * @param shp, used only for MultiShapeSymbols in order to discriminate the internal symbol to be applied
|
||
136 | */
|
||
137 | public abstract void setCartographicSize(double cartographicSize, Geometry geom); |
||
138 | |||
139 | /**
|
||
140 | * Gets the size (in pixels) of the cartographic element according
|
||
141 | * to the current rendering context (output dpi, map scale, map units) and the
|
||
142 | * symbol cartgraphic settings (unit, size, and unit reference system).
|
||
143 | * @param viewPort
|
||
144 | * @param dpi
|
||
145 | * @param shp
|
||
146 | * @return double containing the size in [screen/printer] pixels for the current symbol
|
||
147 | */
|
||
148 | public abstract double getCartographicSize(ViewPort viewPort, double dpi, Geometry geom); |
||
149 | |||
150 | |||
151 | } |