Revision 28367
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/AbstractMarkerSymbol.java | ||
---|---|---|
138 | 138 |
import javax.print.attribute.PrintRequestAttributeSet; |
139 | 139 |
import javax.print.attribute.standard.PrintQuality; |
140 | 140 |
|
141 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
142 | 141 |
import com.iver.cit.gvsig.fmap.ViewPort; |
143 | 142 |
import com.iver.cit.gvsig.fmap.core.CartographicSupportToolkit; |
144 | 143 |
import com.iver.cit.gvsig.fmap.core.FPoint2D; |
144 |
import com.iver.cit.gvsig.fmap.core.FPolygon2D; |
|
145 | 145 |
import com.iver.cit.gvsig.fmap.core.FShape; |
146 | 146 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
147 | 147 |
import com.iver.cit.gvsig.fmap.core.SymbologyFactory; |
... | ... | |
213 | 213 |
} |
214 | 214 |
|
215 | 215 |
|
216 |
public void print(Graphics2D g, AffineTransform at, FShape shape, PrintRequestAttributeSet properties) throws ReadDriverException {
|
|
216 |
public void print(Graphics2D g, AffineTransform at, FShape shape, PrintRequestAttributeSet properties) { |
|
217 | 217 |
double originalSize = getSize(); |
218 | 218 |
double size=originalSize; |
219 | 219 |
// scale it to size |
... | ... | |
234 | 234 |
return mask; |
235 | 235 |
} |
236 | 236 |
|
237 |
public void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r) throws SymbolDrawingException { |
|
238 |
draw(g, scaleInstance, new FPoint2D(r.getCenterX(), r.getCenterY()), null); |
|
237 |
public void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r, PrintRequestAttributeSet properties) throws SymbolDrawingException { |
|
238 |
if (properties==null) |
|
239 |
draw(g, scaleInstance, new FPoint2D(r.getCenterX(), r.getCenterY()), null); |
|
240 |
else |
|
241 |
print(g, new AffineTransform(), new FPoint2D(r.getCenterX(), r.getCenterY()), properties); |
|
239 | 242 |
} |
240 | 243 |
|
241 | 244 |
public final void setMask(IMask mask) { |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/MultiShapeSymbol.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
import javax.print.attribute.PrintRequestAttributeSet; |
11 | 11 |
|
12 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
13 | 12 |
import com.iver.cit.gvsig.fmap.ViewPort; |
14 | 13 |
import com.iver.cit.gvsig.fmap.core.CartographicSupportToolkit; |
15 | 14 |
import com.iver.cit.gvsig.fmap.core.FShape; |
... | ... | |
265 | 264 |
} |
266 | 265 |
|
267 | 266 |
public void drawInsideRectangle(Graphics2D g, |
268 |
AffineTransform scaleInstance, Rectangle r) throws SymbolDrawingException { |
|
267 |
AffineTransform scaleInstance, Rectangle r, PrintRequestAttributeSet properties) throws SymbolDrawingException {
|
|
269 | 268 |
double myWidth = (r.getWidth()/3); |
270 | 269 |
|
271 | 270 |
Rectangle rect = new Rectangle(0, r.y, (int) myWidth, r.height); |
272 | 271 |
|
273 | 272 |
if (marker != null) { |
274 | 273 |
g.translate(r.x, r.y); |
275 |
marker.drawInsideRectangle(g, scaleInstance, rect); |
|
274 |
marker.drawInsideRectangle(g, scaleInstance, rect, properties);
|
|
276 | 275 |
g.translate(-(r.x), -(r.y)); |
277 | 276 |
} |
278 | 277 |
|
279 | 278 |
if (line != null) { |
280 | 279 |
g.translate(r.x+myWidth, r.y); |
281 |
line.drawInsideRectangle(g, scaleInstance, rect); |
|
280 |
line.drawInsideRectangle(g, scaleInstance, rect, properties);
|
|
282 | 281 |
g.translate(-(r.x+myWidth), -(r.y)); |
283 | 282 |
} |
284 | 283 |
|
285 | 284 |
if (fill != null) { |
286 | 285 |
g.translate(r.x+myWidth+myWidth, r.y); |
287 |
fill.drawInsideRectangle(g, scaleInstance, rect); |
|
286 |
fill.drawInsideRectangle(g, scaleInstance, rect, properties);
|
|
288 | 287 |
g.translate(-(r.x+myWidth+myWidth), -(r.y)); |
289 | 288 |
|
290 | 289 |
} |
... | ... | |
294 | 293 |
return getClass().getName(); |
295 | 294 |
} |
296 | 295 |
|
297 |
public void print(Graphics2D g, AffineTransform at, FShape shape, PrintRequestAttributeSet properties) |
|
298 |
throws ReadDriverException { |
|
296 |
public void print(Graphics2D g, AffineTransform at, FShape shape, PrintRequestAttributeSet properties) { |
|
299 | 297 |
switch (shape.getShapeType()) { |
300 | 298 |
case FShape.POINT: //Tipo punto |
301 | 299 |
case FShape.POINT + FShape.Z: |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/AbstractLineSymbol.java | ||
---|---|---|
106 | 106 |
import javax.print.attribute.PrintRequestAttributeSet; |
107 | 107 |
import javax.print.attribute.standard.PrintQuality; |
108 | 108 |
|
109 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
110 | 109 |
import com.iver.cit.gvsig.fmap.ViewPort; |
111 | 110 |
import com.iver.cit.gvsig.fmap.core.CartographicSupportToolkit; |
112 | 111 |
import com.iver.cit.gvsig.fmap.core.FPolygon2D; |
... | ... | |
184 | 183 |
color = new Color(color.getRed(), color.getGreen(), color.getBlue(), outlineAlpha); |
185 | 184 |
} |
186 | 185 |
|
187 |
public void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r) throws SymbolDrawingException { |
|
186 |
public void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r, PrintRequestAttributeSet properties) throws SymbolDrawingException {
|
|
188 | 187 |
final int hGap = (int) (r.getWidth() * 0.1); // the left and right margins |
189 | 188 |
final int vPos = 1; // the top and bottom margins |
190 | 189 |
final int splitCount = 3; // number of lines |
... | ... | |
202 | 201 |
} |
203 | 202 |
|
204 | 203 |
try { |
205 |
draw(g, new AffineTransform(), new FPolygon2D(gpx), null); |
|
204 |
if (properties==null) |
|
205 |
draw(g, new AffineTransform(), new FPolygon2D(gpx), null); |
|
206 |
else |
|
207 |
print(g, new AffineTransform(), new FPolygon2D(gpx), properties); |
|
206 | 208 |
} catch (Exception e) { |
207 | 209 |
throw new SymbolDrawingException(SymbolDrawingException.UNSUPPORTED_SET_OF_SETTINGS); |
208 | 210 |
} |
... | ... | |
359 | 361 |
public void print(Graphics2D g, |
360 | 362 |
AffineTransform at, |
361 | 363 |
FShape shape, |
362 |
PrintRequestAttributeSet properties) throws ReadDriverException {
|
|
364 |
PrintRequestAttributeSet properties) { |
|
363 | 365 |
double originalSize = getLineWidth(); |
364 | 366 |
double size=originalSize; |
365 | 367 |
// scale it to size |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/ISymbol.java | ||
---|---|---|
45 | 45 |
import java.awt.Rectangle; |
46 | 46 |
import java.awt.geom.AffineTransform; |
47 | 47 |
|
48 |
import javax.print.attribute.PrintRequestAttributeSet; |
|
49 |
|
|
48 | 50 |
import com.iver.cit.gvsig.fmap.ViewPort; |
49 | 51 |
import com.iver.cit.gvsig.fmap.core.FShape; |
50 | 52 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
... | ... | |
188 | 190 |
* rectangles. For example, think about rendering a Label with size |
189 | 191 |
* in meters => You will need to specify a size in pixels. |
190 | 192 |
* Of course, you can also to choose to render a prepared image, etc. |
191 |
* @param g2 |
|
192 | 193 |
* @param scaleInstance |
193 | 194 |
* @param r |
195 |
* @param properties TODO |
|
196 |
* @param g2 |
|
194 | 197 |
* @throws SymbolDrawingException TODO |
195 | 198 |
*/ |
196 |
public void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r) throws SymbolDrawingException; |
|
199 |
public void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r, PrintRequestAttributeSet properties) throws SymbolDrawingException;
|
|
197 | 200 |
|
198 | 201 |
|
199 | 202 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/MultiLayerMarkerSymbol.java | ||
---|---|---|
104 | 104 |
|
105 | 105 |
import javax.print.attribute.PrintRequestAttributeSet; |
106 | 106 |
|
107 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
108 | 107 |
import com.iver.cit.gvsig.fmap.ViewPort; |
109 | 108 |
import com.iver.cit.gvsig.fmap.core.FPoint2D; |
110 | 109 |
import com.iver.cit.gvsig.fmap.core.FShape; |
... | ... | |
192 | 191 |
g.rotate(-rotation, p.getX(), p.getY()); |
193 | 192 |
} |
194 | 193 |
|
195 |
public void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r) throws SymbolDrawingException { |
|
194 |
public void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r, PrintRequestAttributeSet properties) throws SymbolDrawingException {
|
|
196 | 195 |
g.rotate(rotation, r.getCenterX(), r.getCenterY()); |
197 | 196 |
for (int i = 0; i < layers.length; i++) { |
198 |
layers[i].drawInsideRectangle(g, scaleInstance, r); |
|
197 |
layers[i].drawInsideRectangle(g, scaleInstance, r, properties);
|
|
199 | 198 |
} |
200 | 199 |
g.rotate(-rotation, r.getCenterX(), r.getCenterY()); |
201 | 200 |
} |
... | ... | |
266 | 265 |
} |
267 | 266 |
|
268 | 267 |
|
269 |
public void print(Graphics2D g, AffineTransform at, FShape shape, PrintRequestAttributeSet properties) |
|
270 |
throws ReadDriverException { |
|
268 |
public void print(Graphics2D g, AffineTransform at, FShape shape, PrintRequestAttributeSet properties) { |
|
271 | 269 |
for (int i = 0; i < layers.length; i++) { |
272 | 270 |
layers[i].print(g, at, shape, properties); |
273 | 271 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/SimpleTextSymbol.java | ||
---|---|---|
55 | 55 |
import javax.print.attribute.PrintRequestAttributeSet; |
56 | 56 |
import javax.print.attribute.standard.PrintQuality; |
57 | 57 |
|
58 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
59 | 58 |
import com.iver.cit.gvsig.fmap.MapContext; |
60 | 59 |
import com.iver.cit.gvsig.fmap.ViewPort; |
61 | 60 |
import com.iver.cit.gvsig.fmap.core.CartographicSupportToolkit; |
... | ... | |
87 | 86 |
private boolean autoresize; |
88 | 87 |
private Rectangle bounds = null; |
89 | 88 |
private FShape horizontalTextWrappingShape = null; |
89 |
private PrintRequestAttributeSet properties; |
|
90 | 90 |
|
91 | 91 |
public void draw(Graphics2D g, AffineTransform affineTransform, FShape shp, Cancellable cancel) { |
92 | 92 |
if (!isShapeVisible()) return; |
93 | 93 |
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
94 | 94 |
g.setColor(textColor); |
95 |
float size=font.getSize2D(); |
|
96 |
if (properties!=null){ |
|
97 |
PrintQuality pq = (PrintQuality) properties.get(PrintQuality.class); |
|
98 |
if (pq.equals(PrintQuality.NORMAL)){ |
|
99 |
size *= (float) 300/72; |
|
100 |
}else if (pq.equals(PrintQuality.HIGH)){ |
|
101 |
size *= (float) 600/72; |
|
102 |
}else if (pq.equals(PrintQuality.DRAFT)){ |
|
103 |
// unitFactor *= 72; (which is the same than doing nothing) |
|
104 |
} |
|
105 |
font=font.deriveFont(size); |
|
106 |
} |
|
95 | 107 |
g.setFont(font); |
96 | 108 |
g.translate(((FPoint2D) shp).getX(), ((FPoint2D) shp).getY()); |
97 | 109 |
|
... | ... | |
103 | 115 |
// Alineamos el texto de manera que la parte superior |
104 | 116 |
// izquierda de la primera letra est? en (0,0). |
105 | 117 |
g.drawString(getText(), 0, (int)-bounds.getY()); |
118 |
if (properties!=null){ |
|
119 |
font=font.deriveFont(size); |
|
120 |
g.setFont(font); |
|
121 |
} |
|
106 | 122 |
g.rotate(-rotation); |
107 | 123 |
g.translate(-((FPoint2D) shp).getX(), -((FPoint2D) shp).getY()); |
108 | 124 |
} |
109 | 125 |
|
110 | 126 |
public void drawInsideRectangle(Graphics2D g, |
111 |
AffineTransform scaleInstance, Rectangle r) throws SymbolDrawingException { |
|
127 |
AffineTransform scaleInstance, Rectangle r, PrintRequestAttributeSet properties) throws SymbolDrawingException {
|
|
112 | 128 |
int s = getFont().getSize(); |
113 | 129 |
|
114 | 130 |
if (autoresize) { |
... | ... | |
136 | 152 |
|
137 | 153 |
//Only for debugging purpose |
138 | 154 |
// g.drawRect((int)r.getX(), (int)r.getY(), (int)r.getWidth(), (int)r.getHeight()); |
155 |
if (properties==null) |
|
156 |
draw(g, null, new FPoint2D(r.getX(), r.getY()), null); |
|
157 |
else |
|
158 |
print(g, new AffineTransform(), new FPoint2D(r.getX(), r.getY()), properties); |
|
139 | 159 |
|
140 |
draw(g, null, new FPoint2D(r.getX(), r.getY()), null); |
|
141 |
|
|
142 |
|
|
143 | 160 |
} |
144 | 161 |
|
145 | 162 |
public int getOnePointRgb() { |
... | ... | |
199 | 216 |
return getClass().getName(); |
200 | 217 |
} |
201 | 218 |
|
202 |
public void print(Graphics2D g, AffineTransform at, FShape shape, PrintRequestAttributeSet properties) |
|
203 |
throws ReadDriverException {
|
|
204 |
// TODO Implement it
|
|
205 |
throw new Error("Not yet implemented!");
|
|
219 |
public void print(Graphics2D g, AffineTransform at, FShape shape, PrintRequestAttributeSet properties) {
|
|
220 |
this.properties=properties;
|
|
221 |
draw(g, at, shape, null);
|
|
222 |
this.properties=null;
|
|
206 | 223 |
|
207 | 224 |
} |
208 | 225 |
|
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/MultiLayerFillSymbol.java | ||
---|---|---|
97 | 97 |
|
98 | 98 |
import javax.print.attribute.PrintRequestAttributeSet; |
99 | 99 |
|
100 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
101 | 100 |
import com.iver.cit.gvsig.fmap.MapContext; |
102 | 101 |
import com.iver.cit.gvsig.fmap.ViewPort; |
103 | 102 |
import com.iver.cit.gvsig.fmap.core.FShape; |
... | ... | |
165 | 164 |
} |
166 | 165 |
|
167 | 166 |
public void drawInsideRectangle(Graphics2D g, |
168 |
AffineTransform scaleInstance, Rectangle r) throws SymbolDrawingException { |
|
167 |
AffineTransform scaleInstance, Rectangle r, PrintRequestAttributeSet properties) throws SymbolDrawingException {
|
|
169 | 168 |
for (int i = 0; i < layers.length; i++) { |
170 |
layers[i].drawInsideRectangle(g, scaleInstance, r); |
|
169 |
layers[i].drawInsideRectangle(g, scaleInstance, r, properties);
|
|
171 | 170 |
} |
172 | 171 |
} |
173 | 172 |
|
... | ... | |
251 | 250 |
} |
252 | 251 |
} |
253 | 252 |
|
254 |
public void print(Graphics2D g, AffineTransform at, FShape shape, PrintRequestAttributeSet properties) |
|
255 |
throws ReadDriverException { |
|
253 |
public void print(Graphics2D g, AffineTransform at, FShape shape, PrintRequestAttributeSet properties) { |
|
256 | 254 |
for (int i = 0; i < layers.length; i++) { |
257 | 255 |
layers[i].print(g, at, shape, properties); |
258 | 256 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/MultiLayerLineSymbol.java | ||
---|---|---|
112 | 112 |
|
113 | 113 |
import javax.print.attribute.PrintRequestAttributeSet; |
114 | 114 |
|
115 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
116 | 115 |
import com.iver.cit.gvsig.fmap.MapContext; |
117 | 116 |
import com.iver.cit.gvsig.fmap.ViewPort; |
118 | 117 |
import com.iver.cit.gvsig.fmap.core.FShape; |
... | ... | |
196 | 195 |
} |
197 | 196 |
} |
198 | 197 |
|
199 |
public void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r) throws SymbolDrawingException { |
|
198 |
public void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r, PrintRequestAttributeSet properties) throws SymbolDrawingException {
|
|
200 | 199 |
for (int i = 0; i < layers.length; i++) { |
201 |
layers[i].drawInsideRectangle(g, scaleInstance, r); |
|
200 |
layers[i].drawInsideRectangle(g, scaleInstance, r, properties);
|
|
202 | 201 |
} |
203 | 202 |
} |
204 | 203 |
|
... | ... | |
266 | 265 |
} |
267 | 266 |
} |
268 | 267 |
|
269 |
public void print(Graphics2D g, AffineTransform at, FShape shape, PrintRequestAttributeSet properties) |
|
270 |
throws ReadDriverException { |
|
268 |
public void print(Graphics2D g, AffineTransform at, FShape shape, PrintRequestAttributeSet properties) { |
|
271 | 269 |
for (int i = 0; i < layers.length; i++) { |
272 | 270 |
layers[i].print(g, at, shape, properties); |
273 | 271 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/SimpleFillSymbol.java | ||
---|---|---|
129 | 129 |
|
130 | 130 |
import javax.print.attribute.PrintRequestAttributeSet; |
131 | 131 |
|
132 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
133 | 132 |
import com.iver.cit.gvsig.fmap.MapContext; |
134 | 133 |
import com.iver.cit.gvsig.fmap.core.FPolygon2D; |
135 | 134 |
import com.iver.cit.gvsig.fmap.core.FShape; |
... | ... | |
206 | 205 |
} |
207 | 206 |
|
208 | 207 |
public void drawInsideRectangle(Graphics2D g, |
209 |
AffineTransform scaleInstance, Rectangle r) throws SymbolDrawingException { |
|
208 |
AffineTransform scaleInstance, Rectangle r, PrintRequestAttributeSet properties) throws SymbolDrawingException {
|
|
210 | 209 |
Rectangle rect = new Rectangle(r.x, r.y, r.width, r.height); |
211 | 210 |
rect.setFrame(((int) rect.getMinX())+1, ((int) rect.getMinY())+1, ((int) rect.getWidth())-2, ((int) rect.getHeight())-2); |
212 | 211 |
FShape shp = new FPolygon2D(new GeneralPathX(rect)); |
... | ... | |
218 | 217 |
} |
219 | 218 |
|
220 | 219 |
if (getOutline() != null && hasOutline()) |
221 |
getOutline().draw(g, scaleInstance, shp, null); |
|
220 |
if (properties==null) |
|
221 |
getOutline().draw(g, scaleInstance, shp, null); |
|
222 |
else |
|
223 |
print(g, new AffineTransform(), shp, properties); |
|
222 | 224 |
} |
223 | 225 |
|
224 | 226 |
public String getClassName() { |
... | ... | |
258 | 260 |
setHasOutline(xml.getBooleanProperty("hasOutline")); |
259 | 261 |
} |
260 | 262 |
|
261 |
public void print(Graphics2D g, AffineTransform at, FShape shape, PrintRequestAttributeSet properties) throws ReadDriverException {
|
|
263 |
public void print(Graphics2D g, AffineTransform at, FShape shape, PrintRequestAttributeSet properties) { |
|
262 | 264 |
Color c = getFillColor(); |
263 | 265 |
if (c!=null && hasFill()) { |
264 | 266 |
g.setColor(c); |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/SimpleLineSymbol.java | ||
---|---|---|
187 | 187 |
} |
188 | 188 |
|
189 | 189 |
public void drawInsideRectangle(Graphics2D g, |
190 |
AffineTransform scaleInstance, Rectangle r) throws SymbolDrawingException { |
|
190 |
AffineTransform scaleInstance, Rectangle r, PrintRequestAttributeSet properties) throws SymbolDrawingException {
|
|
191 | 191 |
g.setColor(getColor()); |
192 | 192 |
g.setStroke(getLineStyle().getStroke()); |
193 |
super.drawInsideRectangle(g, scaleInstance, r); |
|
193 |
super.drawInsideRectangle(g, scaleInstance, r, properties);
|
|
194 | 194 |
} |
195 | 195 |
|
196 | 196 |
public String getClassName() { |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/IPrintable.java | ||
---|---|---|
5 | 5 |
|
6 | 6 |
import javax.print.attribute.PrintRequestAttributeSet; |
7 | 7 |
|
8 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
9 | 8 |
|
10 | 9 |
public interface IPrintable { |
11 | 10 |
public void print(Graphics2D g, |
12 | 11 |
AffineTransform at, |
13 | 12 |
FShape shape, |
14 |
PrintRequestAttributeSet properties) |
|
15 |
throws ReadDriverException; |
|
13 |
PrintRequestAttributeSet properties); |
|
16 | 14 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/adapter/PointAdapter.java | ||
---|---|---|
78 | 78 |
point.transform(at); |
79 | 79 |
|
80 | 80 |
FShape shapeAux = new FPoint2D(point.getCurrentPoint()); |
81 |
try { |
|
82 |
symbol.print(g,at,shapeAux, properties); |
|
83 |
} catch (ReadDriverException e) { |
|
84 |
// TODO Auto-generated catch block |
|
85 |
e.printStackTrace(); |
|
86 |
} |
|
81 |
symbol.print(g,at,shapeAux, properties); |
|
87 | 82 |
|
88 | 83 |
// FGraphicUtilities.DrawShape(g, at, shapeAux, symbol); |
89 | 84 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/adapter/PolyLineAdapter.java | ||
---|---|---|
118 | 118 |
} |
119 | 119 |
public void print(Graphics2D g, AffineTransform at, ISymbol symbol,PrintRequestAttributeSet properties) { |
120 | 120 |
FShape shapeAux =getShape(at); |
121 |
try { |
|
122 |
symbol.print(g,at,shapeAux, properties); |
|
123 |
} catch (ReadDriverException e) { |
|
124 |
// TODO Auto-generated catch block |
|
125 |
e.printStackTrace(); |
|
126 |
} |
|
127 |
// FGraphicUtilities.DrawShape(g, at, shapeAux, symbol); |
|
121 |
symbol.print(g,at,shapeAux, properties); |
|
122 |
// FGraphicUtilities.DrawShape(g, at, shapeAux, symbol); |
|
128 | 123 |
} |
129 | 124 |
/** |
130 | 125 |
* DOCUMENT ME! |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/adapter/CircleAdapter.java | ||
---|---|---|
140 | 140 |
|
141 | 141 |
public void print(Graphics2D g, AffineTransform at, ISymbol symbol, PrintRequestAttributeSet properties) { |
142 | 142 |
FShape shapeAux=getShape(at); |
143 |
try { |
|
144 |
symbol.print(g,at,shapeAux, properties); |
|
145 |
} catch (ReadDriverException e) { |
|
146 |
// TODO Auto-generated catch block |
|
147 |
e.printStackTrace(); |
|
148 |
} |
|
149 |
|
|
143 |
symbol.print(g,at,shapeAux, properties); |
|
150 | 144 |
} |
151 | 145 |
|
152 | 146 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/SymbologyFactory.java | ||
---|---|---|
114 | 114 |
import java.awt.geom.Ellipse2D; |
115 | 115 |
import java.io.File; |
116 | 116 |
|
117 |
import javax.print.attribute.PrintRequestAttributeSet; |
|
117 | 118 |
import javax.swing.JFrame; |
118 | 119 |
import javax.swing.JPanel; |
119 | 120 |
|
... | ... | |
410 | 411 |
return new MultiShapeSymbol(); |
411 | 412 |
} else if (shapeType == FShape.NULL){ |
412 | 413 |
return null; |
413 |
}
|
|
414 |
} |
|
414 | 415 |
throw new Error("shape type not yet supported"); |
415 | 416 |
} |
416 | 417 |
|
... | ... | |
473 | 474 |
super.paintComponent(g); |
474 | 475 |
Graphics2D g2 = (Graphics2D)g; |
475 | 476 |
try { |
476 |
warning.drawInsideRectangle(g2, g2.getTransform(), getBounds()); |
|
477 |
warning.drawInsideRectangle(g2, g2.getTransform(), getBounds(), null);
|
|
477 | 478 |
} catch (SymbolDrawingException e) { |
478 | 479 |
// TODO Auto-generated catch block |
479 | 480 |
e.printStackTrace(); |
... | ... | |
488 | 489 |
public void draw(Graphics2D g, AffineTransform affineTransform, |
489 | 490 |
FShape shp, Cancellable cancel) { |
490 | 491 |
try { |
491 |
drawInsideRectangle(g, g.getTransform(), shp.getBounds()); |
|
492 |
drawInsideRectangle(g, g.getTransform(), shp.getBounds(), null);
|
|
492 | 493 |
} catch (SymbolDrawingException e) { |
493 | 494 |
// IMPOSSIBLE |
494 | 495 |
} |
... | ... | |
503 | 504 |
} |
504 | 505 |
|
505 | 506 |
public void drawInsideRectangle(Graphics2D g, |
506 |
AffineTransform scaleInstance, Rectangle r) |
|
507 |
AffineTransform scaleInstance, Rectangle r, PrintRequestAttributeSet properties)
|
|
507 | 508 |
throws SymbolDrawingException { |
508 | 509 |
g.setClip(r); |
509 | 510 |
if (message == null) { |
... | ... | |
550 | 551 |
(int) lineHeight); |
551 | 552 |
for (int i =0; i < messageLines.length; i++) { |
552 | 553 |
text.setText(messageLines[i]); |
553 |
text.drawInsideRectangle(g, null, textRect); |
|
554 |
text.drawInsideRectangle(g, null, textRect, properties);
|
|
554 | 555 |
textRect.setLocation((int) r.getX(), (int) (r.getY()+r.getHeight())); |
555 | 556 |
} |
556 | 557 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/v02/FSymbol.java | ||
---|---|---|
1236 | 1236 |
return true; |
1237 | 1237 |
} |
1238 | 1238 |
|
1239 |
public void drawInsideRectangle(Graphics2D g2, AffineTransform scaleInstance, Rectangle r) throws SymbolDrawingException { |
|
1239 |
public void drawInsideRectangle(Graphics2D g2, AffineTransform scaleInstance, Rectangle r, PrintRequestAttributeSet properties) throws SymbolDrawingException {
|
|
1240 | 1240 |
FGraphicUtilities.DrawSymbol(g2, scaleInstance, r, this); |
1241 | 1241 |
} |
1242 | 1242 |
|
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/EditableAdapter.java | ||
---|---|---|
633 | 633 |
* @throws IOException |
634 | 634 |
* @throws DriverIOException |
635 | 635 |
*/ |
636 |
public void undoModifyRow(int geometryIndex,
|
|
636 |
public int undoModifyRow(int geometryIndex,
|
|
637 | 637 |
int previousExpansionFileIndex, int sourceType) throws EditionCommandException { |
638 | 638 |
|
639 | 639 |
if (previousExpansionFileIndex == -1) { |
... | ... | |
653 | 653 |
throw new EditionCommandException(writer.getName(),e); |
654 | 654 |
} |
655 | 655 |
if (cancel) |
656 |
return; |
|
656 |
return -1;
|
|
657 | 657 |
// Se elimina de las relaciones y del fichero de expansi?n |
658 | 658 |
relations.remove(new Integer(geometryIndex)); |
659 | 659 |
expansionFile.deleteLastRow(); |
... | ... | |
669 | 669 |
throw new EditionCommandException(writer.getName(),e); |
670 | 670 |
} |
671 | 671 |
if (cancel) |
672 |
return; |
|
672 |
return -1; |
|
673 |
int numAnt=((Integer)relations.get(new Integer(geometryIndex))).intValue(); |
|
673 | 674 |
// Se actualiza la relaci?n de ?ndices |
674 | 675 |
relations.put(new Integer(geometryIndex), new Integer( |
675 | 676 |
previousExpansionFileIndex)); |
677 |
return numAnt; |
|
676 | 678 |
} |
677 | 679 |
//fireAfterModifyRow(geometryIndex, sourceType); |
680 |
return -1; |
|
678 | 681 |
} |
679 | 682 |
|
680 | 683 |
/** |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/VectorialEditableAdapter.java | ||
---|---|---|
623 | 623 |
} else { |
624 | 624 |
// Obtenemos el ?ndice en el fichero de expansi?n |
625 | 625 |
int num = ((Integer) relations.get(integer)).intValue(); |
626 |
posAnteriorInExpansionFile = num;
|
|
626 |
posAnteriorInExpansionFile=num;
|
|
627 | 627 |
|
628 | 628 |
// Obtenemos la geometr?a para actualiza el ?ndice |
629 | 629 |
// espacialposteriormente |
... | ... | |
648 | 648 |
this.fmapSpatialIndex.delete(rAnt, new Integer(calculatedIndex)); |
649 | 649 |
this.fmapSpatialIndex.insert(r, new Integer(calculatedIndex)); |
650 | 650 |
} |
651 |
|
|
651 | 652 |
} |
652 | 653 |
isFullExtentDirty = true; |
653 | 654 |
fireAfterModifyRow(calculatedIndex, sourceType); |
... | ... | |
671 | 672 |
* @throws IOException |
672 | 673 |
* @throws DriverIOException |
673 | 674 |
*/ |
674 |
public void undoModifyRow(int calculatedIndex,
|
|
675 |
public int undoModifyRow(int calculatedIndex,
|
|
675 | 676 |
int previousExpansionFileIndex, int sourceType) throws EditionCommandException{ |
676 | 677 |
try { |
677 | 678 |
// Llega el CalculatedIndex |
... | ... | |
691 | 692 |
boolean cancel = fireBeforeModifyRow(df, calculatedIndex, |
692 | 693 |
sourceType); |
693 | 694 |
if (cancel) |
694 |
return; |
|
695 |
return -1;
|
|
695 | 696 |
IGeometry g = df.getGeometry(); |
696 | 697 |
// IGeometry g = ova.getShape(calculatedIndex); |
697 | 698 |
Rectangle2D r = g.getBounds2D(); |
... | ... | |
718 | 719 |
boolean cancel = fireBeforeModifyRow(df, calculatedIndex, |
719 | 720 |
sourceType); |
720 | 721 |
if (cancel) |
721 |
return; |
|
722 |
return -1;
|
|
722 | 723 |
if (sourceType == EditionEvent.GRAPHIC) { |
723 | 724 |
g = df.getGeometry(); |
724 | 725 |
System.out.println("Actual: " + g.toString()); |
... | ... | |
741 | 742 |
} |
742 | 743 |
// Se actualiza la relaci?n de ?ndices |
743 | 744 |
// Integer integer = new Integer(geometryIndex); |
745 |
int numAnt=((Integer)relations.get(new Integer(calculatedIndex))).intValue(); |
|
744 | 746 |
relations.put(new Integer(calculatedIndex), new Integer( |
745 | 747 |
previousExpansionFileIndex)); |
748 |
return numAnt; |
|
746 | 749 |
|
747 | 750 |
} |
748 | 751 |
} catch (ReadDriverException e) { |
749 | 752 |
throw new EditionCommandException(writer.getName(),e); |
750 | 753 |
} |
751 | 754 |
//fireAfterModifyRow(calculatedIndex, sourceType); |
755 |
return -1; |
|
752 | 756 |
} |
753 | 757 |
|
754 | 758 |
/** |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/IEditableSource.java | ||
---|---|---|
197 | 197 |
void startComplexRow(); |
198 | 198 |
|
199 | 199 |
void endComplexRow(String description); |
200 |
public void undoModifyRow(int geometryIndex,int previousExpansionFileIndex, int sourceType) throws EditionCommandException;
|
|
200 |
public int undoModifyRow(int geometryIndex,int previousExpansionFileIndex, int sourceType) throws EditionCommandException;
|
|
201 | 201 |
public IRow doRemoveRow(int index, int sourceType) throws ReadDriverException, ExpansionFileReadException; |
202 | 202 |
public int doModifyRow(int index, IRow feat, int sourceType) throws ExpansionFileWriteException, ReadDriverException, ExpansionFileReadException; |
203 | 203 |
public int doAddRow(IRow feat, int sourceType) throws ReadDriverException, ExpansionFileWriteException; |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/AnnotationEditableAdapter.java | ||
---|---|---|
333 | 333 |
fireAfterRemoveRow(calculatedIndex, sourceType); |
334 | 334 |
} |
335 | 335 |
|
336 |
public void undoModifyRow(int calculatedIndex, int previousExpansionFileIndex, int sourceType) throws EditionCommandException {
|
|
336 |
public int undoModifyRow(int calculatedIndex, int previousExpansionFileIndex, int sourceType) throws EditionCommandException {
|
|
337 | 337 |
try { |
338 | 338 |
if (previousExpansionFileIndex == -1) { |
339 | 339 |
//Se obtiene la geometr?a para actualizar el ?ndice |
... | ... | |
352 | 352 |
IGeometry gAnt = dfAnt.getGeometry(); |
353 | 353 |
boolean cancel = fireBeforeModifyRow(dfAnt,calculatedIndex, sourceType); |
354 | 354 |
if (cancel) |
355 |
return; |
|
355 |
return -1;
|
|
356 | 356 |
Rectangle2D rAnt = gAnt.getBounds2D(); |
357 | 357 |
this.fmapSpatialIndex.delete(r, new Integer(calculatedIndex)); |
358 | 358 |
this.fmapSpatialIndex.insert(rAnt, new Integer(calculatedIndex)); |
... | ... | |
366 | 366 |
g = df.getGeometry(); |
367 | 367 |
Rectangle2D r = g.getBounds2D(); |
368 | 368 |
this.fmapSpatialIndex.delete(r, new Integer(calculatedIndex)); |
369 |
|
|
369 |
int numAnt=((Integer)relations.get(new Integer(calculatedIndex))).intValue(); |
|
370 | 370 |
//Se actualiza la relaci?n de ?ndices |
371 | 371 |
relations.put(new Integer(calculatedIndex), |
372 | 372 |
new Integer(previousExpansionFileIndex)); |
... | ... | |
375 | 375 |
df=(DefaultFeature)getRow(inverse).getLinkedRow(); |
376 | 376 |
boolean cancel = fireBeforeModifyRow(df,calculatedIndex, sourceType); |
377 | 377 |
if (cancel) |
378 |
return; |
|
378 |
return -1;
|
|
379 | 379 |
g = df.getGeometry(); |
380 | 380 |
r = g.getBounds2D(); |
381 | 381 |
this.fmapSpatialIndex.insert(r, new Integer(calculatedIndex)); |
... | ... | |
385 | 385 |
if (mapping.getColumnRotate()==mapping.getColumnText()){ |
386 | 386 |
label.setRotation(((NumericValue)value).doubleValue()); |
387 | 387 |
} |
388 |
return numAnt; |
|
388 | 389 |
} |
389 | 390 |
} catch (ReadDriverException e) { |
390 | 391 |
throw new EditionCommandException(writer.getName(),e); |
391 | 392 |
} |
392 | 393 |
fireAfterModifyRow(calculatedIndex, sourceType); |
394 |
return -1; |
|
393 | 395 |
} |
394 | 396 |
|
395 | 397 |
public void undoRemoveRow(int index, int sourceType) throws EditionCommandException { |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/commands/ModifyRowCommand.java | ||
---|---|---|
39 | 39 |
* @see com.iver.cit.gvsig.fmap.edition.Command#undo() |
40 | 40 |
*/ |
41 | 41 |
public void undo() throws EditionCommandException { |
42 |
efs.undoModifyRow(calculatedIndexAnt,previousIndexInExpansionFile,type); |
|
42 |
previousIndexInExpansionFile=efs.undoModifyRow(calculatedIndexAnt,previousIndexInExpansionFile,type);
|
|
43 | 43 |
} |
44 | 44 |
/** |
45 | 45 |
* @throws DriverIOException |
... | ... | |
48 | 48 |
*/ |
49 | 49 |
public void redo() throws EditionCommandException { |
50 | 50 |
try { |
51 |
efs.doModifyRow(calculatedIndexAnt,rowNext,type); |
|
51 |
previousIndexInExpansionFile=efs.doModifyRow(calculatedIndexAnt,rowNext,type);
|
|
52 | 52 |
} catch (ExpansionFileWriteException e) { |
53 | 53 |
throw new EditionCommandException(efs.getWriter().getName(),e); |
54 | 54 |
} catch (ReadDriverException e) { |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/styling/labeling/LabelClass.java | ||
---|---|---|
419 | 419 |
Rectangle textRect = new Rectangle(x, y, width, height); |
420 | 420 |
Shape oldClip = graphics.getClip(); |
421 | 421 |
graphics.setClip(textRect); |
422 |
getTextSymbol().drawInsideRectangle(graphics, null, textRect); |
|
422 |
getTextSymbol().drawInsideRectangle(graphics, null, textRect, null);
|
|
423 | 423 |
graphics.setClip(oldClip); |
424 | 424 |
} |
425 | 425 |
} |
... | ... | |
427 | 427 |
|
428 | 428 |
if (texts != null && texts.length>0) |
429 | 429 |
getTextSymbol().setText(texts[0]); |
430 |
getTextSymbol().drawInsideRectangle(graphics, null, bounds); |
|
430 |
getTextSymbol().drawInsideRectangle(graphics, null, bounds, null);
|
|
431 | 431 |
} |
432 | 432 |
} |
433 | 433 |
|
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/styling/labeling/AttrInTableLabelingStrategy.java | ||
---|---|---|
64 | 64 |
private boolean useFixedSize; |
65 | 65 |
private boolean useFixedColor; |
66 | 66 |
private int referenceSystem; |
67 |
private boolean isPrinting; |
|
68 | 67 |
private double printDPI; |
69 | 68 |
private Font font; |
70 | 69 |
private Color colorFont; |
... | ... | |
72 | 71 |
private String rotationFieldName; |
73 | 72 |
private String heightFieldName; |
74 | 73 |
private String colorFieldName; |
74 |
private PrintRequestAttributeSet properties; |
|
75 | 75 |
|
76 | 76 |
public ILabelingMethod getLabelingMethod() { |
77 | 77 |
return this.method; |
... | ... | |
202 | 202 |
for (int j = 0; j < aux.length; j++) { |
203 | 203 |
FPoint2D p = new FPoint2D(aux[j].getOrig()); |
204 | 204 |
p.transform(viewPort.getAffineTransform()); |
205 |
sym.draw(g, null, p, cancel); |
|
205 |
if (properties==null) |
|
206 |
sym.draw(g, null, p, cancel); |
|
207 |
else |
|
208 |
sym.print(g, null, p, properties); |
|
206 | 209 |
} |
207 | 210 |
|
208 | 211 |
|
... | ... | |
395 | 398 |
} |
396 | 399 |
|
397 | 400 |
public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel, PrintRequestAttributeSet properties) throws ReadDriverException { |
398 |
isPrinting = true; |
|
399 |
PrintQuality resolution=(PrintQuality)properties.get(PrintQuality.class); |
|
400 |
if (resolution.equals(PrintQuality.NORMAL)){ |
|
401 |
printDPI=300; |
|
402 |
} else if (resolution.equals(PrintQuality.HIGH)) { |
|
403 |
printDPI=600; |
|
404 |
} else if (resolution.equals(PrintQuality.DRAFT)) { |
|
405 |
printDPI=72; |
|
406 |
} |
|
401 |
this.properties=properties; |
|
407 | 402 |
draw(null, g, viewPort, cancel, printDPI); |
408 |
isPrinting = false;
|
|
403 |
this.properties=null;
|
|
409 | 404 |
} |
410 | 405 |
|
411 | 406 |
public void setUsesFixedSize(boolean b) { |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/featureiterators/SpatialQueryFeatureIterator.java | ||
---|---|---|
145 | 145 |
this.sourceProjection != null && |
146 | 146 |
this.targetProjection.getAbrev() != this.sourceProjection.getAbrev()){ |
147 | 147 |
ICoordTrans trans = targetProjection.getCT(sourceProjection); |
148 |
rect = trans.convert(rect); |
|
148 |
try{ |
|
149 |
rect = trans.convert(rect); |
|
150 |
}catch (NullPointerException e) { |
|
151 |
// TODO: handle exception |
|
152 |
} |
|
149 | 153 |
} |
150 | 154 |
this.rect = rect; |
151 | 155 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/dbf/DbaseFile.java | ||
---|---|---|
220 | 220 |
*/ |
221 | 221 |
public String getStringFieldValue(int rowIndex, int fieldId) |
222 | 222 |
throws UnsupportedEncodingException { |
223 |
try{ |
|
223 | 224 |
int fieldOffset = myHeader.getFieldDescription(fieldId).myFieldDataAddress; |
224 | 225 |
byte[] data = new byte[myHeader.getFieldLength(fieldId)]; |
225 | 226 |
if (rowIndex != posActual) { |
... | ... | |
241 | 242 |
cachedRecord.get(data); |
242 | 243 |
|
243 | 244 |
return new String(data, chars.name()); |
245 |
}catch (Exception e) { |
|
246 |
return ""; |
|
247 |
} |
|
244 | 248 |
|
245 | 249 |
} |
246 | 250 |
|
Also available in: Unified diff