public class BleggGeographicGrid extends GeographicGrid
Class containing codec functions to compress or uncompress a GeographicGrid in the BLEGG format (Bit Level Encoded Geographic Grid)
Format Specification :
5 bytes : "BLEGG"
4 bytes : integer (java),
block size
4 bytes : integer (java), number of lines
4 bytes :
integer (java), number of columns
4 bytes : integer (java), scale
(terrain length = int value/scale)
8 bytes : double (java), x0 (x
coordinate of the upper-left corner)
8 bytes : double (java), y0 (y
coordinate of the upper-left corner)
8 bytes : double (java), total width
of the grid (terrain coordinates)
8 bytes : double (java), total height
of the grid (terrain coordinates)
4 bytes : integer value in the first
line, first column
4 bytes : integer value in the first line, second
column
n blocks follow : Ils décrivent la matrice suivant un parcours en zigzag (gauche-droite pour les lignes paires et droite-gauche pour les lignes impaires) commençant à la première ligne et 3ème colonne.
Chaque valeur codée représente la différence
(n-(n-1)) -
((n-1)-(n-2)) c'est à dire la variation de la pente
Description d'un
bloc 1er octet : entier représentant le nombre de bits servant à stocker
chaque valeur
p octets : p = taille bloc x valeur stockée dans le premier
octet / 8
Chaque groupe de nbBits sert à coder une valeur de la
matrice.
Le premier groupe du premier bloc représente la 3eme colonne de
la premiere ligne.
C'est la différence des différences entre valeurs
successives qui est codée :
C3 = (valeur3-valeur2) -
(valeur2-valeur1)
Rappelons que le parcours des blocs décrit la matrice
en zig-zag
Le dernier blocs peut être légèrement plus grand que
nécessaire.
Grid.InterpolationMethod| Constructor and Description |
|---|
BleggGeographicGrid(InputStream is)
Construct a GeographicGrid of floats from a compressed stream
|
| Modifier and Type | Method and Description |
|---|---|
static void |
compress(double[][][] values,
int scale,
int groupSize,
double x0,
double y0,
double gridWidth,
double gridHeight,
OutputStream os)
Compress and write a grid of double at the bit level
|
static void |
compress(double[][][] values,
int scale,
int groupSize,
OutputStream os)
Compress and write a grid of double at the bit level
|
int |
getGroupSize() |
void |
setGroupSize(int groupSize) |
static void |
write(GeographicGrid gg,
OutputStream os)
Write a GeographicGrid in a Blegg-compressed format.
|
bilinearInterpolation, equals, getColumnNumber, getContext, getDX, getDY, getGridHeight, getGridWidth, getRowNumber, getScale, getValue, getValues, getValues, getX0, getXL, getY0, getYL, hashCode, setScale, setValue, toString, toStringAllpublic BleggGeographicGrid(InputStream is) throws Exception
Construct a GeographicGrid of floats from a compressed stream
is - input streamExceptionpublic int getGroupSize()
public void setGroupSize(int groupSize)
public static void compress(double[][][] values,
int scale,
int groupSize,
OutputStream os)
throws Exception
Compress and write a grid of double at the bit level
values - grid of double values. The array of array is supposed to be
rectangle.scale - scale factor used to transform doubles values to int : each
value will be considered equal to Math.rint(value*scale)groupSize - is the number of consecutive values coded with the same
bit number (default is 16).os - outputStreamExceptionpublic static void compress(double[][][] values,
int scale,
int groupSize,
double x0,
double y0,
double gridWidth,
double gridHeight,
OutputStream os)
throws Exception
Compress and write a grid of double at the bit level
values - grid of double values. The array of array is supposed to be
rectangle.scale - scale factor used to transform doubles values to int : each
value will be considered equal to Math.rint(value*scale)groupSize - is the number of consecutive values coded with the same
bit number (default is 16).x0 - longitude origine (may be negative)y0 - latitude maximumgridWidth - in degreesgridHeight - in degreesos - output streamExceptionpublic static void write(GeographicGrid gg, OutputStream os) throws Exception
Write a GeographicGrid in a Blegg-compressed format.
gg - grid to write.os - OutputStreamExceptionCopyright © 2019 CNRS. All rights reserved.