Class LayerableUtil
java.lang.Object
org.openjump.core.ui.util.LayerableUtil
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcopyWorldFile(Layer layer, String path) Simple method to copy a file (as worldfile)static voidExportImage(PlugInContext context, Layer layer, String path) Export Image: simple method to save an image file, loaded to a folde by Layer.class, with corresponding worldfile, if existsstatic voidExportRasterProjection(PlugInContext context, RasterImageLayer layer, String proj, String path) Export .prj projection auxiliary file for sextante raster imagestatic voidExportRasterStyleToSLD(PlugInContext context, RasterImageLayer rLayer, String path) Export RasterImage layer styles as SLDstatic voidExportSextanteRaster(PlugInContext context, RasterImageLayer layer, String path) Export Sextante Raster layerable to TIFstatic voidExportVector(PlugInContext context, Layer layer, String path) Export vector layer as SHP or JML depending on the geometriesstatic voidExportVectorProjection(PlugInContext context, Layer layer, String proj, String path) Export .prj projection auxiliary file for vector/image layerstatic voidExportVectorStyleToSLD(PlugInContext context, Layer layer, String path) Export Vector layer styles as SLD This part of the code derives from de.latlon.deejump.plugin.style.LayerStyle2SLDPlugIn.class and it has been modified to automatically export SLD files for vectorsstatic StringReturn the path of the file associated to a ReferencedImage layer /* EX. c:\folder\image.tifstatic StringgetFilePath(Layer layer) static StringgetFilePath(RasterImageLayer layer) RasterImageLayer.classstatic StringgetFileType(File file) input filestatic StringgetGeometryType(Layer layer) static StringgetLayerSourceClass(Layer layer) static Stringstatic doublegetValidArea(Layer layer) Returns the area of feature collection (only Polygons or MultiPolygons) in the selected Vector Layer.class.static doublegetValidArea(RasterImageLayer layer) Returns the area of selected RasterImageLayer.class.static Stringstatic booleanLayer.classstatic booleanisDataStore(Layer layer) Layer.classstatic booleanLayer.classstatic booleanLayer.classstatic booleanisLinealLayer(FeatureCollection featureCollection) Check if selected FeatureCollection has only linestring and/or multilinestring and/or multilinearings (Shapefile model)static booleanisLinealLayer(Layer layer) Check if selected layer has only linestring and/or multilinestring and/or multilinearingsstatic booleanisMixedGeometryType(FeatureCollection featureCollection) Check if selected FeatureCollection has geoemtries of different typesstatic booleanisMixedGeometryType(Layer layer) Check if selected layer has geoemtries of different typesstatic booleanisModified(Layer layer) static booleanisModified(RasterImageLayer layer) RasterImageLayer.classstatic booleanisMonoband(RasterImageLayer layer) RasterImageLayer.classstatic booleanisMultipleImages(Layer layer) Layer.classstatic booleanisPointLayer(FeatureCollection featureCollection) Check if selected featureCollection has only points and/or multipointsstatic booleanisPointLayer(Layer layer) Check if selected layer has only points and/or multipointsstatic booleanisPolygonalLayer(FeatureCollection featureCollection) check if selected featureCollection has only polygons and/or multipolygonsstatic booleanisPolygonalLayer(Layer layer) check if selected layer has only polygons and/or multipolygonsstatic booleanisSpatiallyEqualTo(RasterImageLayer rLayer1, RasterImageLayer rLayer2) Boolean to verify if a <RasterImageLayer> rLayer1 is spatially equivalent to another <RasterImageLayer> rLayer2static booleanisTemporary(Layer layer) Layer.classstatic booleanisTemporary(RasterImageLayer layer) RasterImageLayer.classbooleanLayer.classstatic voidstatic StringworldFilepath(Layer layer) Return path/name of a worldfile associated to a ReferencedImage layer /* Ex. if c:\folder\image.tif exists, it returns c:\folder\image.tfw
-
Field Details
-
filetype
-
-
Constructor Details
-
LayerableUtil
public LayerableUtil()
-
-
Method Details
-
isSpatiallyEqualTo
public static boolean isSpatiallyEqualTo(RasterImageLayer rLayer1, RasterImageLayer rLayer2) throws IOException Boolean to verify if a <RasterImageLayer> rLayer1 is spatially equivalent to another <RasterImageLayer> rLayer2- Parameters:
rLayer1- first layerrLayer2- second layer- Returns:
- true if they are equivalent. False if they are not equivalent
- Throws:
IOException- if an IOException occurs during layer reading
-
isTemporary
RasterImageLayer.class- Parameters:
layer- the layer to test- Returns:
- true if selected sextante raster (RasterImageLayer.class) is Temporary layer (layer stored into TEMP folder)
-
isModified
RasterImageLayer.class- Parameters:
layer- the layer to test- Returns:
- true if selected sextante raster (RasterImageLayer.class) has been modified
-
isMonoband
RasterImageLayer.class- Parameters:
layer- the RasterImageLayer to test- Returns:
- true if selected sextante raster layer is monoband layer
-
getFilePath
RasterImageLayer.class- Parameters:
layer- the layer to query- Returns:
- the File path of a sextante raster (RasterImageLayer.class) eg. C/File/imagename.tif
-
isTemporary
Layer.class- Parameters:
layer- the layer to test- Returns:
- true if the layer (Layer.class) is a temporary layer Both layers in memory and layers stored into TEMP folder are considered as "Temporary layers"
-
isModified
- Parameters:
layer- the layer to test- Returns:
- true if the layer (Layer.class) has been modified
-
isVector
Layer.class- Parameters:
layer- the layer to test- Returns:
- true if the layer (Layer,class) is a vector layer Eg. layer with datastore belonging to Shapefile, JML or GML file). This method excludes Datastores and Image file loaded by Layer,class
-
isImage
Layer.class- Parameters:
layer- the layer to test- Returns:
- true if the layer (Layer.class) belongs form an image file (eg. JPG, TIF, ECW)
-
isMultipleImages
Layer.class- Parameters:
layer- the layer to test- Returns:
- true if the Layer (Layer.class) is a collection of Image layers (eg. JPG, TIF, ECW)
-
isDataStore
Layer.class- Parameters:
layer- the layer to test- Returns:
- true if the layer (Layer.class) is a datastore layer (eg. Oracle, SpatiaLite, MySQL)
-
isCad
Layer.class- Parameters:
layer- the layer to test- Returns:
- true Check if the layer is a cad Layer following DXF PlugIn schema it defines Cad layer with the presence of COLOR and TEXT attributes
-
isEmpty
Layer.class- Parameters:
layer- the layer to test- Returns:
- true if the layer is empty
-
isPolygonalLayer
check if selected layer has only polygons and/or multipolygons- Parameters:
layer- the layer to test- Returns:
- boolean - true if the vector layer has only polygon/multipolygon geometries (Shapefile model)
-
isPolygonalLayer
check if selected featureCollection has only polygons and/or multipolygons- Parameters:
featureCollection- the feature collection to test- Returns:
- boolean - true if the vector layer has only polygon/multipolygon geometries (Shapefile model)
-
isPointLayer
Check if selected layer has only points and/or multipoints- Parameters:
layer- the layer to test- Returns:
- boolean - true if the vector layer has only point/multipoint geometries (Shapefile model)
-
isPointLayer
Check if selected featureCollection has only points and/or multipoints- Parameters:
featureCollection- the feature collection to test- Returns:
- boolean - true if the vector layer has only point/multipoint geometries (Shapefile model)
-
isLinealLayer
Check if selected layer has only linestring and/or multilinestring and/or multilinearings- Parameters:
layer- the layer to test- Returns:
- boolean - true if the vector layer has only LineString/MultiLineString geometries (Shapefile model)
-
isLinealLayer
Check if selected FeatureCollection has only linestring and/or multilinestring and/or multilinearings (Shapefile model)- Parameters:
featureCollection- the feature collection to test- Returns:
- boolean - true if the vector layer has only LineString/MultiLineString geometries (Shapefile model)
-
isMixedGeometryType
Check if selected layer has geoemtries of different types- Parameters:
layer- the layer to test- Returns:
- true if the selected layer has features of different geometries types (Shapefile model) (Shapefile model)
-
isMixedGeometryType
Check if selected FeatureCollection has geoemtries of different types- Parameters:
featureCollection- the feature collection to test- Returns:
- true if the selected layer has features of different geometries types (Shapefile model)
-
getGeometryType
-
getFilePath
-
getLayerSourceClass
-
getFileType
-
getVectorImageFileDescription
-
getRasterFileDescription
- Parameters:
layer- the Raster image layer- Returns:
- a description of raster image layer ex. "GEOTIF/TIFF - Tagged Image File Format" if the file extension is not into the enum list it returns only the extension (eg. "MAP")
-
ExportVector
Export vector layer as SHP or JML depending on the geometries- Parameters:
context- the plugin contextlayer- a layerpath- the path to export to
-
ExportSextanteRaster
Export Sextante Raster layerable to TIF- Parameters:
context- plugin contextlayer- the RasterImageLayer to exportpath- the path to export to
-
ExportImage
Export Image: simple method to save an image file, loaded to a folde by Layer.class, with corresponding worldfile, if exists- Parameters:
context- the plugin contextlayer- the image layer to exportpath- the path to export the image to- Throws:
IOException- if an IOException occurs during export
-
ExportVectorStyleToSLD
public static void ExportVectorStyleToSLD(PlugInContext context, Layer layer, String path) throws Exception Export Vector layer styles as SLD This part of the code derives from de.latlon.deejump.plugin.style.LayerStyle2SLDPlugIn.class and it has been modified to automatically export SLD files for vectors- Parameters:
context- the plugin contextlayer- the layer whose style to exportpath- the path to export to- Throws:
IOException- if an IOException occurs during SLD writingException
-
ExportRasterStyleToSLD
public static void ExportRasterStyleToSLD(PlugInContext context, RasterImageLayer rLayer, String path) Export RasterImage layer styles as SLD- Parameters:
context- the plugin contextrLayer- the RasterImageLayer to exportpath- the path to export to
-
ExportVectorProjection
public static void ExportVectorProjection(PlugInContext context, Layer layer, String proj, String path) throws IOException Export .prj projection auxiliary file for vector/image layer- Parameters:
context- the plugin contextlayer- the layer to exportproj- OGC wkt projection codepath- the path to export to- Throws:
IOException- if an IOException occurs during export
-
ExportRasterProjection
public static void ExportRasterProjection(PlugInContext context, RasterImageLayer layer, String proj, String path) throws IOException Export .prj projection auxiliary file for sextante raster image- Parameters:
context- the plugin contextlayer- the rasterImageLayerproj- OGC wkt projection codepath- the path to export to- Throws:
IOException- if an IOException occurs during export
-
copyWorldFile
Simple method to copy a file (as worldfile)- Parameters:
layer- the image layer whose worldfile we want to copypath- the path to copy to- Throws:
IOException- if an IOException occurs during world file writing
-
filepath
-
worldFilepath
Return path/name of a worldfile associated to a ReferencedImage layer /* Ex. if c:\folder\image.tif exists, it returns c:\folder\image.tfw- Parameters:
layer- the layer whose worldfile path we want to know- Returns:
- the path of the worldfile associated to the layer
-
getValidArea
Returns the area of feature collection (only Polygons or MultiPolygons) in the selected Vector Layer.class. This method exclude area of the layer which are not covered by feature- Parameters:
layer- a Layer- Returns:
- area as a double
-
getValidArea
Returns the area of selected RasterImageLayer.class. This method excludes cells with no data value- Parameters:
layer- RasterImageLayer- Returns:
- area as a double
- Throws:
IOException
-
main
-