root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / core / symbols / AbstractMarkerSymbol.java @ 11140
History | View | Annotate | Download (4.66 KB)
1 | 9639 | jaume | /* 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$
|
||
45 | * $Log$
|
||
46 | 10902 | jaume | * Revision 1.6 2007-03-26 14:24:13 jaume
|
47 | * implemented Print
|
||
48 | *
|
||
49 | * Revision 1.5 2007/03/21 11:02:17 jaume
|
||
50 | 10832 | jaume | * *** empty log message ***
|
51 | *
|
||
52 | * Revision 1.4 2007/03/09 11:20:56 jaume
|
||
53 | 10679 | jaume | * Advanced symbology (start committing)
|
54 | *
|
||
55 | * Revision 1.3.2.4 2007/02/16 10:54:12 jaume
|
||
56 | * multilayer splitted to multilayerline, multilayermarker,and multilayerfill
|
||
57 | *
|
||
58 | * Revision 1.3.2.3 2007/02/15 16:23:44 jaume
|
||
59 | 9639 | jaume | * *** empty log message ***
|
60 | *
|
||
61 | 10679 | jaume | * Revision 1.3.2.2 2007/02/09 07:47:05 jaume
|
62 | * Isymbol moved
|
||
63 | *
|
||
64 | * Revision 1.3.2.1 2007/02/02 16:21:24 jaume
|
||
65 | * start commiting labeling stuff
|
||
66 | *
|
||
67 | * Revision 1.3 2007/01/25 16:25:23 jaume
|
||
68 | * *** empty log message ***
|
||
69 | *
|
||
70 | 9919 | jaume | * Revision 1.2 2007/01/16 11:50:44 jaume
|
71 | * *** empty log message ***
|
||
72 | *
|
||
73 | 9745 | jaume | * Revision 1.1 2007/01/10 16:31:36 jaume
|
74 | * *** empty log message ***
|
||
75 | *
|
||
76 | 9639 | jaume | * Revision 1.4 2006/12/04 17:13:39 fjp
|
77 | * *** empty log message ***
|
||
78 | *
|
||
79 | * Revision 1.3 2006/11/14 11:10:27 jaume
|
||
80 | * *** empty log message ***
|
||
81 | *
|
||
82 | * Revision 1.2 2006/11/09 18:39:05 jaume
|
||
83 | * *** empty log message ***
|
||
84 | *
|
||
85 | * Revision 1.1 2006/10/31 16:16:34 jaume
|
||
86 | * *** empty log message ***
|
||
87 | *
|
||
88 | * Revision 1.4 2006/10/30 19:30:35 jaume
|
||
89 | * *** empty log message ***
|
||
90 | *
|
||
91 | * Revision 1.3 2006/10/26 16:27:33 jaume
|
||
92 | * support for composite marker symbols (not tested)
|
||
93 | *
|
||
94 | * Revision 1.2 2006/10/26 07:46:58 jaume
|
||
95 | * *** empty log message ***
|
||
96 | *
|
||
97 | * Revision 1.1 2006/10/25 10:50:41 jaume
|
||
98 | * movement of classes and gui stuff
|
||
99 | *
|
||
100 | * Revision 1.1 2006/10/18 07:54:06 jaume
|
||
101 | * *** empty log message ***
|
||
102 | *
|
||
103 | *
|
||
104 | */
|
||
105 | package com.iver.cit.gvsig.fmap.core.symbols; |
||
106 | |||
107 | import java.awt.Color; |
||
108 | 10902 | jaume | import java.awt.Graphics2D; |
109 | 9639 | jaume | import java.awt.Point; |
110 | 10902 | jaume | import java.awt.geom.AffineTransform; |
111 | 9639 | jaume | import java.awt.geom.Point2D; |
112 | |||
113 | 10902 | jaume | import javax.print.attribute.PrintRequestAttributeSet; |
114 | import javax.print.attribute.standard.PrintQuality; |
||
115 | |||
116 | import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
||
117 | 9639 | jaume | import com.iver.cit.gvsig.fmap.core.FShape; |
118 | import com.iver.cit.gvsig.fmap.core.IGeometry; |
||
119 | |||
120 | |||
121 | /**
|
||
122 | * Abstract class that any MARKER SYMBOL should extend.
|
||
123 | 10679 | jaume | * @author jaume dominguez faus - jaume.dominguez@iver.es
|
124 | 9639 | jaume | */
|
125 | 10679 | jaume | public abstract class AbstractMarkerSymbol extends AbstractSymbol implements IMarkerSymbol { |
126 | private Color color = Color.BLACK; |
||
127 | private double rotation; |
||
128 | private Point2D offset = new Point2D.Double(); |
||
129 | private double size; |
||
130 | 9639 | jaume | |
131 | public double getRotation() { |
||
132 | return rotation;
|
||
133 | } |
||
134 | |||
135 | public void setRotation(double r) { |
||
136 | this.rotation = r;
|
||
137 | } |
||
138 | 10832 | jaume | |
139 | 9639 | jaume | public Point2D getOffset() { |
140 | if (offset == null) { |
||
141 | offset = new Point(); |
||
142 | } |
||
143 | return offset;
|
||
144 | } |
||
145 | |||
146 | 10679 | jaume | public void setOffset(Point2D offset) { |
147 | 9639 | jaume | this.offset = offset;
|
148 | } |
||
149 | |||
150 | public boolean isSuitableFor(IGeometry geom) { |
||
151 | return geom.getGeometryType() == FShape.POINT;
|
||
152 | } |
||
153 | |||
154 | public int getOnePointRgb() { |
||
155 | return color.getRGB();
|
||
156 | } |
||
157 | |||
158 | 9919 | jaume | public double getSize() { |
159 | return size;
|
||
160 | } |
||
161 | |||
162 | public void setSize(double size) { |
||
163 | this.size = size;
|
||
164 | } |
||
165 | |||
166 | public Color getColor() { |
||
167 | return color;
|
||
168 | } |
||
169 | |||
170 | public void setColor(Color color) { |
||
171 | this.color = color;
|
||
172 | } |
||
173 | 10902 | jaume | |
174 | public void print(Graphics2D g, AffineTransform at, FShape shape, PrintRequestAttributeSet properties) throws ReadDriverException { |
||
175 | double originalSize = getSize();
|
||
176 | // scale it to size
|
||
177 | PrintQuality pq = (PrintQuality) properties.get(PrintQuality.class); |
||
178 | if (pq.equals(PrintQuality.NORMAL)){ |
||
179 | originalSize *= (double) 300/72; |
||
180 | }else if (pq.equals(PrintQuality.HIGH)){ |
||
181 | originalSize *= (double) 600/72; |
||
182 | }else if (pq.equals(PrintQuality.DRAFT)){ |
||
183 | // unitFactor *= 72; (which is the same than doing nothing)
|
||
184 | } |
||
185 | setSize(originalSize); |
||
186 | } |
||
187 | |||
188 | 9639 | jaume | } |