Revision 6298
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.app/org.gvsig.raster.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
33 | 33 |
<include>org.gvsig:org.gvsig.raster.lib.buffer.spi</include> |
34 | 34 |
<include>org.gvsig:org.gvsig.raster.lib.legend.api</include> |
35 | 35 |
<include>org.gvsig:org.gvsig.raster.lib.legend.impl</include> |
36 |
<include>org.gvsig:org.gvsig.raster.lib.legend.spi</include> |
|
37 | 36 |
<include>org.gvsig:org.gvsig.fmap.dal.raster.api</include> |
38 | 37 |
<include>org.gvsig:org.gvsig.fmap.dal.raster.impl</include> |
39 | 38 |
<include>org.gvsig:org.gvsig.fmap.dal.raster.spi</include> |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.app/org.gvsig.raster.app.mainplugin/pom.xml | ||
---|---|---|
40 | 40 |
</dependency> |
41 | 41 |
<dependency> |
42 | 42 |
<groupId>org.gvsig</groupId> |
43 |
<artifactId>org.gvsig.raster.lib.legend.spi</artifactId> |
|
44 |
</dependency> |
|
45 |
<dependency> |
|
46 |
<groupId>org.gvsig</groupId> |
|
47 | 43 |
<artifactId>org.gvsig.raster.lib.legend.impl</artifactId> |
48 | 44 |
</dependency> |
49 | 45 |
<dependency> |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.fmap.dal.raster/org.gvsig.fmap.dal.raster.spi/src/main/java/org/gvsig/fmap/dal/raster/spi/RasterStoreProviderServices.java | ||
---|---|---|
22 | 22 |
*/ |
23 | 23 |
package org.gvsig.fmap.dal.raster.spi; |
24 | 24 |
|
25 |
import org.gvsig.fmap.dal.DataManager; |
|
26 |
import org.gvsig.fmap.dal.raster.api.RasterStore; |
|
27 |
import org.gvsig.fmap.dal.resource.Resource; |
|
25 | 28 |
import org.gvsig.fmap.dal.resource.spi.ResourceProvider; |
26 | 29 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
27 | 30 |
|
... | ... | |
39 | 42 |
*/ |
40 | 43 |
public void notifyChange(String notification, ResourceProvider data); |
41 | 44 |
|
45 |
|
|
46 |
/** |
|
47 |
* Call this to send a notification to observers of this store relative to |
|
48 |
* Resources |
|
49 |
* |
|
50 |
* @param notification |
|
51 |
*/ |
|
52 |
public void notifyChange(String notification, Resource resource); |
|
53 |
|
|
54 |
|
|
55 |
/** |
|
56 |
* Reaturn {@link DataManager} instance. |
|
57 |
* |
|
58 |
* @return |
|
59 |
*/ |
|
60 |
public DataManager getManager(); |
|
61 |
|
|
62 |
|
|
63 |
/** |
|
64 |
* Return the instance of {@link RasterStoreProvider} for this store. |
|
65 |
* |
|
66 |
* @return |
|
67 |
*/ |
|
68 |
public RasterStoreProvider getProvider(); |
|
69 |
|
|
70 |
|
|
71 |
/** |
|
72 |
* Return current RasterStore |
|
73 |
* |
|
74 |
* @return |
|
75 |
*/ |
|
76 |
public RasterStore getRasterStore(); |
|
77 |
|
|
78 |
/** |
|
79 |
* Return current FeatureStore name. |
|
80 |
* |
|
81 |
* @return |
|
82 |
*/ |
|
83 |
public String getName(); |
|
84 |
|
|
42 | 85 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.fmap.dal.raster/org.gvsig.fmap.dal.raster.impl/src/main/java/org/gvsig/fmap/dal/raster/impl/DefaultRasterStore.java | ||
---|---|---|
47 | 47 |
import org.gvsig.fmap.dal.raster.api.RasterStoreNotification; |
48 | 48 |
import org.gvsig.fmap.dal.raster.spi.RasterStoreProvider; |
49 | 49 |
import org.gvsig.fmap.dal.raster.spi.RasterStoreProviderServices; |
50 |
import org.gvsig.fmap.dal.resource.Resource; |
|
50 | 51 |
import org.gvsig.fmap.dal.resource.spi.ResourceProvider; |
51 | 52 |
import org.gvsig.fmap.dal.spi.DataStoreInitializer; |
52 | 53 |
import org.gvsig.fmap.dal.spi.DataStoreProvider; |
... | ... | |
87 | 88 |
.getLogger(DefaultRasterStore.class); |
88 | 89 |
|
89 | 90 |
private static final String PERSISTENCE_DEFINITION_NAME = "RasterStore"; |
91 |
private static final String METADATA_DEFINITION_NAME= "RasterStore"; |
|
90 | 92 |
|
91 | 93 |
private DataStoreParameters parameters = null; |
92 | 94 |
private RasterStoreProvider provider = null; |
... | ... | |
465 | 467 |
@Override |
466 | 468 |
public Object invokeDynMethod(int code, Object[] args) |
467 | 469 |
throws DynMethodException { |
470 |
|
|
468 | 471 |
return this.metadata.invokeDynMethod(this, code, args); |
469 | 472 |
} |
470 | 473 |
|
... | ... | |
569 | 572 |
public Envelope getEnvelope() throws DataException { |
570 | 573 |
return this.getRasterSet().getEnvelope(); |
571 | 574 |
} |
575 |
|
|
576 |
|
|
577 |
@Override |
|
578 |
public void notifyChange(String notification, Resource resource) { |
|
579 |
notifyChange(new DefaultRasterStoreNotification(this, |
|
580 |
DataStoreNotification.RESOURCE_CHANGED)); |
|
581 |
|
|
582 |
} |
|
583 |
|
|
584 |
@Override |
|
585 |
public RasterStore getRasterStore() { |
|
586 |
return this; |
|
587 |
} |
|
572 | 588 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.fmap.dal.raster/org.gvsig.fmap.dal.raster.api/src/main/java/org/gvsig/fmap/dal/raster/api/RasterStore.java | ||
---|---|---|
36 | 36 |
public interface RasterStore extends DataStore, Cloneable{ |
37 | 37 |
|
38 | 38 |
/** |
39 |
* May provide a dynamic method to get the legend |
|
40 |
*/ |
|
41 |
final public static String DYNMETHOD_GETLEGEND_NAME = "getLegend"; |
|
42 |
|
|
43 |
/** |
|
44 |
* May provide a dynamic method to get the Color Interpretation |
|
45 |
*/ |
|
46 |
final public static String DYNMETHOD_GETCOLORINTERPRETATION_NAME = "getColorInterpretation"; |
|
47 |
|
|
48 |
/** |
|
49 |
* May provide a dynamic method to get the Color Table |
|
50 |
*/ |
|
51 |
final public static String DYNMETHOD_GETCOLORTABLE_NAME = "getColorTable"; |
|
52 |
/** |
|
39 | 53 |
* Returns this store's parameters. |
40 | 54 |
* |
41 | 55 |
* @return |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.fmap.mapcontext.raster/org.gvsig.fmap.mapcontext.raster.impl/src/main/java/org/gvsig/fmap/mapcontext/raster/impl/DefaultRasterLayer.java | ||
---|---|---|
22 | 22 |
*/ |
23 | 23 |
package org.gvsig.fmap.mapcontext.raster.impl; |
24 | 24 |
|
25 |
import java.awt.Color; |
|
25 | 26 |
import java.awt.Graphics2D; |
26 |
import java.awt.image.BandCombineOp; |
|
27 | 27 |
import java.awt.image.BufferedImage; |
28 |
import java.awt.image.ColorModel; |
|
29 |
import java.awt.image.DirectColorModel; |
|
30 |
import java.awt.image.IndexColorModel; |
|
31 |
import java.util.ArrayList; |
|
32 |
import java.util.List; |
|
28 | 33 |
import java.util.Observable; |
29 | 34 |
import java.util.Observer; |
30 | 35 |
import java.util.Set; |
... | ... | |
35 | 40 |
import org.gvsig.fmap.dal.DataStore; |
36 | 41 |
import org.gvsig.fmap.dal.exception.DataException; |
37 | 42 |
import org.gvsig.fmap.dal.exception.ReadException; |
43 |
import org.gvsig.fmap.dal.file.jimi.JimiRasterStoreProvider; |
|
44 |
import org.gvsig.fmap.dal.file.jimi.MemoryImage; |
|
38 | 45 |
import org.gvsig.fmap.dal.raster.api.RasterQuery; |
39 | 46 |
import org.gvsig.fmap.dal.raster.api.RasterStore; |
40 | 47 |
import org.gvsig.fmap.dal.raster.api.RasterStoreNotification; |
48 |
import org.gvsig.fmap.dal.raster.impl.DefaultRasterStore; |
|
41 | 49 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
42 | 50 |
import org.gvsig.fmap.geom.GeometryLocator; |
43 | 51 |
import org.gvsig.fmap.geom.GeometryManager; |
44 | 52 |
import org.gvsig.fmap.geom.exception.CreateEnvelopeException; |
45 | 53 |
import org.gvsig.fmap.geom.primitive.Envelope; |
46 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
47 |
import org.gvsig.fmap.mapcontext.MapContextManager; |
|
48 | 54 |
import org.gvsig.fmap.mapcontext.ViewPort; |
49 | 55 |
import org.gvsig.fmap.mapcontext.exceptions.LegendLayerException; |
50 | 56 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
51 | 57 |
import org.gvsig.fmap.mapcontext.layers.FLyrDefault; |
52 | 58 |
import org.gvsig.fmap.mapcontext.raster.api.RasterLayer; |
53 | 59 |
import org.gvsig.fmap.mapcontext.raster.api.RasterLegendChangedListener; |
54 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
|
55 |
import org.gvsig.fmap.mapcontext.rendering.legend.IRasterLegend; |
|
56 |
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend; |
|
57 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendChangedEvent; |
|
58 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendContentsChangedListener; |
|
59 | 60 |
import org.gvsig.metadata.exceptions.MetadataException; |
60 |
import org.gvsig.raster.lib.buffer.api.Buffer; |
|
61 | 61 |
import org.gvsig.raster.lib.legend.api.ColorInterpretation; |
62 |
import org.gvsig.raster.lib.legend.api.ColorTable; |
|
63 |
import org.gvsig.raster.lib.legend.api.ColorTableClass; |
|
62 | 64 |
import org.gvsig.raster.lib.legend.api.RasterLegend; |
63 | 65 |
import org.gvsig.raster.lib.legend.api.RasterLegendLocator; |
64 | 66 |
import org.gvsig.raster.lib.legend.api.RasterLegendManager; |
... | ... | |
164 | 166 |
*/ |
165 | 167 |
private void initLegend() throws LegendLayerException{ |
166 | 168 |
RasterLegend legend=null; |
167 |
if(legend==null){ |
|
169 |
if(this.legend==null){
|
|
168 | 170 |
//Should be done like this but must be corrected mapContextManager |
169 | 171 |
// MapContextManager mapContextManager |
170 | 172 |
// = MapContextLocator.getMapContextManager(); |
... | ... | |
172 | 174 |
// IRasterLegend legend |
173 | 175 |
// = (IRasterLegend) mapContextManager.getLegend(store); |
174 | 176 |
|
175 |
//Should be moved to mapContextManager |
|
176 |
try { |
|
177 |
legend = (RasterLegend) store.invokeDynMethod("getLegend", null); |
|
178 |
} catch (DynMethodNotSupportedException e) { |
|
179 |
logger.debug("This store {} does not provide a legend.", |
|
180 |
store.getName()); |
|
181 |
} catch (DynMethodException e) { |
|
182 |
logger.error( |
|
183 |
"Can't load the specific legend provided for the store {}.", |
|
184 |
store.getName(), e); |
|
177 |
|
|
178 |
//Should be moved to mapContextManager when RasterLegend implements ILegend |
|
179 |
if (legend == null) { |
|
180 |
try { |
|
181 |
legend = (RasterLegend) store.invokeDynMethod(RasterStore.DYNMETHOD_GETLEGEND_NAME, null); |
|
182 |
} catch (DynMethodNotSupportedException e) { |
|
183 |
logger.debug("This store {} does not provide a legend.", |
|
184 |
store.getName()); |
|
185 |
} catch (DynMethodException e) { |
|
186 |
logger.error( |
|
187 |
"Can't load the specific legend provided for the store {}.", |
|
188 |
store.getName(), e); |
|
189 |
} |
|
185 | 190 |
} |
186 | 191 |
|
187 | 192 |
|
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.fmap.mapcontext.raster/org.gvsig.fmap.mapcontext.raster.impl/pom.xml | ||
---|---|---|
11 | 11 |
<dependency> |
12 | 12 |
<groupId>org.gvsig</groupId> |
13 | 13 |
<artifactId>org.gvsig.fmap.mapcontext.raster.api</artifactId> |
14 |
<version>1.0.0-SNAPSHOT</version> |
|
15 | 14 |
</dependency> |
16 | 15 |
<dependency> |
17 | 16 |
<groupId>org.gvsig</groupId> |
... | ... | |
63 | 62 |
<dependency> |
64 | 63 |
<groupId>org.gvsig</groupId> |
65 | 64 |
<artifactId>org.gvsig.fmap.dal.file.jimi</artifactId> |
66 |
<version>1.0.0-SNAPSHOT</version> |
|
67 |
<scope>test</scope> |
|
65 |
<!-- <scope>test</scope> --> |
|
68 | 66 |
</dependency> |
69 | 67 |
<dependency> |
70 | 68 |
<groupId>org.gvsig</groupId> |
... | ... | |
74 | 72 |
<dependency> |
75 | 73 |
<groupId>org.gvsig</groupId> |
76 | 74 |
<artifactId>org.gvsig.fmap.dal.raster.impl</artifactId> |
77 |
<scope>test</scope>
|
|
75 |
<!-- <scope>test</scope> -->
|
|
78 | 76 |
</dependency> |
79 | 77 |
|
80 | 78 |
</dependencies> |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.fmap.dal.file.jimi.legend/src/main/java/org/gvsig/fmap/dal/file/jimi/legend/JimiGetTableColor.java | ||
---|---|---|
1 |
package org.gvsig.fmap.dal.file.jimi.legend; |
|
2 |
|
|
3 |
|
|
4 |
public class JimiGetTableColor { |
|
5 |
|
|
6 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.fmap.dal.file.jimi.legend/src/main/java/org/gvsig/fmap/dal/file/jimi/legend/JimiGetLegend.java | ||
---|---|---|
1 | 1 |
package org.gvsig.fmap.dal.file.jimi.legend; |
2 | 2 |
|
3 |
import org.gvsig.fmap.dal.exception.OpenException; |
|
4 | 3 |
import org.gvsig.fmap.dal.file.jimi.JimiRasterStoreProvider; |
5 |
import org.gvsig.fmap.dal.raster.spi.RasterStoreProvider;
|
|
4 |
import org.gvsig.fmap.dal.raster.api.RasterStore;
|
|
6 | 5 |
import org.gvsig.raster.lib.legend.api.ColorInterpretation; |
6 |
import org.gvsig.raster.lib.legend.api.ColorTable; |
|
7 | 7 |
import org.gvsig.raster.lib.legend.api.RasterLegend; |
8 | 8 |
import org.gvsig.raster.lib.legend.api.RasterLegendLocator; |
9 | 9 |
import org.gvsig.raster.lib.legend.api.RasterLegendManager; |
... | ... | |
17 | 17 |
public class JimiGetLegend implements DynMethod { |
18 | 18 |
|
19 | 19 |
private static Integer code = null; |
20 |
final public static String DYNMETHOD_GETLEGEND_NAME = "getLegend"; |
|
21 | 20 |
|
21 |
|
|
22 | 22 |
static void register(DynClass storeClass) { |
23 | 23 |
if (code != null) { |
24 | 24 |
return; |
... | ... | |
40 | 40 |
|
41 | 41 |
@Override |
42 | 42 |
public String getName() { |
43 |
return DYNMETHOD_GETLEGEND_NAME; |
|
43 |
return RasterStore.DYNMETHOD_GETLEGEND_NAME;
|
|
44 | 44 |
} |
45 | 45 |
|
46 | 46 |
@Override |
47 | 47 |
public Object invoke(DynObject self, Object[] args) |
48 | 48 |
throws DynMethodException { |
49 |
// try {
|
|
49 |
try { |
|
50 | 50 |
JimiRasterStoreProvider jimiProvider=(JimiRasterStoreProvider)self; |
51 |
|
|
52 | 51 |
RasterLegendManager legendManager=RasterLegendLocator.getRasterLegendManager(); |
53 |
ColorInterpretation colorInterpretation = |
|
54 |
legendManager.createColorInterpretation(ColorInterpretation.RGB); |
|
55 | 52 |
|
53 |
ColorInterpretation colorInterpretation =(ColorInterpretation)jimiProvider. |
|
54 |
invokeDynMethod(RasterStore.DYNMETHOD_GETCOLORINTERPRETATION_NAME, null); |
|
55 |
|
|
56 | 56 |
RasterLegend legend= legendManager.createLegend(colorInterpretation); |
57 |
if ( !( colorInterpretation.isBGR() || colorInterpretation.isRGB() || colorInterpretation.isRGBA() ) ){ |
|
58 |
ColorTable colorTable=(ColorTable)jimiProvider. |
|
59 |
invokeDynMethod(RasterStore.DYNMETHOD_GETCOLORTABLE_NAME, null); |
|
60 |
legend.setColorTable(colorTable); |
|
61 |
} |
|
57 | 62 |
|
63 |
|
|
64 |
// ColorInterpretation colorInterpretation = |
|
65 |
// legendManager.createColorInterpretation(ColorInterpretation.RGB); |
|
66 |
// |
|
67 |
// RasterLegend legend= legendManager.createLegend(colorInterpretation); |
|
68 |
|
|
58 | 69 |
return legend; |
59 | 70 |
|
60 |
// } catch (DynMethodNotSupportedException e) {
|
|
61 |
// //FIXME
|
|
62 |
// throw new RuntimeException(e);
|
|
63 |
// }
|
|
71 |
} catch (DynMethodNotSupportedException e) { |
|
72 |
//FIXME |
|
73 |
throw new RuntimeException(e); |
|
74 |
} |
|
64 | 75 |
} |
65 | 76 |
|
66 | 77 |
@Override |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.fmap.dal.file.jimi.legend/src/main/java/org/gvsig/fmap/dal/file/jimi/legend/JimiLegendLibrary.java | ||
---|---|---|
48 | 48 |
@Override |
49 | 49 |
public void doRegistration() { |
50 | 50 |
registerAsServiceOf(DALLibrary.class); |
51 |
require(MetadataLibrary.class); |
|
52 |
// require(DALLibrary.class); |
|
51 | 53 |
require(JimiLibrary.class); |
52 |
require(MetadataLibrary.class); |
|
53 |
require(DALLibrary.class); |
|
54 | 54 |
} |
55 | 55 |
|
56 | 56 |
@Override |
57 | 57 |
protected void doInitialize() throws LibraryException { |
58 |
|
|
58 | 59 |
} |
59 | 60 |
|
60 | 61 |
@Override |
61 | 62 |
protected void doPostInitialize() throws LibraryException { |
62 |
DynClass metadataDefinition = (DynClass) MetadataLocator.getMetadataManager()
|
|
63 |
.getDefinition(JimiRasterStoreProvider.METADATA_DEFINITION_NAME);
|
|
64 |
JimiGetLegend.register(metadataDefinition);
|
|
65 |
// JimiGetTableColor.register(metadataDefinition);
|
|
66 |
// JimiGetColorInterpretation.register(metadataDefinition);
|
|
67 |
}
|
|
63 |
DynClass metadataDefinition = (DynClass) MetadataLocator.getMetadataManager()
|
|
64 |
.getDefinition(JimiRasterStoreProvider.METADATA_DEFINITION_NAME);
|
|
65 |
JimiGetLegend.register(metadataDefinition);
|
|
66 |
JimiGetColorTable.register(metadataDefinition);
|
|
67 |
JimiGetColorInterpretation.register(metadataDefinition);
|
|
68 |
}
|
|
68 | 69 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.fmap.dal.file.jimi.legend/src/main/java/org/gvsig/fmap/dal/file/jimi/legend/JimiGetColorInterpretation.java | ||
---|---|---|
1 | 1 |
package org.gvsig.fmap.dal.file.jimi.legend; |
2 | 2 |
|
3 |
import java.awt.image.ColorModel; |
|
4 |
import java.awt.image.DirectColorModel; |
|
5 |
import java.awt.image.IndexColorModel; |
|
3 | 6 |
|
4 |
public class JimiGetColorInterpretation { |
|
7 |
import org.gvsig.fmap.dal.file.jimi.JimiRasterStoreProvider; |
|
8 |
import org.gvsig.fmap.dal.file.jimi.MemoryImage; |
|
9 |
import org.gvsig.fmap.dal.raster.api.RasterStore; |
|
10 |
import org.gvsig.raster.lib.legend.api.ColorInterpretation; |
|
11 |
import org.gvsig.raster.lib.legend.api.RasterLegendLocator; |
|
12 |
import org.gvsig.raster.lib.legend.api.RasterLegendManager; |
|
13 |
import org.gvsig.tools.ToolsLocator; |
|
14 |
import org.gvsig.tools.dynobject.DynClass; |
|
15 |
import org.gvsig.tools.dynobject.DynMethod; |
|
16 |
import org.gvsig.tools.dynobject.DynObject; |
|
17 |
import org.gvsig.tools.dynobject.exception.DynMethodException; |
|
18 |
import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException; |
|
5 | 19 |
|
6 |
} |
|
20 |
/** |
|
21 |
* @author dmartinezizquierdo |
|
22 |
* |
|
23 |
*/ |
|
24 |
public class JimiGetColorInterpretation implements DynMethod { |
|
25 |
|
|
26 |
private static Integer code = null; |
|
27 |
|
|
28 |
static void register(DynClass storeClass) { |
|
29 |
if (code != null) { |
|
30 |
return; |
|
31 |
} |
|
32 |
code = ToolsLocator.getDynObjectManager() |
|
33 |
.registerDynMethod(storeClass, new JimiGetColorInterpretation()); |
|
34 |
|
|
35 |
} |
|
36 |
|
|
37 |
@Override |
|
38 |
public int getCode() throws DynMethodNotSupportedException { |
|
39 |
return code; |
|
40 |
} |
|
41 |
|
|
42 |
@Override |
|
43 |
public String getDescription() { |
|
44 |
return "Jimi Color Interpretation"; |
|
45 |
} |
|
46 |
|
|
47 |
@Override |
|
48 |
public String getName() { |
|
49 |
return RasterStore.DYNMETHOD_GETCOLORINTERPRETATION_NAME; |
|
50 |
} |
|
51 |
|
|
52 |
@Override |
|
53 |
public Object invoke(DynObject self, Object[] args) |
|
54 |
throws DynMethodException { |
|
55 |
ColorInterpretation colorInterpretation=null; |
|
56 |
// try { |
|
57 |
JimiRasterStoreProvider jimiProvider=(JimiRasterStoreProvider)self; |
|
58 |
|
|
59 |
RasterLegendManager legendManager=RasterLegendLocator.getRasterLegendManager(); |
|
60 |
MemoryImage image=jimiProvider.getMemoryImage(); |
|
61 |
|
|
62 |
ColorModel colorModel=image.colorModel; |
|
63 |
if (colorModel instanceof DirectColorModel){ |
|
64 |
if (image.bands==3){ |
|
65 |
colorInterpretation = |
|
66 |
legendManager.createColorInterpretation(ColorInterpretation.RGB); |
|
67 |
} else if (image.bands==4){ |
|
68 |
colorInterpretation = |
|
69 |
legendManager.createColorInterpretation(ColorInterpretation.ARGB); |
|
70 |
} |
|
71 |
}else if(colorModel instanceof IndexColorModel){ |
|
72 |
colorInterpretation = |
|
73 |
legendManager.createColorInterpretation(ColorInterpretation.PALETTE); |
|
74 |
} |
|
75 |
|
|
76 |
// } catch (DynMethodNotSupportedException e) { |
|
77 |
// //FIXME |
|
78 |
// throw new RuntimeException(e); |
|
79 |
// } |
|
80 |
return colorInterpretation; |
|
81 |
} |
|
82 |
|
|
83 |
@Override |
|
84 |
public Object clone() throws CloneNotSupportedException { |
|
85 |
return super.clone(); |
|
86 |
} |
|
87 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.fmap.dal.file.jimi.legend/src/main/java/org/gvsig/fmap/dal/file/jimi/legend/JimiGetColorTable.java | ||
---|---|---|
1 |
package org.gvsig.fmap.dal.file.jimi.legend; |
|
2 |
|
|
3 |
import java.awt.Color; |
|
4 |
import java.awt.image.ColorModel; |
|
5 |
import java.awt.image.ComponentColorModel; |
|
6 |
import java.awt.image.IndexColorModel; |
|
7 |
import java.util.ArrayList; |
|
8 |
import java.util.List; |
|
9 |
|
|
10 |
import org.gvsig.fmap.dal.file.jimi.JimiRasterStoreProvider; |
|
11 |
import org.gvsig.fmap.dal.file.jimi.MemoryImage; |
|
12 |
import org.gvsig.fmap.dal.raster.api.RasterStore; |
|
13 |
import org.gvsig.raster.lib.legend.api.ColorInterpretation; |
|
14 |
import org.gvsig.raster.lib.legend.api.ColorTable; |
|
15 |
import org.gvsig.raster.lib.legend.api.ColorTableClass; |
|
16 |
import org.gvsig.raster.lib.legend.api.RasterLegendLocator; |
|
17 |
import org.gvsig.raster.lib.legend.api.RasterLegendManager; |
|
18 |
import org.gvsig.tools.ToolsLocator; |
|
19 |
import org.gvsig.tools.dynobject.DynClass; |
|
20 |
import org.gvsig.tools.dynobject.DynMethod; |
|
21 |
import org.gvsig.tools.dynobject.DynObject; |
|
22 |
import org.gvsig.tools.dynobject.exception.DynMethodException; |
|
23 |
import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException; |
|
24 |
|
|
25 |
public class JimiGetColorTable implements DynMethod { |
|
26 |
|
|
27 |
private static Integer code = null; |
|
28 |
|
|
29 |
static void register(DynClass storeClass) { |
|
30 |
if (code != null) { |
|
31 |
return; |
|
32 |
} |
|
33 |
code = ToolsLocator.getDynObjectManager() |
|
34 |
.registerDynMethod(storeClass, new JimiGetColorTable()); |
|
35 |
|
|
36 |
} |
|
37 |
|
|
38 |
@Override |
|
39 |
public int getCode() throws DynMethodNotSupportedException { |
|
40 |
return code; |
|
41 |
} |
|
42 |
|
|
43 |
@Override |
|
44 |
public String getDescription() { |
|
45 |
return "Jimi Color Table"; |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
public String getName() { |
|
50 |
return RasterStore.DYNMETHOD_GETCOLORTABLE_NAME; |
|
51 |
} |
|
52 |
|
|
53 |
@Override |
|
54 |
public Object invoke(DynObject self, Object[] args) |
|
55 |
throws DynMethodException { |
|
56 |
ColorTable colorTable=null; |
|
57 |
// try { |
|
58 |
JimiRasterStoreProvider jimiProvider=(JimiRasterStoreProvider)self; |
|
59 |
|
|
60 |
RasterLegendManager legendManager=RasterLegendLocator.getRasterLegendManager(); |
|
61 |
MemoryImage image=jimiProvider.getMemoryImage(); |
|
62 |
|
|
63 |
ColorModel colorModel=image.colorModel; |
|
64 |
if (colorModel instanceof IndexColorModel){ |
|
65 |
IndexColorModel indexColorModel=(IndexColorModel)colorModel; |
|
66 |
int[] rgbs=new int[indexColorModel.getMapSize()]; |
|
67 |
boolean hasalpha=indexColorModel.hasAlpha(); |
|
68 |
indexColorModel.getRGBs(rgbs); |
|
69 |
|
|
70 |
List<ColorTableClass> colorTableClasses=new ArrayList<ColorTableClass>(); |
|
71 |
|
|
72 |
for (int i=0;i<rgbs.length;i++){ |
|
73 |
String className=i+""; |
|
74 |
double value=((byte)i); |
|
75 |
double interpolation=50.0; |
|
76 |
Color color=new Color(rgbs[i], hasalpha); |
|
77 |
ColorTableClass colorTableClass = legendManager.createColorTableClass(className, value, interpolation, color); |
|
78 |
colorTableClasses.add(colorTableClass); |
|
79 |
} |
|
80 |
String colorTableName=jimiProvider.getName()+"_color_table"; |
|
81 |
colorTable=legendManager.createColorTable(colorTableName, colorTableClasses, true); |
|
82 |
|
|
83 |
} |
|
84 |
|
|
85 |
// } catch (DynMethodNotSupportedException e) { |
|
86 |
// //FIXME |
|
87 |
// throw new RuntimeException(e); |
|
88 |
// } |
|
89 |
return colorTable; |
|
90 |
} |
|
91 |
|
|
92 |
@Override |
|
93 |
public Object clone() throws CloneNotSupportedException { |
|
94 |
return super.clone(); |
|
95 |
} |
|
96 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/AbstractPaginatedBand.java | ||
---|---|---|
39 | 39 |
this.columns = columns; |
40 | 40 |
this.loaded=false; |
41 | 41 |
calculateRowsPerPage(); |
42 |
|
|
42 |
|
|
43 | 43 |
if (noData == null) { |
44 | 44 |
this.noData = BufferLocator.getBufferManager().createNoData(null, null); |
45 | 45 |
} else { |
... | ... | |
97 | 97 |
loaded=false; |
98 | 98 |
|
99 | 99 |
saveCurrentPage(); |
100 |
firstRowOfPage = row / rowsPerPage; //Divisi?n entera |
|
100 |
int currentPage = row / rowsPerPage; //Divisi?n entera |
|
101 |
firstRowOfPage = currentPage * rowsPerPage; |
|
101 | 102 |
try { |
102 | 103 |
int rowsInPage = rowsPerPage; |
103 | 104 |
if(firstRowOfPage + rowsPerPage > this.rows){ |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/SimpleBandPageManager.java | ||
---|---|---|
111 | 111 |
ByteBuffer byteBuffer = ByteBuffer.allocate(buffer.capacity() * bufferManager.getDataTypeSize(dataType)); |
112 | 112 |
switch (dataType) { |
113 | 113 |
case BufferManager.TYPE_BYTE: |
114 |
byteBuffer.put((ByteBuffer)buffer.array()); |
|
114 |
byteBuffer.put(((ByteBuffer)buffer).array()); |
|
115 |
break; |
|
115 | 116 |
case BufferManager.TYPE_SHORT: |
116 | 117 |
case BufferManager.TYPE_USHORT: |
117 | 118 |
ShortBuffer byteAsShortBuffer = byteBuffer.asShortBuffer(); |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.buffer/org.gvsig.raster.lib.buffer.impl/src/main/java/org/gvsig/raster/lib/buffer/impl/ClippedBuffer.java | ||
---|---|---|
47 | 47 |
this.rows = (int)Math.round(this.envelope.getLength(1)/this.buffer.getPixelSizeY()); |
48 | 48 |
this.columns = (int)Math.round(this.envelope.getLength(0)/this.buffer.getPixelSizeX()); |
49 | 49 |
|
50 |
this.firstRow = (int)(Math.round((this.envelope.getMinimum(1)-this.buffer.getEnvelope().getMinimum(1))/this.buffer.getPixelSizeY()));
|
|
50 |
this.firstRow = (int)(Math.round((this.buffer.getEnvelope().getMaximum(1) - this.envelope.getMaximum(1))/this.buffer.getPixelSizeY()));
|
|
51 | 51 |
this.firstColumn = (int)(Math.round((this.envelope.getMinimum(0)-this.buffer.getEnvelope().getMinimum(0))/this.buffer.getPixelSizeX())); |
52 | 52 |
|
53 | 53 |
this.projection = buffer.getProjection(); |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.api/src/main/java/org/gvsig/raster/lib/legend/api/ColorInterpretation.java | ||
---|---|---|
19 | 19 |
public static final String RED_BLUE_BAND = "Red_Blue"; |
20 | 20 |
public static final String GREEN_BLUE_BAND = "Green_Blue"; |
21 | 21 |
|
22 |
public static final String PALETTE_BAND = "Palette"; |
|
23 |
|
|
24 |
public static final String UNDEFINED_BAND = "Undefined"; |
|
25 |
|
|
22 | 26 |
// Constants to initialize the color interpretation |
23 | 27 |
public static final String RGB = "RGB"; |
24 | 28 |
public static final String BGR = "BGR"; |
25 | 29 |
public static final String ARGB = "ARGB"; |
26 | 30 |
public static final String GRAYSCALE = "GRAYSCALE"; |
31 |
public static final String PALETTE = "PALETTE"; |
|
27 | 32 |
|
28 | 33 |
/** |
29 | 34 |
* Set color interpretation value to band |
30 |
*
|
|
35 |
* |
|
31 | 36 |
* @param band |
32 | 37 |
* Band |
33 | 38 |
* @param value |
... | ... | |
51 | 56 |
/** |
52 | 57 |
* @return Returns true if the color interpretation is BGR, that is, the |
53 | 58 |
* three first bands of the image are Blue, Green and Red. |
54 |
*
|
|
59 |
* |
|
55 | 60 |
*/ |
56 | 61 |
public boolean isBGR(); |
57 | 62 |
|
... | ... | |
73 | 78 |
public boolean isGray(); |
74 | 79 |
|
75 | 80 |
/** |
81 |
* @return Returns true if the color interpretation is Palette |
|
82 |
*/ |
|
83 |
public boolean isPalette(); |
|
84 |
|
|
85 |
/** |
|
76 | 86 |
* @param band |
77 | 87 |
* @return Returns true if the selected band has red, green or blue |
78 | 88 |
* interpretation |
... | ... | |
89 | 99 |
public boolean isGrayInterpretation(int band); |
90 | 100 |
|
91 | 101 |
/** |
92 |
* |
|
93 |
* |
|
94 | 102 |
* @param band |
103 |
* @return Returns true if the selected band has palette interpretation and |
|
104 |
* false |
|
105 |
* otherwise |
|
106 |
*/ |
|
107 |
public boolean isPaletteInterpretation(int band); |
|
108 |
|
|
109 |
/** |
|
110 |
* |
|
111 |
* |
|
112 |
* @param band |
|
95 | 113 |
* @return Returns true if the selected band has alpha interpretation and |
96 | 114 |
* false |
97 | 115 |
* otherwise |
... | ... | |
100 | 118 |
|
101 | 119 |
/** |
102 | 120 |
* Get color interpretation of band. |
103 |
*
|
|
121 |
* |
|
104 | 122 |
* @param i |
105 | 123 |
* Number of band |
106 | 124 |
* @return Color interpretation defined of band |
... | ... | |
110 | 128 |
/** |
111 | 129 |
* Gets the band position defined with color interpretation received as |
112 | 130 |
* parameter. |
113 |
*
|
|
131 |
* |
|
114 | 132 |
* @param id |
115 | 133 |
* Color interpretation definition |
116 | 134 |
* @return Index of band |
... | ... | |
119 | 137 |
|
120 | 138 |
/** |
121 | 139 |
* Gets if color interpretation is defined |
122 |
*
|
|
140 |
* |
|
123 | 141 |
* @return True if color interpretation is defined, false if it is undefined |
124 | 142 |
*/ |
125 | 143 |
public boolean isUndefined(); |
126 | 144 |
|
127 | 145 |
/** |
128 | 146 |
* Gets color interpretation of all bands |
129 |
*
|
|
147 |
* |
|
130 | 148 |
* @return Array with color interpretation |
131 | 149 |
*/ |
132 | 150 |
public String[] getValues(); |
... | ... | |
144 | 162 |
/** |
145 | 163 |
* Adds a color interpretation to this color interpretation. The result is |
146 | 164 |
* the addition of color interpretations. |
147 |
*
|
|
165 |
* |
|
148 | 166 |
* @param ci |
149 | 167 |
*/ |
150 | 168 |
public void addColorInterpretation(ColorInterpretation ci); |
... | ... | |
160 | 178 |
|
161 | 179 |
/** |
162 | 180 |
* Copy from the color interpretation received as parameter |
163 |
*
|
|
181 |
* |
|
164 | 182 |
* @param colorInterpretation |
165 | 183 |
*/ |
166 | 184 |
public void copyFrom(ColorInterpretation colorInterpretation); |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.impl/src/test/java/org/gvsig/raster/lib/legend/impl/DefaultColorInterpretationTest.java | ||
---|---|---|
17 | 17 |
private ColorInterpretation colorInterpretationARGB; |
18 | 18 |
private ColorInterpretation colorInterpretationBGR; |
19 | 19 |
private ColorInterpretation colorInterpretationGray; |
20 |
private ColorInterpretation colorInterpretationPalette; |
|
20 | 21 |
|
21 | 22 |
@Override |
22 | 23 |
protected void doSetUp() throws Exception { |
... | ... | |
35 | 36 |
rasterLegendManager.createColorInterpretation(ColorInterpretation.BGR); |
36 | 37 |
colorInterpretationGray = |
37 | 38 |
rasterLegendManager.createColorInterpretation(ColorInterpretation.GRAYSCALE); |
39 |
colorInterpretationPalette = |
|
40 |
rasterLegendManager.createColorInterpretation(ColorInterpretation.PALETTE); |
|
38 | 41 |
} |
39 | 42 |
|
40 | 43 |
public void testSetColorInterpValue() { |
... | ... | |
87 | 90 |
assertFalse(colorInterpretationBGR.isRGBA()); |
88 | 91 |
assertFalse(colorInterpretationGray.isRGBA()); |
89 | 92 |
} |
90 |
|
|
93 |
|
|
91 | 94 |
public void testIsGray() { |
92 | 95 |
assertFalse(colorInterpretation.isGray()); |
93 | 96 |
assertFalse(colorInterpretationARGB.isGray()); |
... | ... | |
194 | 197 |
assertEquals(ColorInterpretation.RED_BAND, values[0]); |
195 | 198 |
assertEquals(ColorInterpretation.GREEN_BAND, values[1]); |
196 | 199 |
assertEquals(ColorInterpretation.BLUE_BAND, values[2]); |
197 |
|
|
200 |
|
|
198 | 201 |
values = colorInterpretationGray.getValues(); |
199 | 202 |
assertEquals(ColorInterpretation.GRAY_BAND, values[0]); |
200 | 203 |
} |
... | ... | |
216 | 219 |
} |
217 | 220 |
|
218 | 221 |
public void testBuildRenderBands() { |
219 |
|
|
222 |
|
|
220 | 223 |
int[] buildRenderBands = colorInterpretation.buildRenderBands(); |
221 | 224 |
assertEquals(2, buildRenderBands[0]); |
222 | 225 |
assertEquals(0, buildRenderBands[1]); |
223 | 226 |
assertEquals(1, buildRenderBands[2]); |
224 |
|
|
227 |
|
|
225 | 228 |
buildRenderBands = colorInterpretationGray.buildRenderBands(); |
226 | 229 |
assertEquals(0, buildRenderBands[0]); |
227 | 230 |
assertEquals(0, buildRenderBands[1]); |
... | ... | |
229 | 232 |
} |
230 | 233 |
|
231 | 234 |
public void testCopyFrom() { |
232 |
|
|
235 |
|
|
233 | 236 |
colorInterpretationGray.copyFrom(colorInterpretationRGB); |
234 | 237 |
assertEquals(3, colorInterpretationGray.length()); |
235 | 238 |
String[] values = colorInterpretationGray.getValues(); |
236 | 239 |
assertEquals(ColorInterpretation.RED_BAND, values[0]); |
237 | 240 |
assertEquals(ColorInterpretation.GREEN_BAND, values[1]); |
238 | 241 |
assertEquals(ColorInterpretation.BLUE_BAND, values[2]); |
239 |
|
|
242 |
|
|
240 | 243 |
} |
241 | 244 |
|
242 | 245 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.impl/src/main/java/org/gvsig/raster/lib/legend/impl/DefaultColorInterpretation.java | ||
---|---|---|
39 | 39 |
} |
40 | 40 |
|
41 | 41 |
/** |
42 |
*
|
|
42 |
* |
|
43 | 43 |
* @param colorInterpretations |
44 | 44 |
*/ |
45 | 45 |
public DefaultColorInterpretation(String[] colorInterpretations) { |
... | ... | |
60 | 60 |
* Constructor to initialize color interpretation with the number of bands. |
61 | 61 |
* It is necessary to indicate color interpretation of each band using |
62 | 62 |
* {@link ColorInterpretation#setColorInterpValue(int, String)} |
63 |
*
|
|
63 |
* |
|
64 | 64 |
* @param nBands |
65 | 65 |
* Number of bands of this color interpretation |
66 | 66 |
*/ |
... | ... | |
81 | 81 |
this.colorInterpretation = new String[] { RED_BAND, GREEN_BAND, BLUE_BAND, ALPHA_BAND }; |
82 | 82 |
} else if (colorInterpretation.equals(GRAYSCALE)) { |
83 | 83 |
this.colorInterpretation = new String[] { GRAY_BAND }; |
84 |
}else if (colorInterpretation.equals(PALETTE)) { |
|
85 |
this.colorInterpretation = new String[] { PALETTE_BAND }; |
|
84 | 86 |
} |
85 |
|
|
87 |
|
|
86 | 88 |
if(this.colorInterpretation == null){ |
87 | 89 |
throw new IllegalArgumentException( |
88 | 90 |
"Can not create color interpretation. Type is not recognised"); |
... | ... | |
109 | 111 |
} |
110 | 112 |
|
111 | 113 |
private boolean isColorInterpretationValid(String colorInterpretation) { |
112 |
if (colorInterpretation.equals(RED_BAND) || colorInterpretation.equals(GREEN_BAND) |
|
113 |
|| colorInterpretation.equals(BLUE_BAND) || colorInterpretation.equals(GRAY_BAND) |
|
114 |
if (colorInterpretation.equals(RED_BAND) |
|
115 |
|| colorInterpretation.equals(GREEN_BAND) |
|
116 |
|| colorInterpretation.equals(BLUE_BAND) |
|
117 |
|| colorInterpretation.equals(GRAY_BAND) |
|
118 |
|| colorInterpretation.equals(PALETTE_BAND) |
|
114 | 119 |
|| colorInterpretation.equals(RED_BLUE_BAND) |
115 | 120 |
|| colorInterpretation.equals(RED_GREEN_BAND) |
116 | 121 |
|| colorInterpretation.equals(GREEN_BLUE_BAND) |
... | ... | |
132 | 137 |
|| colorInterpretation[i].equals(RED_GREEN_BAND) |
133 | 138 |
|| colorInterpretation[i].equals(RED_BLUE_BAND) |
134 | 139 |
|| colorInterpretation[i].equals(GREEN_BLUE_BAND) |
140 |
|| colorInterpretation[i].equals(PALETTE_BAND) |
|
135 | 141 |
|| colorInterpretation[i].equals(GRAY_BAND)) { |
136 | 142 |
|
137 | 143 |
return true; |
... | ... | |
173 | 179 |
} |
174 | 180 |
return false; |
175 | 181 |
} |
176 |
|
|
182 |
@Override |
|
177 | 183 |
public boolean isGray() { |
178 | 184 |
if (colorInterpretation != null && this.length() == 1 |
179 | 185 |
&& colorInterpretation[0].equals(GRAY_BAND)) { |
... | ... | |
181 | 187 |
} |
182 | 188 |
return false; |
183 | 189 |
} |
190 |
@Override |
|
191 |
public boolean isPalette() { |
|
192 |
if (colorInterpretation != null && this.length() == 1 |
|
193 |
&& colorInterpretation[0].equals(PALETTE_BAND)) { |
|
194 |
return true; |
|
195 |
} |
|
196 |
return false; |
|
197 |
} |
|
184 | 198 |
|
185 | 199 |
private boolean isInterpretationDefinedAsColor(int band) { |
186 |
return isColorInterpretation(band) || isGrayInterpretation(band); |
|
200 |
return isColorInterpretation(band) |
|
201 |
|| isGrayInterpretation(band) |
|
202 |
|| isPaletteInterpretation(band); |
|
187 | 203 |
} |
188 | 204 |
|
189 | 205 |
@Override |
... | ... | |
199 | 215 |
} |
200 | 216 |
|
201 | 217 |
@Override |
218 |
public boolean isPaletteInterpretation(int band) { |
|
219 |
return colorInterpretation[band].equals(PALETTE_BAND); |
|
220 |
} |
|
221 |
|
|
222 |
@Override |
|
202 | 223 |
public boolean isAlphaInterpretation(int band) { |
203 | 224 |
return colorInterpretation[band].equals(ALPHA_BAND); |
204 | 225 |
} |
... | ... | |
280 | 301 |
if (colorInterpretation[i].equals(BLUE_BAND)) { |
281 | 302 |
renderBands[2] = i; |
282 | 303 |
} |
283 |
if (colorInterpretation[i].equals(GRAY_BAND)) { |
|
304 |
if (colorInterpretation[i].equals(GRAY_BAND)||colorInterpretation[i].equals(PALETTE_BAND)) {
|
|
284 | 305 |
renderBands[0] = renderBands[1] = renderBands[2] = i; |
285 | 306 |
} |
286 | 307 |
if (colorInterpretation[i].equals(RED_GREEN_BAND)) { |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.lib/org.gvsig.raster.lib.legend/org.gvsig.raster.lib.legend.impl/src/main/java/org/gvsig/raster/lib/legend/impl/DefaultRasterLegend.java | ||
---|---|---|
136 | 136 |
|
137 | 137 |
// Convert extension to check if envelopes intersect |
138 | 138 |
ICoordTrans coordTrans = viewPort.getProjection().getCT(buffer.getProjection()); |
139 |
Envelope convertedEnvelope = viewPort.getEnvelope().convert(coordTrans); |
|
139 |
Envelope convertedEnvelope = viewPort.getAdjustedEnvelope().convert(coordTrans);
|
|
140 | 140 |
if (!convertedEnvelope.intersects(buffer.getEnvelope())) { |
141 | 141 |
return; |
142 | 142 |
} |
... | ... | |
148 | 148 |
bufferToDraw = bufferToDraw.convert(coordTrans.getInverted(), taskStatus); |
149 | 149 |
|
150 | 150 |
double widthPixel = |
151 |
getWidthPixel(bufferToDraw.getEnvelope(), viewPort.getEnvelope().getLength(0) |
|
151 |
getWidthPixel(bufferToDraw.getEnvelope(), viewPort.getAdjustedEnvelope().getLength(0)
|
|
152 | 152 |
/ viewPort.getImageWidth()); |
153 | 153 |
double heightPixel = |
154 |
getHeightPixel(bufferToDraw.getEnvelope(), viewPort.getEnvelope().getLength(1) |
|
154 |
getHeightPixel(bufferToDraw.getEnvelope(), viewPort.getAdjustedEnvelope().getLength(1)
|
|
155 | 155 |
/ viewPort.getImageHeight()); |
156 | 156 |
|
157 | 157 |
bufferToDraw = |
158 | 158 |
bufferToDraw.createInterpolated((int) Math.floor(heightPixel), |
159 |
(int) Math.floor(widthPixel), Buffer.INTERPOLATION_BicubicSpline,
|
|
159 |
(int) Math.floor(widthPixel), Buffer.INTERPOLATION_NearestNeighbour,
|
|
160 | 160 |
taskStatus); |
161 | 161 |
|
162 | 162 |
} catch (BufferException e) { |
... | ... | |
164 | 164 |
taskStatus.abort(); |
165 | 165 |
return; |
166 | 166 |
} |
167 |
} else if (viewPort.getEnvelope().intersects(buffer.getEnvelope())) { |
|
167 |
} else if (viewPort.getAdjustedEnvelope().intersects(buffer.getEnvelope())) {
|
|
168 | 168 |
|
169 | 169 |
double widthPixel = 0; |
170 | 170 |
double heightPixel = 0; |
171 | 171 |
try { |
172 | 172 |
// Clip and interpolate buffer with view port envelope |
173 |
if(buffer.getEnvelope().equals(viewPort.getEnvelope())){ |
|
173 |
if(buffer.getEnvelope().equals(viewPort.getAdjustedEnvelope())){
|
|
174 | 174 |
bufferToDraw = buffer; |
175 | 175 |
} else { |
176 |
bufferToDraw = buffer.clip(viewPort.getEnvelope()); |
|
176 |
bufferToDraw = buffer.clip(viewPort.getAdjustedEnvelope());
|
|
177 | 177 |
} |
178 | 178 |
widthPixel = |
179 |
getWidthPixel(bufferToDraw.getEnvelope(), viewPort.getEnvelope().getLength(0) |
|
179 |
getWidthPixel(bufferToDraw.getEnvelope(), viewPort.getAdjustedEnvelope().getLength(0)
|
|
180 | 180 |
/ viewPort.getImageWidth()); |
181 | 181 |
heightPixel = |
182 |
getHeightPixel(bufferToDraw.getEnvelope(), viewPort.getEnvelope().getLength(1) |
|
182 |
getHeightPixel(bufferToDraw.getEnvelope(), viewPort.getAdjustedEnvelope().getLength(1)
|
|
183 | 183 |
/ viewPort.getImageHeight()); |
184 | 184 |
|
185 | 185 |
bufferToDraw = |
... | ... | |
202 | 202 |
|
203 | 203 |
// Draw buffer |
204 | 204 |
Image image = null; |
205 |
if (this.colorInterpretation.isGray() && this.colorTable != null) { |
|
206 |
|
|
205 |
if (this.colorInterpretation.isGray()){ |
|
206 |
// Draw buffer with gray scale |
|
207 |
image = drawBuffer(graphics, bufferToDraw, filters); |
|
208 |
}else if ( this.colorInterpretation.isPalette() && this.colorTable != null ) { |
|
207 | 209 |
// Draw buffer with table color |
208 | 210 |
image = drawBuffer(graphics, bufferToDraw, colorTable, transparency, filters); |
209 | 211 |
|
... | ... | |
218 | 220 |
double x = bufferToDraw.getEnvelope().getMinimum(0); |
219 | 221 |
double y = bufferToDraw.getEnvelope().getMaximum(1); |
220 | 222 |
AffineTransform affineTransform = |
221 |
calculateAffineTransform(viewPort.getEnvelope(), viewPort.getImageWidth(), |
|
223 |
calculateAffineTransform(viewPort.getAdjustedEnvelope(), viewPort.getImageWidth(),
|
|
222 | 224 |
viewPort.getImageHeight()); |
223 | 225 |
|
224 | 226 |
Point point; |
... | ... | |
323 | 325 |
|
324 | 326 |
int intRGB = 0; |
325 | 327 |
if (colorInterpretation.isRGB() || colorInterpretation.isRGBA()) { |
326 |
intRGB = ((alphaValue.byteValue() & 0xFF) << 24) | // red
|
|
328 |
intRGB = ((alphaValue.byteValue() & 0xFF) << 24) | // alpha
|
|
327 | 329 |
((redValue.byteValue() & 0xFF) << 16) | // red |
328 | 330 |
((greenValue.byteValue() & 0xFF) << 8) | // green |
329 | 331 |
((blueValue.byteValue() & 0xFF) << 0); // blue |
... | ... | |
339 | 341 |
return image; |
340 | 342 |
} |
341 | 343 |
|
344 |
/** |
|
345 |
* Method to draw gray buffers |
|
346 |
* @param graphics |
|
347 |
* @param buffer |
|
348 |
* @param filters |
|
349 |
* @return |
|
350 |
*/ |
|
351 |
private Image drawBuffer(Graphics graphics, Buffer buffer, FilterList filters) { |
|
352 |
|
|
353 |
BufferedImage image = null; |
|
354 |
|
|
355 |
image = |
|
356 |
new BufferedImage(buffer.getColumns(), buffer.getRows(), BufferedImage.TYPE_INT_BGR); |
|
357 |
|
|
358 |
Band greyBand = buffer.getBand(0); |
|
359 |
|
|
360 |
for (int i = 0; i < buffer.getRows(); i++) { |
|
361 |
for (int j = 0; j < buffer.getColumns(); j++) { |
|
362 |
Number greyValue = (Number) greyBand.get(i, j); |
|
363 |
|
|
364 |
if (filters != null) { |
|
365 |
// TODO Apply filters |
|
366 |
} |
|
367 |
|
|
368 |
int intRGB =((greyValue.byteValue() & 0xFF) << 16 | // blue |
|
369 |
((greyValue.byteValue() & 0xFF) << 8) | // green |
|
370 |
((greyValue.byteValue() & 0xFF) << 0)); // red |
|
371 |
|
|
372 |
image.setRGB(j, i, intRGB); |
|
373 |
} |
|
374 |
} |
|
375 |
return image; |
|
376 |
} |
|
377 |
|
|
342 | 378 |
private Image drawBuffer(Graphics graphics, Buffer buffer, ColorTable colorTable, |
343 | 379 |
Transparency transparency, FilterList filters) { |
344 | 380 |
|
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.gdal/org.gvsig.raster.gdal.provider/pom.xml | ||
---|---|---|
1 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
2 |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<parent> |
|
5 |
<groupId>org.gvsig</groupId> |
|
6 |
<artifactId>org.gvsig.raster.gdal</artifactId> |
|
7 |
<version>2.4.1-SNAPSHOT</version> |
|
8 |
</parent> |
|
9 |
<artifactId>org.gvsig.raster.gdal.provider</artifactId> |
|
10 |
<name>org.gvsig.gdal.provider</name> |
|
11 |
|
|
12 |
<dependencies> |
|
13 |
<dependency> |
|
14 |
<groupId>org.gvsig</groupId> |
|
15 |
<artifactId>org.gvsig.fmap.dal.raster.spi</artifactId> |
|
16 |
</dependency> |
|
17 |
<dependency> |
|
18 |
<groupId>org.gdal</groupId> |
|
19 |
<artifactId>gdal</artifactId> |
|
20 |
<scope>compile</scope> |
|
21 |
</dependency> |
|
22 |
</dependencies> |
|
23 |
</project> |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.gdal/org.gvsig.raster.gdal.provider/src/main/java/org/gvsig/raster/gdal/provider/RasterGdalLibrary.java | ||
---|---|---|
1 |
package org.gvsig.raster.gdal.provider; |
|
2 |
|
|
3 |
import java.util.ArrayList; |
|
4 |
import java.util.List; |
|
5 |
|
|
6 |
import org.gdal.gdal.gdal; |
|
7 |
import org.gdal.ogr.ogr; |
|
8 |
import org.gvsig.fmap.dal.DALFileLibrary; |
|
9 |
import org.gvsig.fmap.dal.DALFileLocator; |
|
10 |
import org.gvsig.fmap.dal.DALLibrary; |
|
11 |
import org.gvsig.fmap.dal.FileHelper; |
|
12 |
import org.gvsig.fmap.dal.spi.DALSPILocator; |
|
13 |
import org.gvsig.fmap.dal.spi.DataManagerProviderServices; |
|
14 |
import org.gvsig.metadata.exceptions.MetadataException; |
|
15 |
import org.gvsig.tools.library.AbstractLibrary; |
|
16 |
import org.gvsig.tools.library.LibraryException; |
|
17 |
|
|
18 |
/** |
|
19 |
* Raster GDAL Provider Library to register provider commponents |
|
20 |
* @author dmartinezizquierdo |
|
21 |
* |
|
22 |
*/ |
|
23 |
public class RasterGdalLibrary extends AbstractLibrary { |
|
24 |
|
|
25 |
@Override |
|
26 |
public void doRegistration() { |
|
27 |
registerAsServiceOf(DALLibrary.class); |
|
28 |
require(DALFileLibrary.class); |
|
29 |
} |
|
30 |
|
|
31 |
@Override |
|
32 |
protected void doInitialize() throws LibraryException { |
|
33 |
} |
|
34 |
|
|
35 |
@Override |
|
36 |
protected void doPostInitialize() throws LibraryException { |
|
37 |
List<Throwable> exs = new ArrayList<Throwable>(); |
|
38 |
|
|
39 |
FileHelper.registerParametersDefinition( |
|
40 |
RasterGdalStoreProviderParameters.PARAMETERS_DEFINITION_NAME, |
|
41 |
RasterGdalStoreProviderParameters.class, "RasterGdalParameters.xml"); |
|
42 |
try { |
|
43 |
FileHelper.registerMetadataDefinition( |
|
44 |
RasterGdalStoreProvider.METADATA_DEFINITION_NAME, |
|
45 |
RasterGdalStoreProvider.class, "RasterGdalMetadata.xml"); |
|
46 |
} catch (MetadataException e) { |
|
47 |
exs.add(e); |
|
48 |
} |
|
49 |
|
|
50 |
DataManagerProviderServices dataman = DALSPILocator.getDataManagerProviderServices(); |
|
51 |
|
|
52 |
|
|
53 |
try { |
|
54 |
if (!dataman.getStoreProviders().contains(RasterGdalStoreProvider.NAME)) { |
|
55 |
dataman.registerStoreProviderFactory(new RasterGdalStoreProviderFactory(RasterGdalStoreProvider.NAME, RasterGdalStoreProvider.DESCRIPTION)); |
|
56 |
|
|
57 |
} |
|
58 |
} catch (RuntimeException e) { |
|
59 |
exs.add(e); |
|
60 |
} |
|
61 |
|
|
62 |
try { |
|
63 |
DALFileLocator.getFilesystemServerExplorerManager() |
|
64 |
.registerProvider(RasterGdalStoreProvider.NAME, |
|
65 |
RasterGdalStoreProvider.DESCRIPTION, |
|
66 |
RasterGdalFileSystemServerProvider.class); |
|
67 |
} catch (RuntimeException e) { |
|
68 |
exs.add(e); |
|
69 |
} |
|
70 |
|
|
71 |
//initialize gdal drivers |
|
72 |
try { |
|
73 |
gdal.AllRegister(); |
|
74 |
ogr.RegisterAll(); |
|
75 |
} catch (RuntimeException e) { |
|
76 |
exs.add(e); |
|
77 |
} |
|
78 |
|
|
79 |
|
|
80 |
if (exs.size() > 0) { |
|
81 |
throw new LibraryException(this.getClass(), exs); |
|
82 |
} |
|
83 |
|
|
84 |
} |
|
85 |
|
|
86 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.gdal/org.gvsig.raster.gdal.provider/src/main/java/org/gvsig/raster/gdal/provider/RasterGdalFileSystemServerProvider.java | ||
---|---|---|
1 |
/* 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.raster.gdal.provider; |
|
24 |
|
|
25 |
import java.io.File; |
|
26 |
import java.io.FileInputStream; |
|
27 |
import java.io.IOException; |
|
28 |
import java.util.ArrayList; |
|
29 |
|
|
30 |
import org.apache.commons.lang3.StringUtils; |
|
31 |
import org.gdal.gdal.Driver; |
|
32 |
import org.gdal.gdal.gdal; |
|
33 |
import org.gdal.gdalconst.gdalconstConstants; |
|
34 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
35 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
36 |
import org.gvsig.fmap.dal.NewDataStoreParameters; |
|
37 |
import org.gvsig.fmap.dal.exception.CreateException; |
|
38 |
import org.gvsig.fmap.dal.exception.DataException; |
|
39 |
import org.gvsig.fmap.dal.exception.FileNotFoundException; |
|
40 |
import org.gvsig.fmap.dal.exception.RemoveException; |
|
41 |
import org.gvsig.fmap.dal.resource.spi.ResourceConsumer; |
|
42 |
import org.gvsig.fmap.dal.resource.spi.ResourceProvider; |
|
43 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.impl.AbstractFilesystemServerExplorerProvider; |
|
44 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider; |
|
45 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProviderServices; |
|
46 |
|
|
47 |
/** |
|
48 |
* Filesystem Provider for Raster GDAL. |
|
49 |
* @author dmartinezizquierdo |
|
50 |
* |
|
51 |
*/ |
|
52 |
public class RasterGdalFileSystemServerProvider extends AbstractFilesystemServerExplorerProvider |
|
53 |
implements FilesystemServerExplorerProvider, ResourceConsumer{ |
|
54 |
|
|
55 |
protected FilesystemServerExplorerProviderServices serverExplorer; |
|
56 |
private ArrayList<String> acceptedExtensions; |
|
57 |
|
|
58 |
public int getMode() { |
|
59 |
return DataServerExplorer.MODE_RASTER; |
|
60 |
} |
|
61 |
|
|
62 |
@Override |
|
63 |
public boolean canCreate() { |
|
64 |
return false; |
|
65 |
} |
|
66 |
|
|
67 |
@Override |
|
68 |
public boolean canCreate(NewDataStoreParameters arg0) { |
|
69 |
return false; |
|
70 |
} |
|
71 |
|
|
72 |
@Override |
|
73 |
public void create(NewDataStoreParameters arg0, boolean arg1) |
|
74 |
throws CreateException { |
|
75 |
//TODO: Parece que el antiguo raster si que lo soporta para geoprocesos. Ver como lo hace |
|
76 |
throw new UnsupportedOperationException(); |
|
77 |
|
|
78 |
} |
|
79 |
|
|
80 |
@Override |
|
81 |
public NewDataStoreParameters getCreateParameters() throws DataException { |
|
82 |
//TODO: Parece que el antiguo raster si que lo soporta para geoprocesos. Ver como lo hace |
|
83 |
throw new UnsupportedOperationException(); |
|
84 |
} |
|
85 |
|
|
86 |
@Override |
|
87 |
public void initialize(FilesystemServerExplorerProviderServices serverExplorer) { |
|
88 |
this.serverExplorer = serverExplorer; |
|
89 |
this.acceptedExtensions=new ArrayList<>(); |
|
90 |
for (int i=0;i<gdal.GetDriverCount(); i++){ |
|
91 |
Driver drv = gdal.GetDriver(i); |
|
92 |
String extension=drv.GetMetadataItem(gdalconstConstants.GDAL_DMD_EXTENSION); |
|
93 |
if (StringUtils.isNotEmpty(extension)){ |
|
94 |
acceptedExtensions.add(extension); |
|
95 |
} |
|
96 |
} |
|
97 |
} |
|
98 |
|
|
99 |
@Override |
|
100 |
public void remove(DataStoreParameters parameters) throws RemoveException { |
|
101 |
RasterGdalStoreProviderParameters params = (RasterGdalStoreProviderParameters) parameters; |
|
102 |
File file = params.getFile(); |
|
103 |
if (!file.exists()) { |
|
104 |
throw new RemoveException(this.getDataStoreProviderName(), |
|
105 |
new FileNotFoundException(params.getFile())); |
|
106 |
} |
|
107 |
if (!file.delete()) { |
|
108 |
throw new RemoveException(this.getDataStoreProviderName(), |
|
109 |
new IOException("Error deleting file: "+file.getName())); |
|
110 |
} |
|
111 |
|
|
112 |
} |
|
113 |
|
|
114 |
@Override |
|
115 |
public String getDataStoreProviderName() { |
|
116 |
return RasterGdalStoreProvider.NAME; |
|
117 |
} |
|
118 |
|
|
119 |
@Override |
|
120 |
public String getDescription() { |
|
121 |
return RasterGdalStoreProvider.DESCRIPTION; |
|
122 |
} |
|
123 |
|
|
124 |
@Override |
|
125 |
public boolean accept(File pathname) { |
|
126 |
if (pathname.getParentFile() != null && |
|
127 |
pathname.getParentFile().getName().equals("cellhd")) { |
|
128 |
if (pathname.getName().endsWith(".rmf") |
|
129 |
|| pathname.getName().endsWith(".rmf~")) { |
|
130 |
return false; |
|
131 |
} |
|
132 |
return true; |
|
133 |
} |
|
134 |
|
|
135 |
// Comprobamos que no sea un rmf propio, osea, que contenga xml |
|
136 |
if (pathname.getName().toLowerCase().endsWith(".rmf")) { |
|
137 |
FileInputStream reader = null; |
|
138 |
try { |
|
139 |
reader = new FileInputStream(pathname); |
|
140 |
String xml = ""; |
|
141 |
for (int i = 0; i < 6; i++) { |
|
142 |
xml += (char) reader.read(); |
|
143 |
} |
|
144 |
if (xml.equals("<?xml ")) { |
|
145 |
return false; |
|
146 |
} |
|
147 |
} catch (Exception e) { |
|
148 |
} finally { |
|
149 |
try { |
|
150 |
reader.close(); |
|
151 |
} catch (Exception e) { |
|
152 |
} |
|
153 |
} |
|
154 |
} |
|
155 |
String ext=pathname.getAbsolutePath(); |
|
156 |
if (ext.indexOf(".") != -1) { |
|
157 |
ext = ext.substring(ext.lastIndexOf(".") + 1, ext.length()); |
|
158 |
} |
|
159 |
|
|
160 |
if (acceptedExtensions.contains(ext)){ |
|
161 |
return true; |
|
162 |
}else{ |
|
163 |
return false; |
|
164 |
} |
|
165 |
} |
|
166 |
|
|
167 |
@Override |
|
168 |
public boolean closeResourceRequested(ResourceProvider resource) { |
|
169 |
return !(this.equals(resource)); |
|
170 |
} |
|
171 |
|
|
172 |
@Override |
|
173 |
public void resourceChanged(ResourceProvider resource) { |
|
174 |
//Do nothing |
|
175 |
} |
|
176 |
|
|
177 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster/org.gvsig.raster.gdal/org.gvsig.raster.gdal.provider/src/main/java/org/gvsig/raster/gdal/provider/RasterGdalStoreProvider.java | ||
---|---|---|
1 |
/* 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.raster.gdal.provider; |
|
24 |
|
|
25 |
import java.io.File; |
|
26 |
import java.util.ArrayList; |
|
27 |
import java.util.Arrays; |
|
28 |
import java.util.List; |
|
29 |
import java.util.Vector; |
|
30 |
|
|
31 |
import org.apache.commons.io.FilenameUtils; |
|
32 |
import org.cresques.cts.IProjection; |
|
33 |
import org.gdal.gdal.Band; |
|
34 |
import org.gdal.gdal.Dataset; |
|
35 |
import org.gdal.gdal.GCP; |
|
36 |
import org.gdal.gdal.gdal; |
|
37 |
import org.gdal.gdalconst.gdalconstConstants; |
|
38 |
import org.gvsig.fmap.dal.DALLocator; |
|
39 |
import org.gvsig.fmap.dal.DataManager; |
|
40 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
41 |
import org.gvsig.fmap.dal.DataStore; |
|
42 |
import org.gvsig.fmap.dal.DataStoreNotification; |
|
43 |
import org.gvsig.fmap.dal.FileHelper; |
|
44 |
import org.gvsig.fmap.dal.exception.CloseException; |
|
45 |
import org.gvsig.fmap.dal.exception.DataException; |
|
46 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
47 |
import org.gvsig.fmap.dal.exception.OpenException; |
|
48 |
import org.gvsig.fmap.dal.exception.ReadException; |
|
49 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
|
50 |
import org.gvsig.fmap.dal.raster.api.RasterQuery; |
|
51 |
import org.gvsig.fmap.dal.raster.spi.AbstractRasterStoreProvider; |
|
52 |
import org.gvsig.fmap.dal.resource.ResourceAction; |
|
53 |
import org.gvsig.fmap.dal.resource.exception.AccessResourceException; |
|
54 |
import org.gvsig.fmap.dal.resource.file.FileResource; |
|
55 |
import org.gvsig.fmap.dal.resource.spi.ResourceConsumer; |
|
56 |
import org.gvsig.fmap.dal.resource.spi.ResourceProvider; |
|
57 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer; |
|
58 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters; |
|
59 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
|
60 |
import org.gvsig.fmap.geom.Geometry; |
|
61 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
62 |
import org.gvsig.fmap.geom.exception.CreateEnvelopeException; |
|
63 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
64 |
import org.gvsig.metadata.MetadataLocator; |
|
65 |
import org.gvsig.metadata.MetadataManager; |
|
66 |
import org.gvsig.metadata.exceptions.MetadataException; |
|
67 |
import org.gvsig.raster.lib.buffer.api.Buffer; |
|
68 |
import org.gvsig.raster.lib.buffer.api.BufferLocator; |
|
69 |
import org.gvsig.raster.lib.buffer.api.BufferManager; |
|
70 |
import org.gvsig.raster.lib.buffer.api.NoData; |
|
71 |
import org.gvsig.raster.lib.buffer.api.PageManager; |
|
72 |
import org.gvsig.raster.lib.buffer.api.exceptions.BufferException; |
|
73 |
import org.gvsig.tools.ToolsLocator; |
|
74 |
import org.gvsig.tools.dynobject.DynObject; |
|
75 |
import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException; |
|
76 |
import org.gvsig.tools.exception.BaseException; |
|
77 |
import org.gvsig.tools.locator.LocatorException; |
|
78 |
import org.gvsig.tools.task.SimpleTaskStatus; |
|
79 |
import org.gvsig.tools.task.TaskStatusManager; |
|
80 |
import org.slf4j.Logger; |
|
81 |
import org.slf4j.LoggerFactory; |
|
82 |
|
|
83 |
|
|
84 |
/** |
|
85 |
* Provider for Raster GDAL files |
|
86 |
* @author dmartinezizquierdo |
|
87 |
* |
|
88 |
*/ |
|
89 |
public class RasterGdalStoreProvider extends AbstractRasterStoreProvider implements |
|
90 |
ResourceConsumer{ |
|
91 |
|
|
92 |
private static final Logger logger = |
|
93 |
LoggerFactory.getLogger(RasterGdalStoreProvider.class); |
|
94 |
|
|
95 |
public static String NAME = "RasterGdal"; |
|
96 |
public static String DESCRIPTION = "Raster GDAL file"; |
|
97 |
public static final String METADATA_DEFINITION_NAME = NAME; |
|
98 |
|
|
99 |
private ResourceProvider resource; |
|
100 |
private final SimpleTaskStatus taskStatus; |
|
101 |
|
|
102 |
private Envelope envelope = null; |
|
103 |
private IProjection projection= null; |
|
104 |
private Dataset gdalDataSet; |
|
105 |
|
|
106 |
|
|
107 |
public Dataset getGdalDataSet() { |
|
108 |
return gdalDataSet; |
|
109 |
} |
|
110 |
|
|
111 |
protected static void registerMetadataDefinition() |
|
112 |
throws MetadataException { |
|
113 |
MetadataManager manager = MetadataLocator.getMetadataManager(); |
Also available in: Unified diff