Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dg
dg
Commits
4d2a6feb
Commit
4d2a6feb
authored
Nov 08, 2016
by
Jonathan Lambrechts
Browse files
read tiled geotiff
parent
16eadbc6
Pipeline
#1322
passed with stage
in 34 minutes and 40 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
modules/slimFunction/slimPreEvaluatorGeoTIFF.cpp
View file @
4d2a6feb
...
...
@@ -73,10 +73,9 @@ slimPreEvaluatorGeoTIFF::slimPreEvaluatorGeoTIFF(const char *filename) {
if
(
GTIFKeyGet
(
_gtif
,
GTModelTypeGeoKey
,
&
_modelType
,
0
,
1
)
!=
1
)
Msg
::
Error
(
"no model type defined in geotiff file"
);
if
(
_modelType
==
ModelGeographic
&&
GTIFKeyGet
(
_gtif
,
GeogAngularUnitsGeoKey
,
&
_angularUnit
,
0
,
1
)
==
1
)
if
(
_angularUnit
!=
Angular_Degree
)
Msg
::
Error
(
"geotiff unit is not decimal degrees (Angular_Degree)"
);
if
(
_angularUnit
!=
Angular_Degree
)
Msg
::
Error
(
"geotiff unit is not decimal degrees (Angular_Degree)"
);
printf
(
"model type : %i
\n
"
,
_modelType
);
/*
double *tiepoint;
...
...
@@ -84,11 +83,31 @@ slimPreEvaluatorGeoTIFF::slimPreEvaluatorGeoTIFF(const char *filename) {
TIFFGetField(_tiff, TIFFTAG_GEOTIEPOINTS, &count, &tiepoint);
TIFFGetField(_tiff, TIFFTAG_GEOPIXELSCALE, &count, &tiepoint);
*/
_data
=
new
char
[
bitspersample
/
8
*
_sizex
*
_sizey
];
for
(
int
i
=
0
;
i
<
_sizey
;
++
i
)
{
if
(
TIFFReadScanline
(
_tiff
,
_data
+
i
*
_sizex
*
bitspersample
/
8
,
i
,
0
)
!=
1
)
Msg
::
Error
(
"error reading tiff file %s"
,
filename
);
int
tileWidth
,
tileLength
;
int
datasize
=
bitspersample
/
8
;
_data
=
new
char
[
datasize
*
_sizex
*
_sizey
];
if
(
TIFFGetField
(
_tiff
,
TIFFTAG_TILEWIDTH
,
&
tileWidth
)
==
1
&&
TIFFGetField
(
_tiff
,
TIFFTAG_TILELENGTH
,
&
tileLength
)
==
1
)
{
int
tileSize
=
TIFFTileSize
(
_tiff
);
char
*
buf
=
new
char
[
tileSize
];
for
(
int
y
=
0
;
y
<
_sizey
;
y
+=
tileLength
){
for
(
int
x
=
0
;
x
<
_sizex
;
x
+=
tileWidth
){
TIFFReadTile
(
_tiff
,
buf
,
x
,
y
,
0
,
0
);
for
(
int
j
=
0
;
j
<
tileLength
&&
y
+
j
<
_sizey
;
++
j
)
{
int
s0
=
((
y
+
j
)
*
_sizex
+
x
)
*
datasize
;
int
s1
=
j
*
tileWidth
*
datasize
;
int
l
=
std
::
min
(
tileWidth
,
_sizex
-
x
)
*
datasize
;
memcpy
(
_data
+
s0
,
buf
+
s1
,
l
);
}
}
}
delete
[]
buf
;
}
else
{
for
(
int
i
=
0
;
i
<
_sizey
;
++
i
)
{
if
(
TIFFReadScanline
(
_tiff
,
_data
+
i
*
_sizex
*
datasize
,
i
,
0
)
!=
1
)
Msg
::
Error
(
"error reading tiff file %s"
,
filename
);
}
}
}
...
...
modules/slimFunction/unrefMesher.cpp
View file @
4d2a6feb
...
...
@@ -5,6 +5,7 @@
#include
"proj_api.h"
#include
"unrefMesher.h"
#include
"dgMessage.h"
#include
"dgConfig.h"
static
double
evalPythonCallback
(
PyObject
*
callback
,
double
x
,
double
y
,
double
z
)
{
PyObject
*
args
=
Py_BuildValue
(
"(ddd)"
,
x
,
y
,
z
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment