svn-gvsig-desktop / branches / org.gvsig.desktop-2018a / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.mapcontext / org.gvsig.fmap.mapcontext.impl / src / main / java / org / gvsig / fmap / mapcontext / raster / impl / MapContextRasterLibrary.java @ 43876
History | View | Annotate | Download (7.12 KB)
1 | 43803 | fdiaz | /* gvSIG. Desktop Geographic Information System.
|
---|---|---|---|
2 | *
|
||
3 | * Copyright ? 2007-2016 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 | package org.gvsig.fmap.mapcontext.raster.impl; |
||
24 | |||
25 | import org.slf4j.Logger; |
||
26 | import org.slf4j.LoggerFactory; |
||
27 | |||
28 | import org.gvsig.compat.CompatLibrary; |
||
29 | import org.gvsig.fmap.dal.DALLibrary; |
||
30 | 43876 | jjdelcerro | import org.gvsig.fmap.dal.raster.RasterStore; |
31 | 43803 | fdiaz | import org.gvsig.fmap.mapcontext.MapContextLibrary; |
32 | 43861 | jjdelcerro | import org.gvsig.fmap.mapcontext.MapContextLocator; |
33 | import org.gvsig.fmap.mapcontext.MapContextManager; |
||
34 | 43803 | fdiaz | import org.gvsig.fmap.mapcontext.layers.LayerFactory; |
35 | import org.gvsig.raster.lib.buffer.api.BufferLocator; |
||
36 | import org.gvsig.raster.lib.buffer.api.OperationManager; |
||
37 | import org.gvsig.raster.lib.legend.api.RasterLegendLocator; |
||
38 | import org.gvsig.raster.lib.legend.api.RasterLegendManager; |
||
39 | import org.gvsig.raster.lib.legend.impl.DefaultColorInterpretation; |
||
40 | import org.gvsig.raster.lib.legend.impl.DefaultColorTable; |
||
41 | import org.gvsig.raster.lib.legend.impl.DefaultColorTableClass; |
||
42 | import org.gvsig.raster.lib.legend.impl.DefaultRasterLegend; |
||
43 | import org.gvsig.raster.lib.legend.impl.DefaultRasterLegendManager; |
||
44 | import org.gvsig.raster.lib.legend.impl.DefaultTransparency; |
||
45 | import org.gvsig.raster.lib.legend.impl.DefaultTransparencyRange; |
||
46 | import org.gvsig.raster.lib.legend.impl.io.GimpGradientColorTableIO; |
||
47 | import org.gvsig.raster.lib.legend.impl.io.GimpGradientColorTableIOFactory; |
||
48 | import org.gvsig.raster.lib.legend.impl.io.GimpPaletteColorTableIO; |
||
49 | import org.gvsig.raster.lib.legend.impl.io.GimpPaletteColorTableIOFactory; |
||
50 | import org.gvsig.raster.lib.legend.impl.io.gvSIGColorTableIO; |
||
51 | import org.gvsig.raster.lib.legend.impl.io.gvSIGColorTableIOFactory; |
||
52 | import org.gvsig.raster.lib.legend.impl.operations.brightness.BrightnessOperationFactory; |
||
53 | import org.gvsig.raster.lib.legend.impl.operations.cmyktorgb.CMYKToRGBOperationFactory; |
||
54 | import org.gvsig.raster.lib.legend.impl.operations.colorbalancecmy.ColorBalanceCMYOperationFactory; |
||
55 | import org.gvsig.raster.lib.legend.impl.operations.colorbalancehsl.ColorBalanceHSLOperationFactory; |
||
56 | import org.gvsig.raster.lib.legend.impl.operations.colorbalancergb.ColorBalanceRGBOperationFactory; |
||
57 | import org.gvsig.raster.lib.legend.impl.operations.colortable.ColorTableOperationFactory; |
||
58 | import org.gvsig.raster.lib.legend.impl.operations.contrast.ContrastOperationFactory; |
||
59 | import org.gvsig.raster.lib.legend.impl.operations.equalization.EqualizationOperationFactory; |
||
60 | import org.gvsig.raster.lib.legend.impl.operations.grayscale.GrayScaleOperationFactory; |
||
61 | import org.gvsig.raster.lib.legend.impl.operations.hsltorgb.HSLToRGBOperationFactory; |
||
62 | import org.gvsig.raster.lib.legend.impl.operations.rgbtocmyk.RGBToCMYKOperationFactory; |
||
63 | import org.gvsig.raster.lib.legend.impl.operations.rgbtohsl.RGBToHSLOperationFactory; |
||
64 | import org.gvsig.tools.library.AbstractLibrary; |
||
65 | import org.gvsig.tools.library.LibraryException; |
||
66 | import org.gvsig.tools.util.Caller; |
||
67 | import org.gvsig.tools.util.impl.DefaultCaller; |
||
68 | |||
69 | /**
|
||
70 | * Library used to initialize Raster Layer.
|
||
71 | * Probably should be integrated in MapContextLibrary
|
||
72 | *
|
||
73 | */
|
||
74 | public class MapContextRasterLibrary extends AbstractLibrary { |
||
75 | final static private Logger LOG = LoggerFactory.getLogger(MapContextRasterLibrary.class); |
||
76 | |||
77 | 43861 | jjdelcerro | @Override
|
78 | 43803 | fdiaz | public void doRegistration() { |
79 | registerAsAPI(MapContextRasterLibrary.class); |
||
80 | require(DALLibrary.class); |
||
81 | require(CompatLibrary.class); |
||
82 | } |
||
83 | |||
84 | 43861 | jjdelcerro | @Override
|
85 | 43803 | fdiaz | protected void doInitialize() throws LibraryException { |
86 | LayerFactory.getInstance().registerLayerToUseForStore( |
||
87 | RasterStore.class, DefaultRasterLayer.class); |
||
88 | RasterLegendLocator.registerRasterLegendManager(DefaultRasterLegendManager.class); |
||
89 | |||
90 | } |
||
91 | |||
92 | 43861 | jjdelcerro | @Override
|
93 | 43803 | fdiaz | protected void doPostInitialize() throws LibraryException { |
94 | Caller caller = new DefaultCaller();
|
||
95 | caller.add( new DefaultRasterLayer.RegisterPersistence() );
|
||
96 | |||
97 | if( !caller.call() ) {
|
||
98 | throw new LibraryException(MapContextLibrary.class, caller.getExceptions()); |
||
99 | } |
||
100 | |||
101 | // Register persistent definition
|
||
102 | DefaultColorTableClass.registerPersistence(); |
||
103 | DefaultColorTable.registerPersistence(); |
||
104 | DefaultColorInterpretation.registerPersistence(); |
||
105 | DefaultRasterLegend.registerPersistence(); |
||
106 | DefaultTransparency.registerPersistence(); |
||
107 | DefaultTransparencyRange.registerPersistence(); |
||
108 | |||
109 | // Register ColorTableIO factories
|
||
110 | RasterLegendManager rasterLegendManager = RasterLegendLocator.getRasterLegendManager(); |
||
111 | rasterLegendManager.registerColorTableIOFactory(gvSIGColorTableIO.NAME, |
||
112 | new gvSIGColorTableIOFactory());
|
||
113 | rasterLegendManager.registerColorTableIOFactory(GimpGradientColorTableIO.NAME, |
||
114 | new GimpGradientColorTableIOFactory());
|
||
115 | rasterLegendManager.registerColorTableIOFactory(GimpPaletteColorTableIO.NAME, |
||
116 | new GimpPaletteColorTableIOFactory());
|
||
117 | |||
118 | OperationManager operationManager = BufferLocator.getOperationManager(); |
||
119 | operationManager.registerOperationFactory(new BrightnessOperationFactory());
|
||
120 | operationManager.registerOperationFactory(new ContrastOperationFactory());
|
||
121 | operationManager.registerOperationFactory(new GrayScaleOperationFactory());
|
||
122 | |||
123 | operationManager.registerOperationFactory(new ColorBalanceRGBOperationFactory());
|
||
124 | operationManager.registerOperationFactory(new ColorBalanceCMYOperationFactory());
|
||
125 | operationManager.registerOperationFactory(new ColorBalanceHSLOperationFactory());
|
||
126 | |||
127 | operationManager.registerOperationFactory(new RGBToCMYKOperationFactory());
|
||
128 | operationManager.registerOperationFactory(new RGBToHSLOperationFactory());
|
||
129 | operationManager.registerOperationFactory(new HSLToRGBOperationFactory());
|
||
130 | operationManager.registerOperationFactory(new CMYKToRGBOperationFactory());
|
||
131 | |||
132 | operationManager.registerOperationFactory(new EqualizationOperationFactory());
|
||
133 | // BufferLocator.getBufferManager().registerOperationFactory(new PansharpeningOperationFactory());
|
||
134 | |||
135 | operationManager.registerOperationFactory(new ColorTableOperationFactory());
|
||
136 | |||
137 | 43861 | jjdelcerro | MapContextManager mapContextManager = MapContextLocator.getMapContextManager(); |
138 | mapContextManager.registerLegend( |
||
139 | DefaultRasterLegend.LEGEND_NAME, |
||
140 | DefaultRasterLegend.class); |
||
141 | mapContextManager.setDefaultRasterLegend(DefaultRasterLegend.LEGEND_NAME); |
||
142 | 43803 | fdiaz | |
143 | |||
144 | } |
||
145 | |||
146 | } |