root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / core / CartographicSupport.java @ 38563
History | View | Annotate | Download (5.82 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; |
42 |
|
43 |
import com.iver.cit.gvsig.fmap.ViewPort; |
44 |
|
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, FShape shp); |
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, FShape shp); |
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, FShape shp); |
147 |
|
148 |
|
149 |
} |