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 @ 723
History | View | Annotate | Download (4.88 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.Point2D; |
25 |
import java.awt.geom.Rectangle2D; |
26 |
|
27 |
import org.gvsig.fmap.dal.coverage.datastruct.ColorTableLibrary; |
28 |
import org.gvsig.fmap.dal.coverage.datastruct.DataStructFactory; |
29 |
import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
30 |
import org.gvsig.fmap.dal.coverage.datastruct.NoData; |
31 |
import org.gvsig.fmap.dal.coverage.datastruct.TransparencyRange; |
32 |
import org.gvsig.fmap.dal.coverage.grid.GridTransparency; |
33 |
import org.gvsig.fmap.dal.coverage.store.props.Transparency; |
34 |
import org.gvsig.raster.impl.datastruct.persistence.DefaultColorTableLibrary; |
35 |
import org.gvsig.raster.impl.grid.GridTransparencyImpl; |
36 |
|
37 |
/**
|
38 |
* Factory for data structures
|
39 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
40 |
*
|
41 |
*/
|
42 |
public class DefaultDataStructFactory implements DataStructFactory { |
43 |
|
44 |
/*
|
45 |
* (non-Javadoc)
|
46 |
* @see org.gvsig.fmap.dal.coverage.datastruct.DataStructFactory#createTransparencyRange()
|
47 |
*/
|
48 |
public TransparencyRange createTransparencyRange() {
|
49 |
return new TransparencyRangeImpl(); |
50 |
} |
51 |
|
52 |
/*
|
53 |
* (non-Javadoc)
|
54 |
* @see org.gvsig.fmap.dal.coverage.datastruct.DataStructFactory#createGridTransparency(org.gvsig.fmap.dal.coverage.store.props.Transparency)
|
55 |
*/
|
56 |
public GridTransparency createGridTransparency(Transparency t) { |
57 |
return new GridTransparencyImpl(t); |
58 |
} |
59 |
|
60 |
/*
|
61 |
* (non-Javadoc)
|
62 |
* @see org.gvsig.fmap.dal.coverage.datastruct.DataStructFactory#getColorTableLibrary()
|
63 |
*/
|
64 |
public ColorTableLibrary getColorTableLibrary() {
|
65 |
return DefaultColorTableLibrary.getInstance();
|
66 |
} |
67 |
|
68 |
/*
|
69 |
* (non-Javadoc)
|
70 |
* @see org.gvsig.fmap.dal.coverage.datastruct.DataStructFactory#createExtent(java.awt.geom.Point2D, java.awt.geom.Point2D)
|
71 |
*/
|
72 |
public Extent createExtent(Point2D ul, Point2D lr) { |
73 |
return new ExtentImpl(ul, lr); |
74 |
} |
75 |
|
76 |
/*
|
77 |
* (non-Javadoc)
|
78 |
* @see org.gvsig.fmap.dal.coverage.datastruct.DataStructFactory#createExtent(java.awt.geom.Point2D, java.awt.geom.Point2D, java.awt.geom.Point2D, java.awt.geom.Point2D)
|
79 |
*/
|
80 |
public Extent createExtent(Point2D ul, Point2D lr, Point2D ur, Point2D ll) { |
81 |
return new ExtentImpl(ul, lr, ur, ll); |
82 |
} |
83 |
|
84 |
/*
|
85 |
* (non-Javadoc)
|
86 |
* @see org.gvsig.fmap.dal.coverage.datastruct.DataStructFactory#createExtent(double, double, double, double)
|
87 |
*/
|
88 |
public Extent createExtent(double x1, double y1, double x2, double y2) { |
89 |
return new ExtentImpl(x1, y1, x2, y2); |
90 |
} |
91 |
|
92 |
/*
|
93 |
* (non-Javadoc)
|
94 |
* @see org.gvsig.fmap.dal.coverage.datastruct.DataStructFactory#createExtent(java.awt.geom.Rectangle2D)
|
95 |
*/
|
96 |
public Extent createExtent(Rectangle2D r) { |
97 |
return new ExtentImpl(r); |
98 |
} |
99 |
|
100 |
/*
|
101 |
* (non-Javadoc)
|
102 |
* @see org.gvsig.fmap.dal.coverage.datastruct.DataStructFactory#createExtent()
|
103 |
*/
|
104 |
public Extent createExtent() {
|
105 |
return new ExtentImpl(); |
106 |
} |
107 |
|
108 |
/*
|
109 |
* (non-Javadoc)
|
110 |
* @see org.gvsig.fmap.dal.coverage.datastruct.DataStructFactory#createNoData(double, int, int)
|
111 |
*/
|
112 |
public NoData createNoData(double noData, int type, int dataType) { |
113 |
return new DefaultNoData(noData, type, dataType); |
114 |
} |
115 |
|
116 |
/*
|
117 |
* (non-Javadoc)
|
118 |
* @see org.gvsig.fmap.dal.coverage.datastruct.DataStructFactory#loadStatisticsFromStore(org.gvsig.fmap.dal.coverage.store.RasterDataStore)
|
119 |
*/
|
120 |
/*public Statistics loadStatisticsFromStore(RasterDataStore store) throws RmfSerializerException {
|
121 |
SimpleProviderStatistics[] stats = new SimpleProviderStatistics[store.getProviderCount()];
|
122 |
|
123 |
RasterProvider prov = (RasterProvider)store.getProvider();
|
124 |
|
125 |
for (int i = 0; i < prov.getInternalProviderCount(); i++) {
|
126 |
Statistics statFile = prov.getInternalProvider(i).getStatistics();
|
127 |
stats[i] = (SimpleProviderStatistics)prov.getInternalProvider(i).loadObjectFromRmf(Statistics.class, statFile);
|
128 |
|
129 |
//Con que un dataset no tenga la estadistica calculada se pone a no calculado el DatasetListStatistics
|
130 |
if(!stats[i].isCalculated())
|
131 |
return null;
|
132 |
}
|
133 |
MultiProviderStatistics result = new MultiProviderStatistics(stats, prov.getBandCount());
|
134 |
result.setCalculated(true);
|
135 |
return result;
|
136 |
}*/
|
137 |
|
138 |
} |