gvsig-3d / 2.1 / trunk / org.gvsig.view3d / org.gvsig.view3d.lib / org.gvsig.view3d.lib.impl / src / main / java / org / gvsig / view3d / lib / impl / DefaultView3DManger.java @ 496
History | View | Annotate | Download (3.68 KB)
1 |
/**
|
---|---|
2 |
*
|
3 |
* Copyright ? 2007-2015 gvSIG Association
|
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., 51 Franklin Street, Fifth Floor, Boston,
|
18 |
* MA 02110-1301, USA.
|
19 |
*
|
20 |
* For any additional information, do not hesitate to contact us
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
22 |
*/
|
23 |
|
24 |
package org.gvsig.view3d.lib.impl; |
25 |
|
26 |
import org.gvsig.fmap.mapcontext.layers.ExtendedPropertiesSupport; |
27 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
28 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
29 |
import org.gvsig.view3d.lib.api.View3DManager; |
30 |
import org.gvsig.view3d.lib.api.properties.GeneralProperties3D; |
31 |
import org.gvsig.view3d.lib.api.properties.LayerProperties3D; |
32 |
import org.gvsig.view3d.lib.api.properties.MapControlProperties3D; |
33 |
import org.gvsig.view3d.lib.impl.properties.DefaultGeneralProperties3D; |
34 |
import org.gvsig.view3d.lib.impl.properties.DefaultMapControlProperties3D; |
35 |
import org.gvsig.view3d.lib.impl.properties.DefaultRasterLayerProperties3D; |
36 |
import org.gvsig.view3d.lib.impl.properties.DefaultVectorialLayerProperties3D; |
37 |
|
38 |
|
39 |
/**
|
40 |
* @author <a href="mailto:lmarques@disid.com">Lluis Marques</a>
|
41 |
*
|
42 |
*/
|
43 |
public class DefaultView3DManger implements View3DManager { |
44 |
|
45 |
private GeneralProperties3D generalProperties;
|
46 |
|
47 |
public LayerProperties3D getLayerProperties(FLayer layer) {
|
48 |
Object properties = layer.getProperty("properties3D"); |
49 |
if(properties == null){ |
50 |
LayerProperties3D layerProperties; |
51 |
if(layer instanceof FLyrVect){ |
52 |
layerProperties = |
53 |
new DefaultVectorialLayerProperties3D();
|
54 |
} else {
|
55 |
layerProperties = new DefaultRasterLayerProperties3D();
|
56 |
} |
57 |
setLayerProperties(layer, layerProperties); |
58 |
return layerProperties;
|
59 |
} |
60 |
return (LayerProperties3D) properties;
|
61 |
} |
62 |
|
63 |
public void setLayerProperties(FLayer layer, LayerProperties3D properties) { |
64 |
layer.setProperty("properties3D", properties);
|
65 |
} |
66 |
|
67 |
public MapControlProperties3D getMapControl3DProperties(
|
68 |
ExtendedPropertiesSupport viewProperties) { |
69 |
|
70 |
MapControlProperties3D properties = |
71 |
(MapControlProperties3D) viewProperties |
72 |
.getProperty("mapControl3DProperties");
|
73 |
|
74 |
if(properties == null){ |
75 |
properties = new DefaultMapControlProperties3D();
|
76 |
setMapControlProperties3D(viewProperties, properties); |
77 |
} |
78 |
|
79 |
return properties;
|
80 |
} |
81 |
|
82 |
public void setMapControlProperties3D( |
83 |
ExtendedPropertiesSupport viewProperties, |
84 |
MapControlProperties3D mapControl3DProperties) { |
85 |
|
86 |
viewProperties.setProperty("mapControl3DProperties",
|
87 |
mapControl3DProperties); |
88 |
} |
89 |
|
90 |
public GeneralProperties3D getGeneral3DProperties() {
|
91 |
if(generalProperties == null){ |
92 |
generalProperties = new DefaultGeneralProperties3D();
|
93 |
} |
94 |
return generalProperties;
|
95 |
} |
96 |
|
97 |
public void setGeneral3DProperties(GeneralProperties3D properties) { |
98 |
if(properties != null){ |
99 |
this.generalProperties = properties;
|
100 |
} |
101 |
|
102 |
} |
103 |
|
104 |
} |