gvsig-raster / org.gvsig.raster / trunk / org.gvsig.raster / org.gvsig.raster.lib / org.gvsig.raster.lib.impl / src / main / java / org / gvsig / raster / impl / datastruct / DefaultDataStructFactory.java @ 2438
History | View | Annotate | Download (5.02 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
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 |
*/
|
22 |
package org.gvsig.raster.impl.datastruct; |
23 |
|
24 |
import java.awt.geom.Dimension2D; |
25 |
import java.awt.geom.Point2D; |
26 |
import java.awt.geom.Rectangle2D; |
27 |
|
28 |
import org.cresques.cts.IProjection; |
29 |
import org.gvsig.fmap.dal.coverage.RasterLibrary; |
30 |
import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
31 |
import org.gvsig.fmap.dal.coverage.datastruct.ColorTableLibrary; |
32 |
import org.gvsig.fmap.dal.coverage.datastruct.DataStructFactory; |
33 |
import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
34 |
import org.gvsig.fmap.dal.coverage.datastruct.GeoPoint; |
35 |
import org.gvsig.fmap.dal.coverage.datastruct.NoData; |
36 |
import org.gvsig.fmap.dal.coverage.datastruct.TransparencyRange; |
37 |
import org.gvsig.fmap.dal.coverage.datastruct.ViewPortData; |
38 |
import org.gvsig.fmap.dal.coverage.store.RasterDataStore; |
39 |
import org.gvsig.fmap.dal.coverage.store.props.ColorInterpretation; |
40 |
import org.gvsig.fmap.dal.coverage.store.props.Transparency; |
41 |
import org.gvsig.raster.impl.datastruct.persistence.DefaultColorTableLibrary; |
42 |
import org.gvsig.raster.impl.store.DefaultRasterStore; |
43 |
import org.gvsig.raster.impl.store.properties.DataStoreColorInterpretation; |
44 |
import org.gvsig.raster.impl.store.properties.DataStoreTransparency; |
45 |
|
46 |
/**
|
47 |
* Factory for data structures
|
48 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
49 |
*
|
50 |
*/
|
51 |
public class DefaultDataStructFactory implements DataStructFactory { |
52 |
|
53 |
public TransparencyRange createTransparencyRange() {
|
54 |
return new TransparencyRangeImpl(); |
55 |
} |
56 |
|
57 |
public Transparency createTransparency(int nBands) { |
58 |
return new DataStoreTransparency(new DataStoreColorInterpretation(nBands)); |
59 |
} |
60 |
|
61 |
public ColorTableLibrary getColorTableLibrary() {
|
62 |
return DefaultColorTableLibrary.getInstance();
|
63 |
} |
64 |
|
65 |
public Extent createExtent(Point2D ul, Point2D lr) { |
66 |
return new ExtentImpl(ul, lr); |
67 |
} |
68 |
|
69 |
public Extent createExtent(Point2D ul, Point2D lr, Point2D ur, Point2D ll) { |
70 |
return new ExtentImpl(ul, lr, ur, ll); |
71 |
} |
72 |
|
73 |
public Extent createExtent(double x1, double y1, double x2, double y2) { |
74 |
return new ExtentImpl(x1, y1, x2, y2); |
75 |
} |
76 |
|
77 |
public Extent createExtent(Rectangle2D r) { |
78 |
return new ExtentImpl(r); |
79 |
} |
80 |
|
81 |
public Extent createExtent() {
|
82 |
return new ExtentImpl(); |
83 |
} |
84 |
|
85 |
public NoData createNoData(Number noData, Number nativeNoData, String fileName, int bandCount) { |
86 |
return new DefaultNoData(noData, nativeNoData, fileName, bandCount); |
87 |
} |
88 |
|
89 |
public NoData createNoData(Number noData, Number nativeNoData, String fileName) { |
90 |
return new DefaultNoData(noData, nativeNoData, fileName); |
91 |
} |
92 |
|
93 |
public NoData createDefaultNoData(int bandCount, int dataType) { |
94 |
switch (dataType) {
|
95 |
case Buffer.TYPE_BYTE: |
96 |
return new DefaultNoData(new Byte(RasterLibrary.defaultByteNoDataValue), new Byte(RasterLibrary.defaultByteNoDataValue), null); |
97 |
case Buffer.TYPE_SHORT: |
98 |
return new DefaultNoData(new Short(RasterLibrary.defaultShortNoDataValue), new Short(RasterLibrary.defaultShortNoDataValue), null); |
99 |
case Buffer.TYPE_INT: |
100 |
return new DefaultNoData(new Integer(RasterLibrary.defaultIntegerNoDataValue), new Integer(RasterLibrary.defaultIntegerNoDataValue), null); |
101 |
case Buffer.TYPE_FLOAT: |
102 |
return new DefaultNoData(new Float(RasterLibrary.defaultFloatNoDataValue), new Float(RasterLibrary.defaultFloatNoDataValue), null); |
103 |
case Buffer.TYPE_DOUBLE: |
104 |
return new DefaultNoData(new Double(RasterLibrary.defaultDoubleNoDataValue), new Double(RasterLibrary.defaultDoubleNoDataValue), null); |
105 |
} |
106 |
return null; |
107 |
} |
108 |
|
109 |
public RasterDataStore createDataStore() {
|
110 |
return new DefaultRasterStore(); |
111 |
} |
112 |
|
113 |
public GeoPoint createGeoPoint() {
|
114 |
return new GeoPointImpl(); |
115 |
} |
116 |
|
117 |
public GeoPoint createGeoPoint(Point2D p, Point2D m) { |
118 |
return new GeoPointImpl(p, m); |
119 |
} |
120 |
|
121 |
public ColorInterpretation createColorInterpretation(String[] colorInterp) { |
122 |
return new DataStoreColorInterpretation(colorInterp); |
123 |
} |
124 |
|
125 |
public ColorInterpretation createColorInterpretation(String colorInterpretationConstant) { |
126 |
return new DataStoreColorInterpretation(colorInterpretationConstant); |
127 |
} |
128 |
|
129 |
public ViewPortData createViewPortData(IProjection proj, Extent extent,
|
130 |
Dimension2D size) {
|
131 |
return new DefaultViewPortData(proj, extent, size); |
132 |
} |
133 |
|
134 |
public ViewPortData createViewPortData() {
|
135 |
return new DefaultViewPortData(); |
136 |
} |
137 |
} |