Revision 745
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/FLabel.java | ||
---|---|---|
156 | 156 |
* @see com.iver.cit.gvsig.fmap.core.FShape#cloneFShape() |
157 | 157 |
*/ |
158 | 158 |
public FShape cloneFShape() { |
159 |
// TODO Auto-generated method stub |
|
160 |
return null; |
|
159 |
return new FLabel(text, scaled, pos, height); |
|
161 | 160 |
} |
162 | 161 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrVect.java | ||
---|---|---|
134 | 134 |
Strategy strategy = StrategyManager.getStrategy(this); |
135 | 135 |
|
136 | 136 |
strategy.draw(image, g, viewPort, cancel); |
137 |
if (getVirtualLayers() != null) |
|
138 |
getVirtualLayers().draw(image, g, viewPort, cancel); |
|
137 | 139 |
} |
138 | 140 |
|
139 | 141 |
/** |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/MemoryLabelAdapter.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 28-dic-2004 |
|
3 |
* |
|
4 |
* TODO To change the template for this generated file go to |
|
5 |
* Window - Preferences - Java - Code Generation - Code and Comments |
|
6 |
*/ |
|
7 |
package com.iver.cit.gvsig.fmap.layers; |
|
8 |
|
|
9 |
import java.awt.geom.Rectangle2D; |
|
10 |
import java.util.ArrayList; |
|
11 |
|
|
12 |
import com.hardcode.driverManager.DriverLoadException; |
|
13 |
import com.hardcode.gdbms.engine.data.DataSource; |
|
14 |
import com.hardcode.gdbms.engine.data.DataSourceFactory; |
|
15 |
import com.hardcode.gdbms.engine.data.NoSuchTableException; |
|
16 |
import com.iver.cit.gvsig.fmap.DriverException; |
|
17 |
import com.iver.cit.gvsig.fmap.core.FShape; |
|
18 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
|
19 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
|
20 |
import com.iver.cit.gvsig.fmap.operations.strategies.MemoryShapeInfo; |
|
21 |
import com.iver.cit.gvsig.fmap.rendering.indexes.IndexNotExistsException; |
|
22 |
|
|
23 |
/** |
|
24 |
* @author FJP |
|
25 |
* |
|
26 |
* TODO To change the template for this generated type comment go to |
|
27 |
* Window - Preferences - Java - Code Generation - Code and Comments |
|
28 |
*/ |
|
29 |
public class MemoryLabelAdapter extends VectorialAdapter { |
|
30 |
private String dataSourceName; |
|
31 |
private DataSource ds; |
|
32 |
private MemoryShapeInfo memShapeInfo = new MemoryShapeInfo(); |
|
33 |
private ArrayList arrayGeometries = new ArrayList(); |
|
34 |
private Rectangle2D fullExtent; |
|
35 |
|
|
36 |
public void setDataSource(DataSource ds) |
|
37 |
{ |
|
38 |
this.ds = ds; |
|
39 |
} |
|
40 |
|
|
41 |
|
|
42 |
/* (non-Javadoc) |
|
43 |
* @see com.iver.cit.gvsig.fmap.layers.VectorialAdapter#getRecordset(java.lang.String) |
|
44 |
*/ |
|
45 |
public DataSource getRecordset(String name) throws DriverLoadException { |
|
46 |
return ds; |
|
47 |
} |
|
48 |
|
|
49 |
/* (non-Javadoc) |
|
50 |
* @see com.iver.cit.gvsig.fmap.layers.VectorialAdapter#changeRecordsetName(java.lang.String) |
|
51 |
*/ |
|
52 |
public void changeRecordsetName(String newName) throws DriverException { |
|
53 |
try { |
|
54 |
if (ds == null) |
|
55 |
try { |
|
56 |
ds = getRecordset(newName); |
|
57 |
} catch (DriverLoadException e1) { |
|
58 |
throw new DriverException(e1); |
|
59 |
} |
|
60 |
DataSourceFactory.changeDataSourceName(dataSourceName, newName); |
|
61 |
} catch (NoSuchTableException e) { |
|
62 |
throw new RuntimeException("No existe la tabla que hemos creado????"); |
|
63 |
} |
|
64 |
dataSourceName = newName; |
|
65 |
|
|
66 |
|
|
67 |
} |
|
68 |
|
|
69 |
/* (non-Javadoc) |
|
70 |
* @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#start() |
|
71 |
*/ |
|
72 |
public void start() throws DriverIOException { |
|
73 |
} |
|
74 |
|
|
75 |
/* (non-Javadoc) |
|
76 |
* @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#stop() |
|
77 |
*/ |
|
78 |
public void stop() throws DriverIOException { |
|
79 |
} |
|
80 |
|
|
81 |
/* (non-Javadoc) |
|
82 |
* @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#getShape(int) |
|
83 |
*/ |
|
84 |
public IGeometry getShape(int index) throws DriverIOException { |
|
85 |
// TODO Auto-generated method stub |
|
86 |
return null; |
|
87 |
} |
|
88 |
|
|
89 |
/* (non-Javadoc) |
|
90 |
* @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#getShapeCount() |
|
91 |
*/ |
|
92 |
public int getShapeCount() throws DriverIOException { |
|
93 |
// TODO Auto-generated method stub |
|
94 |
return 0; |
|
95 |
} |
|
96 |
|
|
97 |
/* (non-Javadoc) |
|
98 |
* @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#getFullExtent() |
|
99 |
*/ |
|
100 |
public Rectangle2D getFullExtent() throws DriverIOException { |
|
101 |
return fullExtent; |
|
102 |
} |
|
103 |
|
|
104 |
/* (non-Javadoc) |
|
105 |
* @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#getShapeType() |
|
106 |
*/ |
|
107 |
public int getShapeType() throws DriverIOException { |
|
108 |
return FShape.TEXT; |
|
109 |
} |
|
110 |
|
|
111 |
/* (non-Javadoc) |
|
112 |
* @see com.iver.cit.gvsig.fmap.rendering.indexes.Index#getRecordIndexes(java.awt.geom.Rectangle2D) |
|
113 |
*/ |
|
114 |
public int[] getRecordIndexes(Rectangle2D rect) throws DriverIOException, |
|
115 |
IndexNotExistsException { |
|
116 |
return null; |
|
117 |
} |
|
118 |
|
|
119 |
} |
|
0 | 120 |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrDefault.java | ||
---|---|---|
22 | 22 |
|
23 | 23 |
/** Path de la capa en el arbol de capas */ |
24 | 24 |
private FLayers parentLayer = null; |
25 |
private FLayers virtualLayers = null; |
|
25 | 26 |
private String name; |
26 | 27 |
private IProjection projection; |
27 | 28 |
private boolean visible = true; |
... | ... | |
256 | 257 |
listener.activationChanged(e); |
257 | 258 |
} |
258 | 259 |
} |
260 |
|
|
261 |
|
|
262 |
public FLayers getVirtualLayers() { |
|
263 |
return virtualLayers; |
|
264 |
} |
|
265 |
public void setVirtualLayers(FLayers virtualLayers) { |
|
266 |
this.virtualLayers = virtualLayers; |
|
267 |
} |
|
259 | 268 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrText.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 28-dic-2004 |
|
3 |
* |
|
4 |
* TODO To change the template for this generated file go to |
|
5 |
* Window - Preferences - Java - Code Generation - Code and Comments |
|
6 |
*/ |
|
7 |
package com.iver.cit.gvsig.fmap.layers; |
|
8 |
|
|
9 |
import java.awt.Graphics2D; |
|
10 |
import java.awt.geom.Rectangle2D; |
|
11 |
import java.awt.image.BufferedImage; |
|
12 |
import java.util.ArrayList; |
|
13 |
|
|
14 |
import com.hardcode.gdbms.engine.instruction.FieldNotFoundException; |
|
15 |
import com.iver.cit.gvsig.fmap.DriverException; |
|
16 |
import com.iver.cit.gvsig.fmap.ViewPort; |
|
17 |
import com.iver.cit.gvsig.fmap.core.FPoint2D; |
|
18 |
import com.iver.cit.gvsig.fmap.core.FShape; |
|
19 |
import com.iver.cit.gvsig.fmap.core.v02.FGraphicUtilities; |
|
20 |
import com.iver.cit.gvsig.fmap.core.v02.FLabel; |
|
21 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
|
22 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.ClassifiableVectorial; |
|
23 |
import com.iver.cit.gvsig.fmap.operations.Cancellable; |
|
24 |
import com.iver.cit.gvsig.fmap.rendering.Legend; |
|
25 |
import com.iver.cit.gvsig.fmap.rendering.VectorialLegend; |
|
26 |
|
|
27 |
/** |
|
28 |
* @author FJP |
|
29 |
* |
|
30 |
* TODO To change the template for this generated type comment go to |
|
31 |
* Window - Preferences - Java - Code Generation - Code and Comments |
|
32 |
*/ |
|
33 |
public class FLyrText extends FLyrDefault implements ClassifiableVectorial { |
|
34 |
|
|
35 |
/** |
|
36 |
* <code>m_labels</code> es una arrayList de FLabel (string + punto de |
|
37 |
* inserci?n + rotaci?n + altura de texto |
|
38 |
*/ |
|
39 |
private ArrayList m_labels = new ArrayList(); |
|
40 |
private Legend legend; |
|
41 |
private Rectangle2D fullExtent; |
|
42 |
|
|
43 |
public FLyrText(ArrayList arrayLabels) |
|
44 |
{ |
|
45 |
m_labels = arrayLabels; |
|
46 |
} |
|
47 |
|
|
48 |
private void drawLabels(BufferedImage image, Graphics2D g, ViewPort viewPort, |
|
49 |
Cancellable cancel) |
|
50 |
{ |
|
51 |
int numReg; |
|
52 |
Rectangle2D elExtent = viewPort.getExtent(); |
|
53 |
|
|
54 |
int anchoMapa; |
|
55 |
int altoMapa; |
|
56 |
double anchoReal; |
|
57 |
double altoReal; |
|
58 |
double escala; |
|
59 |
FSymbol theSymbol = null; |
|
60 |
System.out.println("Dibujando etiquetas..."); |
|
61 |
|
|
62 |
|
|
63 |
for (numReg = 0; numReg < m_labels.size(); numReg++) |
|
64 |
{ |
|
65 |
if (cancel.isCanceled()) { |
|
66 |
break; |
|
67 |
} |
|
68 |
|
|
69 |
FLabel theLabel = (FLabel) m_labels.get(numReg); |
|
70 |
if (elExtent.contains(theLabel.getOrig())) // TODO: Aqui hay que ponerle al FLabel un getExtent() |
|
71 |
{ |
|
72 |
theSymbol = getLegend().getDefaultSymbol(); |
|
73 |
FShape shp = new FPoint2D(theLabel.getOrig().getX(), theLabel.getOrig().getY()); |
|
74 |
FGraphicUtilities.DrawLabel(g, viewPort.getAffineTransform(), |
|
75 |
shp, theSymbol, theLabel); |
|
76 |
} |
|
77 |
} |
|
78 |
} |
|
79 |
|
|
80 |
/* (non-Javadoc) |
|
81 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#getFullExtent() |
|
82 |
*/ |
|
83 |
public Rectangle2D getFullExtent() throws DriverException { |
|
84 |
return fullExtent; |
|
85 |
} |
|
86 |
|
|
87 |
/* (non-Javadoc) |
|
88 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#draw(java.awt.image.BufferedImage, java.awt.Graphics2D, com.iver.cit.gvsig.fmap.ViewPort, com.iver.cit.gvsig.fmap.operations.Cancellable) |
|
89 |
*/ |
|
90 |
public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort, |
|
91 |
Cancellable cancel) throws DriverException { |
|
92 |
drawLabels(image, g, viewPort, cancel); |
|
93 |
|
|
94 |
} |
|
95 |
|
|
96 |
/* (non-Javadoc) |
|
97 |
* @see com.iver.cit.gvsig.fmap.layers.FLayer#print(java.awt.Graphics2D, com.iver.cit.gvsig.fmap.ViewPort, com.iver.cit.gvsig.fmap.operations.Cancellable) |
|
98 |
*/ |
|
99 |
public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel) |
|
100 |
throws DriverException { |
|
101 |
drawLabels(null, g, viewPort, cancel); |
|
102 |
|
|
103 |
} |
|
104 |
|
|
105 |
/* (non-Javadoc) |
|
106 |
* @see com.iver.cit.gvsig.fmap.layers.layerOperations.ClassifiableVectorial#setLegend(com.iver.cit.gvsig.fmap.rendering.VectorialLegend) |
|
107 |
*/ |
|
108 |
public void setLegend(VectorialLegend r) throws DriverException, FieldNotFoundException { |
|
109 |
legend = r; |
|
110 |
} |
|
111 |
|
|
112 |
/* (non-Javadoc) |
|
113 |
* @see com.iver.cit.gvsig.fmap.layers.layerOperations.Classifiable#addLegendListener(com.iver.cit.gvsig.fmap.layers.LegendListener) |
|
114 |
*/ |
|
115 |
public void addLegendListener(LegendListener listener) { |
|
116 |
// TODO Auto-generated method stub |
|
117 |
|
|
118 |
} |
|
119 |
|
|
120 |
/* (non-Javadoc) |
|
121 |
* @see com.iver.cit.gvsig.fmap.layers.layerOperations.Classifiable#removeLegendListener(com.iver.cit.gvsig.fmap.layers.LegendListener) |
|
122 |
*/ |
|
123 |
public void removeLegendListener(LegendListener listener) { |
|
124 |
// TODO Auto-generated method stub |
|
125 |
|
|
126 |
} |
|
127 |
|
|
128 |
/* (non-Javadoc) |
|
129 |
* @see com.iver.cit.gvsig.fmap.layers.layerOperations.Classifiable#getLegend() |
|
130 |
*/ |
|
131 |
public Legend getLegend() { |
|
132 |
return legend; |
|
133 |
} |
|
134 |
|
|
135 |
/* (non-Javadoc) |
|
136 |
* @see com.iver.cit.gvsig.fmap.layers.layerOperations.Classifiable#getShapeType() |
|
137 |
*/ |
|
138 |
public int getShapeType() throws DriverException { |
|
139 |
return FShape.TEXT; |
|
140 |
} |
|
141 |
|
|
142 |
public ArrayList getLabels() { |
|
143 |
return m_labels; |
|
144 |
} |
|
145 |
public void setLabels(ArrayList m_labels) { |
|
146 |
this.m_labels = m_labels; |
|
147 |
} |
|
148 |
} |
|
0 | 149 |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrRaster.java | ||
---|---|---|
51 | 51 |
public void draw(BufferedImage image, Graphics2D g, ViewPort vp, |
52 | 52 |
Cancellable cancel) throws DriverException { |
53 | 53 |
try { |
54 |
((RasterFileAdapter) source).draw(image, g, vp, cancel); |
|
54 |
((RasterFileAdapter) source).draw(image, g, vp, cancel);
|
|
55 | 55 |
} catch (DriverIOException e) { |
56 | 56 |
throw new DriverException(e); |
57 | 57 |
} |
58 |
if (getVirtualLayers() != null) |
|
59 |
getVirtualLayers().draw(image, g, vp, cancel); |
|
58 | 60 |
} |
59 | 61 |
|
60 | 62 |
public void setProjection(IProjection proj) { |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLayers.java | ||
---|---|---|
276 | 276 |
lyr.draw(image, g, viewPort, cancel); |
277 | 277 |
} |
278 | 278 |
} |
279 |
if (getVirtualLayers() != null) |
|
280 |
getVirtualLayers().draw(image, g, viewPort, cancel); |
|
279 | 281 |
} |
280 | 282 |
|
281 | 283 |
/** |
Also available in: Unified diff