|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ontimize.util.gis.common.GisUtilities
public class GisUtilities
Class with static methods of extended use on the internal gis processes
| Field Summary | |
|---|---|
static java.lang.String |
GEOMETRY
|
static boolean |
loggerExists
|
static java.lang.String |
RASTER
|
| Constructor Summary | |
|---|---|
GisUtilities()
|
|
| Method Summary | |
|---|---|
static void |
addLog(java.lang.Object o,
int level)
Add the current message to the gis log |
static byte[] |
bufferedImageToByteArray(java.awt.image.BufferedImage img)
Converts a buffered image to a byte array |
static java.awt.image.BufferedImage |
byteArrayToBufferedImage(byte[] byteArray)
Converts a byte array to a buffered image |
static java.awt.image.BufferedImage |
byteArrayToVolatileImage(byte[] byteArray)
Converts a byte array to a volatile image |
static com.vividsolutions.jts.geom.Envelope[] |
calculateRemainingBoxes(com.vividsolutions.jts.geom.Envelope prevBoundingBox,
com.vividsolutions.jts.geom.Envelope postBoundingBox)
Obtains the intersected envelopes obtained from two given bounding boxes, used to improve the request of data when using a gis panel in panning state |
static boolean |
checkDataIsInKeyList(java.util.Hashtable data,
java.util.List<java.lang.Object> keyList,
java.lang.String keyName)
Check if the data record has some of the given keys |
static boolean |
checkTransparentRasterLayer(IGisLayer layer)
Check if the given layer has a transparent WMS server as data provider |
static java.util.List<IGisLayer> |
cloneLayersList(java.util.List<IGisLayer> layersList)
Get a copy of the given layers list |
static com.ontimize.db.EntityResult |
convertByteArraysToImages(com.ontimize.db.EntityResult data)
Converts the byte arrays inside an EntityResult to buffered images, those array must be inside de EntityResult using the key "raster" |
static java.util.List<java.util.Hashtable> |
convertHashtableToLayerData(java.util.Hashtable data)
Convert the given Hashtable with data to a data array |
static com.ontimize.db.EntityResult |
convertLayerDataToEntityResult(java.util.List<java.util.Hashtable> layerData)
Conver the given data list to a Ontimize EntityResult |
static com.vividsolutions.jts.geom.Envelope |
copyEnvelopeAndExpand(com.vividsolutions.jts.geom.Envelope area,
double distance)
Get a copy of the given envelope and expands its extension with the given distance value |
static java.awt.image.BufferedImage |
createBuffer(int width,
int height,
int transparency)
Creates a buffered image based on the machine graphics environment. |
static boolean |
deleteDir(java.io.File dir)
|
static java.util.Hashtable |
entityResultToHashtable(com.ontimize.db.EntityResult res)
Convert the Ontimize EntityResult to a Hashtable |
static java.util.Hashtable |
expandInitParamsWithDefault(java.lang.String className,
java.util.Hashtable initParams)
Expand the init class parameters with the parameters defined on the Ontimize xml parameters definition file |
static com.vividsolutions.jts.geom.Envelope[] |
fragmentArea(com.vividsolutions.jts.geom.Envelope totalArea,
boolean fragmentation,
double fragmentSide)
Fragment the given area in smaller parts in order to request data, considering the size of each part a double value |
static com.vividsolutions.jts.geom.Envelope[] |
fragmentAreas(com.vividsolutions.jts.geom.Envelope[] totalAreas,
boolean fragmentation,
double fragmentSide)
Separate the given request areas into smaller areas |
static com.vividsolutions.jts.geom.Envelope[] |
fragmentIntegerArea(com.vividsolutions.jts.geom.Envelope totalArea,
boolean fragmentation,
double fragmentSide)
Fragment the given area in smaller parts in order to request data, considering the size of each part an integer value |
static ICacheElement |
getCacheClassNameFromDataProvider(IDataProviderDefinition dataProvider)
Gets the cache class instance from the related data provider parameter |
static java.util.Hashtable |
getCacheParametersFromDataProvider(IDataProviderDefinition dataProvider)
|
static java.awt.Rectangle |
getClipBoundsForEnvelope(com.vividsolutions.jts.geom.Envelope dataBBox,
com.vividsolutions.jts.geom.Envelope boundingBox,
java.awt.Rectangle panelRect,
double strokeWidth)
Get the clip bounds for the data area defined at the current gis map viewer |
static int[] |
getCoordinateLocationOnPanel(com.vividsolutions.jts.geom.Coordinate coordinate,
com.vividsolutions.jts.geom.Envelope boundingBox,
java.awt.Rectangle bounds)
Get the screen location for the given geographic coordinate |
static double[] |
getCursorLocation(java.awt.event.MouseEvent ev,
com.vividsolutions.jts.geom.Envelope boundingBox,
java.awt.Rectangle bounds)
Gets the geographic cursor location |
static java.util.List<java.lang.String> |
getDataProviderKeysFromLayer(IGisLayer layer)
Return the list of key columns name related to the data provider of a given layer |
static java.util.Hashtable |
getDefaultLabelList()
Get the default label list |
static com.vividsolutions.jts.geom.Envelope |
getEnvelopeForClipBounds(java.awt.Rectangle clip,
com.vividsolutions.jts.geom.Envelope boundingBox,
java.awt.Rectangle panelRect)
Get the map envelope for the given clip bounds at the actual map viewer |
static com.vividsolutions.jts.geom.Envelope |
getEnvelopeFromDataRecord(java.util.Map recordData)
Get the envelope values from the geographic data stored on the given data record |
static com.vividsolutions.jts.geom.Envelope |
getEnvelopeFromFilters(java.lang.Object appliedFilters)
Return the bounding box envelope from defined filters |
static com.vividsolutions.jts.geom.Envelope[] |
getEnvelopesFromFilters(java.lang.Object appliedFilters)
Return the bounding boxes envelopes from defined filters |
static long |
getFileSize(java.io.File folder)
Get folder size in bytes |
static boolean |
getForceQueryValueFromFilters(java.lang.Object appliedFilters)
Return the "force server query" value from defined filters |
static boolean |
getFragmentRequestEnabled(IGisLayer layer)
Check if the current layer has requests fragmentation enabled |
static int |
getFragmentSize(IGisLayer layer)
Gets the fragment side size expressed on the given gis layer |
static com.vividsolutions.jts.geom.Geometry |
getGeometryFromEnvelope(com.vividsolutions.jts.geom.Envelope actualRecordBBox)
Transforms a given bounding box to geometry format |
static java.lang.String |
getGeometryTypeFromLayer(IGisLayer layer)
Return the geometry type name related to a given layer |
static java.util.List<java.lang.String> |
getKeyColumnsFromLayer(IGisLayer layer)
Get the key column names for the given layer data provider |
static java.util.List<java.lang.String> |
getKeysFromDataProviderParameters(java.util.Hashtable<java.lang.String,java.lang.Object> parameters)
Return the list of key columns name related to the data provider of a given layer |
static java.lang.Object |
getLayerIdFromLayerKeys(java.lang.Object layerKeys)
Gets the layer id inside the layer heys hashtable |
static java.lang.Object |
getLayersConfigurationIdFromLayerKeys(java.lang.Object layerKeys)
Gets the layer configuration id inside the layer heys hashtable |
static double |
getNearestPixelSize(double prevPixelSize,
java.lang.String scales)
Gets the nearest pizel size |
static java.lang.Double |
getPixelSizeFromFilters(java.lang.Object appliedFilters)
Return the pixel size value from defined filters |
static double[] |
getPointLocation(java.awt.Point point,
com.vividsolutions.jts.geom.Envelope boundingBox,
java.awt.Rectangle bounds)
Get the geographic point location for the given area |
static java.util.Vector<java.lang.String> |
getVisibleColumns(java.util.List<java.util.Hashtable> layerData,
IGisLayer layer)
Get the layer visible columns used to show on the filter definition table |
static boolean |
layerIsInValidScale(double pixelSize,
IGisLayer layer)
Checks is given layer can be visible for the actual scale |
static com.vividsolutions.jts.geom.Envelope[] |
orderAreasByDistanceToCenter(double centerX,
double centerY,
com.vividsolutions.jts.geom.Envelope[] areasArray)
Rearranges the bounding boxes array from nearest to farthest from a given location |
static com.vividsolutions.jts.geom.Envelope |
parseBBoxFromString(java.lang.String bboxString)
Get bounding box definition from given string representation |
static com.vividsolutions.jts.geom.Envelope |
parseDefaultBBoxFromPreferenceList(java.lang.String bboxesListString)
Get the default viewer bounding box from the preferred bounding boxes list |
static int[] |
parseDimensionFromString(java.lang.String dimensionsString)
Get dimension from given string representation |
static java.util.Hashtable |
parseFiltersFromString(java.lang.String filtersRepresentation)
Parse the defined filters from its corresponding text definition |
static double[] |
parseScales(java.lang.String scalesString)
Transforms and string format scales definition to its corresponding array |
static java.lang.String |
parseStringFromBBox(com.vividsolutions.jts.geom.Envelope bbox)
Get the string representation of a given bounding box |
static java.lang.String |
parseStringFromFilters(java.util.Hashtable filters)
Get the string representation for the filters Hashtable |
static java.io.InputStream |
parseStringToInputSream(java.lang.String xml)
Parse a xml definition with UTF-8 coding in String format to an InputStream |
static com.vividsolutions.jts.geom.Envelope[] |
prevFragmentArea(com.vividsolutions.jts.geom.Envelope totalArea,
boolean fragmentation,
double fragmentSide)
Fragment the given area in smaller parts in order to request data |
static boolean |
recordHasParentKeys(java.util.Hashtable<java.lang.String,java.lang.Object> recordData,
java.util.Hashtable<java.lang.String,java.lang.Object> keys)
Cehck if the current data contains the given parent keys |
static void |
setFiltersEnvelope(java.lang.Object appliedFilters,
com.vividsolutions.jts.geom.Envelope newBBox)
Sets the bounding box envelope for the given filters |
static void |
setLogging(boolean logging)
|
static void |
showGisMonitorWindow(IGisViewer gisViewer)
|
static boolean |
showOnMouseClickAction(IGisLayer gisLayer,
java.util.List<java.util.Hashtable> layerData,
com.vividsolutions.jts.geom.Geometry location,
double pixelSize,
double selectionPrecission,
IGisViewer gisViewer,
java.awt.event.MouseEvent ev)
Show the onMouseClick action for the given map panel configuration |
static boolean |
showOnMouseOverAction(IGisLayer gisLayer,
java.util.List<java.util.Hashtable> layerData,
com.vividsolutions.jts.geom.Geometry location,
double pixelSize,
IGisViewer gisViewer,
java.awt.event.MouseEvent ev)
Show the onMouseOver action for the given map panel configuration |
static boolean |
validDataForFilters(java.util.Hashtable recordValues,
java.lang.Object filters)
Check if the data is valid according to the filters |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static boolean loggerExists
public static final java.lang.String RASTER
public static final java.lang.String GEOMETRY
| Constructor Detail |
|---|
public GisUtilities()
| Method Detail |
|---|
public static void setLogging(boolean logging)
public static boolean deleteDir(java.io.File dir)
public static long getFileSize(java.io.File folder)
folder - Interest folder
public static java.util.Hashtable parseFiltersFromString(java.lang.String filtersRepresentation)
filtersRepresentation - String defining the filters to sue
public static java.lang.String parseStringFromFilters(java.util.Hashtable filters)
filters - Hashtable containing the filters
public static java.util.Hashtable getDefaultLabelList()
throws java.lang.Exception
java.lang.Exception
public static java.util.Hashtable expandInitParamsWithDefault(java.lang.String className,
java.util.Hashtable initParams)
className - Class name to get the parametersinitParams - Initial parameters for the class
public static boolean checkTransparentRasterLayer(IGisLayer layer)
layer - Interest layer
public static com.vividsolutions.jts.geom.Envelope getEnvelopeForClipBounds(java.awt.Rectangle clip,
com.vividsolutions.jts.geom.Envelope boundingBox,
java.awt.Rectangle panelRect)
clip - Clip boundsboundingBox - Actual map viewer bounding boxpanelRect - Actual map viewer panel dimension
public static java.awt.Rectangle getClipBoundsForEnvelope(com.vividsolutions.jts.geom.Envelope dataBBox,
com.vividsolutions.jts.geom.Envelope boundingBox,
java.awt.Rectangle panelRect,
double strokeWidth)
dataBBox - Data bounding boxboundingBox - Map viewer bounding boxpanelRect - Map viewer panel dimensionstrokeWidth - Actual map viewer stroke width
public static com.ontimize.db.EntityResult convertLayerDataToEntityResult(java.util.List<java.util.Hashtable> layerData)
layerData - List containing data
public static java.util.List<java.util.Hashtable> convertHashtableToLayerData(java.util.Hashtable data)
data - Hashtable containing data
public static java.util.Hashtable entityResultToHashtable(com.ontimize.db.EntityResult res)
res - data EntityResult to convert
public static java.util.Vector<java.lang.String> getVisibleColumns(java.util.List<java.util.Hashtable> layerData,
IGisLayer layer)
layerData - Actual layer datalayer - Layer identifier
public static java.awt.image.BufferedImage createBuffer(int width,
int height,
int transparency)
width - Image width in pixelsheight - Image height in pixelstransparency - Image transparency
public static java.util.List<IGisLayer> cloneLayersList(java.util.List<IGisLayer> layersList)
layersList - Layers list to copy
public static com.ontimize.db.EntityResult convertByteArraysToImages(com.ontimize.db.EntityResult data)
data - EntityResult containing the bytes array data using the key "raster"
public static java.awt.image.BufferedImage byteArrayToBufferedImage(byte[] byteArray)
throws java.lang.Exception
byteArray - byte array to convert
ImageFormatException
java.io.IOException
java.lang.Exception
public static java.awt.image.BufferedImage byteArrayToVolatileImage(byte[] byteArray)
throws java.lang.Exception
byteArray - byte array to convert
ImageFormatException
java.io.IOException
java.lang.Exception
public static byte[] bufferedImageToByteArray(java.awt.image.BufferedImage img)
throws java.lang.Exception
img - image to convert
ImageFormatException
java.io.IOException
java.lang.Exceptionpublic static com.vividsolutions.jts.geom.Envelope parseBBoxFromString(java.lang.String bboxString)
bboxString - Bounding box string representation
public static com.vividsolutions.jts.geom.Envelope[] fragmentAreas(com.vividsolutions.jts.geom.Envelope[] totalAreas,
boolean fragmentation,
double fragmentSide)
totalAreas - List of areas to fragmentfragmentation - Fragmentation enablingfragmentSide - Side in map units of each individual fragment
public static com.vividsolutions.jts.geom.Envelope[] prevFragmentArea(com.vividsolutions.jts.geom.Envelope totalArea,
boolean fragmentation,
double fragmentSide)
totalArea - Total bounding box to fragmentfragmentation - Value to set fragmentation enabled or notfragmentSide - Size in width and height of each fragment
public static com.vividsolutions.jts.geom.Envelope[] fragmentArea(com.vividsolutions.jts.geom.Envelope totalArea,
boolean fragmentation,
double fragmentSide)
totalArea - Total bounding box to fragmentfragmentation - Value to set fragmentation enabled or notfragmentSide - Size in width and height of each fragment
public static com.vividsolutions.jts.geom.Envelope[] fragmentIntegerArea(com.vividsolutions.jts.geom.Envelope totalArea,
boolean fragmentation,
double fragmentSide)
totalArea - Total bounding box to fragmentfragmentation - Value to set fragmentation enabled or notfragmentSide - Size in width and height of each fragment
public static com.vividsolutions.jts.geom.Envelope[] orderAreasByDistanceToCenter(double centerX,
double centerY,
com.vividsolutions.jts.geom.Envelope[] areasArray)
centerX - X coordinate of the given locationcenterY - Y coordinate of the given locationareasArray - Array of bounding boxes to rearrange
public static int[] parseDimensionFromString(java.lang.String dimensionsString)
dimensionsString - Dimension string representation
public static java.lang.String parseStringFromBBox(com.vividsolutions.jts.geom.Envelope bbox)
bbox - Bounding box to parse
public static com.vividsolutions.jts.geom.Envelope[] getEnvelopesFromFilters(java.lang.Object appliedFilters)
appliedFilters - Hashtable with the defined filters
public static com.vividsolutions.jts.geom.Envelope getEnvelopeFromFilters(java.lang.Object appliedFilters)
appliedFilters - Hashtable with the defined filters
public static boolean getForceQueryValueFromFilters(java.lang.Object appliedFilters)
appliedFilters - Hashtable with the defined filters
public static java.lang.Double getPixelSizeFromFilters(java.lang.Object appliedFilters)
appliedFilters - Hashtable with the defined filters
public static void setFiltersEnvelope(java.lang.Object appliedFilters,
com.vividsolutions.jts.geom.Envelope newBBox)
appliedFilters - Hashtable with the defined filtersnewBBox - New bounding boxpublic static java.lang.Object getLayerIdFromLayerKeys(java.lang.Object layerKeys)
layerKeys - Hashtable containing the layer id and its related
layers configuration id
public static java.lang.Object getLayersConfigurationIdFromLayerKeys(java.lang.Object layerKeys)
layerKeys - Hashtable containing the layer id and its related
layers configuration id
public static com.vividsolutions.jts.geom.Geometry getGeometryFromEnvelope(com.vividsolutions.jts.geom.Envelope actualRecordBBox)
actualRecordBBox - Bouding box to transform
public static java.io.InputStream parseStringToInputSream(java.lang.String xml)
xml - String xml definition
public static double getNearestPixelSize(double prevPixelSize,
java.lang.String scales)
prevPixelSize - Actual pixel sizescales - Available pixel sizes array
public static double[] parseScales(java.lang.String scalesString)
scalesString - Definition of the scales array in String format
public static java.util.List<java.lang.String> getDataProviderKeysFromLayer(IGisLayer layer)
layer - Layer definition
public static java.util.List<java.lang.String> getKeyColumnsFromLayer(IGisLayer layer)
layer - Layer to get keys
public static java.util.List<java.lang.String> getKeysFromDataProviderParameters(java.util.Hashtable<java.lang.String,java.lang.Object> parameters)
parameters - Data provider parameters hashtable
public static java.lang.String getGeometryTypeFromLayer(IGisLayer layer)
layer - Layer definition
public static com.vividsolutions.jts.geom.Envelope[] calculateRemainingBoxes(com.vividsolutions.jts.geom.Envelope prevBoundingBox,
com.vividsolutions.jts.geom.Envelope postBoundingBox)
prevBoundingBox - Previous panel bounding boxpostBoundingBox - Posterior panel bounding box
public static void addLog(java.lang.Object o,
int level)
o - Message to loglevel - Message priority level
public static boolean layerIsInValidScale(double pixelSize,
IGisLayer layer)
pixelSize - Actual pixel size, which gives us the actual map scalelayer - Layer to check scalespublic static ICacheElement getCacheClassNameFromDataProvider(IDataProviderDefinition dataProvider)
dataProvider - Data provider definition
public static java.util.Hashtable getCacheParametersFromDataProvider(IDataProviderDefinition dataProvider)
public static boolean getFragmentRequestEnabled(IGisLayer layer)
layer - Gis layer
public static int getFragmentSize(IGisLayer layer)
layer - Gis layer
public static boolean validDataForFilters(java.util.Hashtable recordValues,
java.lang.Object filters)
recordValues - Data pending of validationfilters - Filters to validate data
public static double[] getCursorLocation(java.awt.event.MouseEvent ev,
com.vividsolutions.jts.geom.Envelope boundingBox,
java.awt.Rectangle bounds)
ev - MouseEvent indicating the mouse position on the gis panelboundingBox - Map panel bounding boxbounds - Map panel size
public static double[] getPointLocation(java.awt.Point point,
com.vividsolutions.jts.geom.Envelope boundingBox,
java.awt.Rectangle bounds)
point - Point location on screen coordinatesboundingBox - Map panel bounding boxbounds - Map panel size
public static int[] getCoordinateLocationOnPanel(com.vividsolutions.jts.geom.Coordinate coordinate,
com.vividsolutions.jts.geom.Envelope boundingBox,
java.awt.Rectangle bounds)
coordinate - Geographic coordinateboundingBox - Map panel bounding boxbounds - Map panel size
public static boolean recordHasParentKeys(java.util.Hashtable<java.lang.String,java.lang.Object> recordData,
java.util.Hashtable<java.lang.String,java.lang.Object> keys)
recordData - Data to validatekeys - Parent keys
public static boolean checkDataIsInKeyList(java.util.Hashtable data,
java.util.List<java.lang.Object> keyList,
java.lang.String keyName)
data - Data recordkeyList - List of possible key valueskeyName - Field name containing the interest key
public static boolean showOnMouseOverAction(IGisLayer gisLayer,
java.util.List<java.util.Hashtable> layerData,
com.vividsolutions.jts.geom.Geometry location,
double pixelSize,
IGisViewer gisViewer,
java.awt.event.MouseEvent ev)
gisLayer - Layer for the actionlayerData - Related layer datalocation - Geographic coordinate for the mouse in the map panelpixelSize - Map panel pixel size on map units / pixelgisViewer - Gis viewer interfaceev - Actual mouseEvent provoking the action
public static boolean showOnMouseClickAction(IGisLayer gisLayer,
java.util.List<java.util.Hashtable> layerData,
com.vividsolutions.jts.geom.Geometry location,
double pixelSize,
double selectionPrecission,
IGisViewer gisViewer,
java.awt.event.MouseEvent ev)
gisLayer - Layer for the actionlayerData - Related layer datalocation - Geographic coordinate for the mouse in the map panelpixelSize - Map panel pixel size on map units / pixelgisViewer - Gis viewer interfaceev - Actual mouseEvent provoking the action
public static com.vividsolutions.jts.geom.Envelope parseDefaultBBoxFromPreferenceList(java.lang.String bboxesListString)
bboxesListString - Bookmarked bounding boxes list definition
public static com.vividsolutions.jts.geom.Envelope copyEnvelopeAndExpand(com.vividsolutions.jts.geom.Envelope area,
double distance)
area - Envelope to expanddistance - Expansion distance
public static com.vividsolutions.jts.geom.Envelope getEnvelopeFromDataRecord(java.util.Map recordData)
recordData - Data record, usually a Hashtable
public static void showGisMonitorWindow(IGisViewer gisViewer)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||