Revision 22630 trunk/libraries/lib3DMap-share/src/main/java/com/iver/ai2/gvsig3d/map3d/layers/Layer3DProps.java
Layer3DProps.java | ||
---|---|---|
40 | 40 |
public static final int layer3DElevation = 1; |
41 | 41 |
public static final int layer3DVector = 2; |
42 | 42 |
public static final int layer3DOSG = 3; |
43 |
|
|
44 |
private boolean newLayerOSG = false; |
|
43 | 45 |
|
44 |
|
|
45 | 46 |
// public static String m_cacheDir = "c:/data/cache"; // TEST |
46 | 47 |
// Create a .data directorio in user home for caching elements |
47 | 48 |
public static String m_cacheDir = System.getProperty("user.home") |
... | ... | |
49 | 50 |
|
50 | 51 |
protected int m_tocOrder; // index of layer in TOC (drawing priority) |
51 | 52 |
protected int m_planetOrder; // current stage of layer in planet. |
52 |
// Can be temporarily different from the TOC order while moving groups of layers |
|
53 |
// Can be temporarily different from the TOC order while moving groups of |
|
54 |
// layers |
|
53 | 55 |
|
54 | 56 |
protected float m_opacity = 1.0f; // Opacity of layer default 1.0 |
55 | 57 |
protected float m_verticalEx = 10.0f; // Opacity of layer default 1.0 |
... | ... | |
59 | 61 |
protected FLayer m_layer; |
60 | 62 |
protected CacheService m_cacheService; |
61 | 63 |
private boolean m_bChooseType = true; |
62 |
|
|
64 |
|
|
63 | 65 |
private boolean m_Zenable = false; |
64 |
|
|
65 |
// used by FLayers3D (3D group layer) to flag when they are actually hooked to TOC or not |
|
66 |
private boolean m_hooked = false; |
|
67 | 66 |
|
67 |
// used by FLayers3D (3D group layer) to flag when they are actually hooked |
|
68 |
// to TOC or not |
|
69 |
private boolean m_hooked = false; |
|
70 |
|
|
68 | 71 |
private int option; |
69 | 72 |
|
70 | 73 |
private VectorLayerMenu vectorLayerMenu; |
... | ... | |
91 | 94 |
public void setChooseType(boolean bChoose) { |
92 | 95 |
m_bChooseType = bChoose; |
93 | 96 |
} |
94 |
|
|
97 |
|
|
95 | 98 |
public boolean getHooked() { |
96 | 99 |
return m_hooked; |
97 | 100 |
} |
98 |
|
|
101 |
|
|
99 | 102 |
public void setHooked(boolean hooked) { |
100 | 103 |
m_hooked = hooked; |
101 | 104 |
} |
... | ... | |
112 | 115 |
m_bChooseType = false; |
113 | 116 |
m_type = layer3DImage; |
114 | 117 |
boolean bCanBeElev = false; |
115 |
|
|
118 |
|
|
116 | 119 |
// TODO Un toggle this comment to use WMS extensions |
117 | 120 |
|
118 | 121 |
if (layer instanceof FLyrWMS) { |
119 | 122 |
FLyrWMS wmsLayer = (FLyrWMS) layer; |
120 | 123 |
String format = wmsLayer.getFormat(); |
121 |
if (format.regionMatches(true, 0, "image/geotiff", 0, 13) ||
|
|
122 |
format.regionMatches(true, 0, "image/tiff", 0, 10))
|
|
124 |
if (format.regionMatches(true, 0, "image/geotiff", 0, 13) |
|
125 |
|| format.regionMatches(true, 0, "image/tiff", 0, 10))
|
|
123 | 126 |
bCanBeElev = true; |
124 | 127 |
} else if (layer instanceof FLyrWCS) { |
125 | 128 |
FLyrWCS wcsLayer = (FLyrWCS) layer; |
... | ... | |
131 | 134 |
bCanBeElev = true; |
132 | 135 |
} |
133 | 136 |
// FEATURES |
134 |
else /**/ if (layer instanceof ClassifiableVectorial) {
|
|
137 |
else /**/if (layer instanceof ClassifiableVectorial) { |
|
135 | 138 |
|
136 |
vectorLayerMenu = new VectorLayerMenu(this,layer.getName()); |
|
137 |
vectorLayerMenu.setModal(true); |
|
138 |
vectorLayerMenu.pack(); |
|
139 |
vectorLayerMenu.setVisible(true); |
|
140 |
|
|
141 |
|
|
142 |
// PluginServices.getMDIManager().addWindow(vectorLayerMenu); |
|
143 |
|
|
139 |
if (this.getType() != layer3DOSG) { |
|
140 |
vectorLayerMenu = new VectorLayerMenu(this, layer.getName()); |
|
141 |
vectorLayerMenu.setModal(true); |
|
142 |
vectorLayerMenu.pack(); |
|
143 |
vectorLayerMenu.setVisible(true); |
|
144 |
} |
|
144 | 145 |
|
145 |
// // choose rasterization of 3D |
|
146 |
// option = JOptionPane.showConfirmDialog( |
|
147 |
// (Component) PluginServices.getMainFrame(), |
|
148 |
// PluginServices |
|
149 |
// .getText(this, "Rasterize_layer_question"), |
|
150 |
// PluginServices.getText(this, "Layer_options"), |
|
151 |
// JOptionPane.YES_NO_OPTION); |
|
152 |
// |
|
153 |
// if (option == JOptionPane.YES_OPTION) |
|
154 |
// m_type = layer3DImage; |
|
155 |
// else |
|
156 |
// m_type = layer3DVector; |
|
157 |
// |
|
158 |
// if (m_type == layer3DVector) { |
|
159 |
// String Altura = JOptionPane.showInputDialog(PluginServices |
|
160 |
// .getText(this, PluginServices.getText(this, |
|
161 |
// "Heigth_layer_question")), "1000"); |
|
162 |
// |
|
163 |
// if (Altura != null) { |
|
164 |
// int h = Integer.parseInt(Altura); |
|
165 |
// if (h >= 0) |
|
166 |
// m_heigth = h; |
|
167 |
// } |
|
168 |
// } |
|
146 |
// PluginServices.getMDIManager().addWindow(vectorLayerMenu); |
|
169 | 147 |
|
148 |
// // choose rasterization of 3D |
|
149 |
// option = JOptionPane.showConfirmDialog( |
|
150 |
// (Component) PluginServices.getMainFrame(), |
|
151 |
// PluginServices |
|
152 |
// .getText(this, "Rasterize_layer_question"), |
|
153 |
// PluginServices.getText(this, "Layer_options"), |
|
154 |
// JOptionPane.YES_NO_OPTION); |
|
155 |
// |
|
156 |
// if (option == JOptionPane.YES_OPTION) |
|
157 |
// m_type = layer3DImage; |
|
158 |
// else |
|
159 |
// m_type = layer3DVector; |
|
160 |
// |
|
161 |
// if (m_type == layer3DVector) { |
|
162 |
// String Altura = JOptionPane.showInputDialog(PluginServices |
|
163 |
// .getText(this, PluginServices.getText(this, |
|
164 |
// "Heigth_layer_question")), "1000"); |
|
165 |
// |
|
166 |
// if (Altura != null) { |
|
167 |
// int h = Integer.parseInt(Altura); |
|
168 |
// if (h >= 0) |
|
169 |
// m_heigth = h; |
|
170 |
// } |
|
171 |
// } |
|
172 |
|
|
170 | 173 |
} else if (layer instanceof FLyrRasterSE) { |
171 | 174 |
FLyrRasterSE rasterLayer = (FLyrRasterSE) layer; |
172 | 175 |
if (rasterLayer.getBandCount() == 1) |
173 | 176 |
bCanBeElev = true; |
174 |
|
|
177 |
|
|
175 | 178 |
} |
176 | 179 |
|
177 | 180 |
if (m_type == layer3DImage && bCanBeElev) { |
... | ... | |
189 | 192 |
} |
190 | 193 |
} |
191 | 194 |
|
192 |
public void initCacheName(int planetType, IProjection viewProj,int geocentricCoordinates) { |
|
195 |
public void initCacheName(int planetType, IProjection viewProj, |
|
196 |
int geocentricCoordinates) { |
|
193 | 197 |
// TODO: use full path of source or service, not just layer name |
194 | 198 |
|
195 | 199 |
String typeStr; |
... | ... | |
205 | 209 |
|
206 | 210 |
String layerInfo = m_layer.getName(); |
207 | 211 |
// TODO Un toggle this comment to use WMS extension |
208 |
|
|
212 |
|
|
209 | 213 |
if (m_layer instanceof FLyrWMS) { |
210 | 214 |
FLyrWMS wmsLayer = (FLyrWMS) m_layer; |
211 | 215 |
|
... | ... | |
283 | 287 |
public int getTocOrder() { |
284 | 288 |
return m_tocOrder; |
285 | 289 |
} |
286 |
|
|
290 |
|
|
287 | 291 |
public void setPlanetOrder(int order) { |
288 | 292 |
m_planetOrder = order; |
289 | 293 |
} |
... | ... | |
306 | 310 |
NotificationManager.addInfo(m_cacheDir, null); |
307 | 311 |
if (m_layer instanceof Classifiable) { |
308 | 312 |
Classifiable legendLyr = (Classifiable) m_layer; |
309 |
String cacheFolder = m_cacheDir + "/" + planetName |
|
310 |
+ "/" + m_cacheName;
|
|
313 |
String cacheFolder = m_cacheDir + "/" + planetName + "/"
|
|
314 |
+ m_cacheName; |
|
311 | 315 |
File cacheFolderFile = new File(cacheFolder); |
312 | 316 |
if (!cacheFolderFile.exists()) |
313 | 317 |
cacheFolderFile.mkdir(); |
... | ... | |
328 | 332 |
XMLEntity legendXml = new XMLEntity(tag); |
329 | 333 |
ILegend legend = LegendFactory.createFromXML(legendXml); |
330 | 334 |
if (m_layer instanceof FLyrVect) { |
331 |
((FLyrVect) m_layer) |
|
332 |
.setLegend((IVectorLegend) legend); |
|
335 |
((FLyrVect) m_layer).setLegend((IVectorLegend) legend); |
|
333 | 336 |
} |
334 | 337 |
|
335 | 338 |
} catch (Exception e) { |
... | ... | |
422 | 425 |
m_Zenable = zenable; |
423 | 426 |
} |
424 | 427 |
|
428 |
public boolean isNewLayerOSG() { |
|
429 |
return newLayerOSG; |
|
430 |
} |
|
431 |
|
|
432 |
public void setNewLayerOSG(boolean newLayerOSG) { |
|
433 |
this.newLayerOSG = newLayerOSG; |
|
434 |
} |
|
435 |
|
|
425 | 436 |
} |
Also available in: Unified diff