gvsig-3d / 2.1 / trunk / org.gvsig.view3d / org.gvsig.view3d.vector / org.gvsig.view3d.vector.lib / org.gvsig.view3d.vector.lib.impl / src / main / java / org / gvsig / view3d / vector / lib / impl / extrusion / DefaultVectorExtrusionLoader.java @ 774
History | View | Annotate | Download (2.7 KB)
1 | 773 | llmarques | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | *
|
||
4 | * Copyright ? 2007-2017 gvSIG Association
|
||
5 | *
|
||
6 | * This program is free software; you can redistribute it and/or
|
||
7 | * modify it under the terms of the GNU General Public License
|
||
8 | * as published by the Free Software Foundation; either version 2
|
||
9 | * of the License, or (at your option) any later version.
|
||
10 | *
|
||
11 | * This program is distributed in the hope that it will be useful,
|
||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
14 | * GNU General Public License for more details.
|
||
15 | *
|
||
16 | * You should have received a copy of the GNU General Public License
|
||
17 | * along with this program; if not, write to the Free Software
|
||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||
19 | * MA 02110-1301, USA.
|
||
20 | *
|
||
21 | * For any additional information, do not hesitate to contact us
|
||
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | */
|
||
24 | 761 | llmarques | package org.gvsig.view3d.vector.lib.impl.extrusion; |
25 | 759 | llmarques | |
26 | 761 | llmarques | import org.gvsig.fmap.dal.feature.FeatureStore; |
27 | import org.gvsig.fmap.mapcontext.layers.FLayer; |
||
28 | import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
||
29 | import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend; |
||
30 | 759 | llmarques | import org.gvsig.view3d.lib.api.exception.LoadException; |
31 | import org.gvsig.view3d.lib.api.loader.Loader; |
||
32 | import org.gvsig.view3d.lib.api.loader.LoaderParameters; |
||
33 | 761 | llmarques | import org.gvsig.view3d.vector.lib.api.VectorExtrusionLoaderParameters; |
34 | 774 | llmarques | import org.gvsig.view3d.vector.lib.api.VectorLoaderParameters; |
35 | 759 | llmarques | |
36 | /**
|
||
37 | *
|
||
38 | * @author <a href="mailto:lmarques@disid.com">Lluis Marques</a>
|
||
39 | *
|
||
40 | */
|
||
41 | public class DefaultVectorExtrusionLoader implements Loader { |
||
42 | |||
43 | @Override
|
||
44 | public Object load(LoaderParameters parameters) throws LoadException { |
||
45 | 761 | llmarques | |
46 | if (parameters == null) { |
||
47 | throw new IllegalArgumentException("Can not load layer, parameters can not be null"); |
||
48 | } |
||
49 | |||
50 | if (!(parameters instanceof VectorExtrusionLoaderParameters)) { |
||
51 | throw new IllegalArgumentException( |
||
52 | "Can not load layer, parameters must implements VectorExtrusionLoaderParameters interface");
|
||
53 | } |
||
54 | |||
55 | FLayer layer = parameters.getLayer(); |
||
56 | if (!(layer instanceof FLyrVect)) { |
||
57 | throw new IllegalArgumentException("Can not load layer, only vector layers can be load as 'Vector'"); |
||
58 | } |
||
59 | FLyrVect layerVect = (FLyrVect) layer; |
||
60 | FeatureStore featureStore = layerVect.getFeatureStore(); |
||
61 | 774 | llmarques | IVectorLegend legend = null;
|
62 | 761 | llmarques | if (layerVect.getLegend() instanceof IVectorLegend) { |
63 | 774 | llmarques | legend = (IVectorLegend) layerVect.getLegend(); |
64 | 761 | llmarques | } |
65 | 766 | llmarques | |
66 | 774 | llmarques | return new DefaultVectorExtrusionRenderableLayer((VectorLoaderParameters) parameters, featureStore, legend); |
67 | 759 | llmarques | } |
68 | |||
69 | } |