Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Difference From 9ad78b460f74e562 To c5692a3458233cdd
2015-06-29
| ||
01:34 | supporting a dummy def for SQLITE_DETERMINISTIC intended for obsolete sqlite3 check-in: 728323e837 user: sandro tags: trunk | |
2015-06-28
| ||
13:26 | restting SONAME to 1.0.0 check-in: 9ad78b460f user: sandro tags: trunk | |
2015-06-26
| ||
11:05 | adding "AUTOMAKE_OPTIONS=foreign" to Makefile.am check-in: ad8b2cf084 user: sandro tags: trunk | |
2015-06-05
| ||
12:03 | updating to automake 1.15 check-in: 7574f54ee8 user: sandro tags: trunk | |
2015-06-04
| ||
21:50 | implementing RL2_CopyRasterCoverage() check-in: c5692a3458 user: sandro tags: trunk | |
2015-05-31
| ||
10:02 | wmslite micro-server: supporting WMS vector layers in GetCapabilities check-in: 6b8e213297 user: sandro tags: trunk | |
Added Android_R4.2.0.mk.
1 +# ------------------- 2 +# Android_R4.2.0.mk 3 +# ndk-build clean 4 +# ndk-build 5 +# ------------------- 6 +LOCAL_PATH := $(call my-dir) 7 +JSQLITE_PATH := javasqlite-20120209 8 +SPATIALITE_PATH := libspatialite-4.2.0-rc1 9 +GEOS_PATH := geos-3.4.2 10 +PROJ4_PATH := proj-4.8.0 11 +SQLITE_PATH := sqlite-amalgamation-3080403 12 +ICONV_PATH := libiconv-1.13.1 13 +RASTERLITE2_PATH := librasterlite2-4.2.0 14 +GEOTIFF_PATH := libgeotiff-1.4.0 15 +TIFF_PATH := tiff-4.0.3/libtiff 16 +JPEG_PATH := jpeg-8d 17 +GIF_PATH := giflib-5.0.6/lib 18 +CAIRO_PATH := cairo-1.12.14/src 19 +FREETYPE_PATH := freetype-2.5.3 20 +FONTCONFIG_PATH := fontconfig-2.11.1 21 +EXPAT_PATH := expat-2.1.0 22 +PIXMAN_PATH := pixman-0.32.4 23 +PNG_PATH := libpng-1.6.10 24 +WEBP_PATH := libwebp-0.4.0 25 +XML2_PATH := libxml2-2.9.1 26 +CURL_PATH := curl-7.36.0 27 +LZMA_PATH := xz-5.1.3alpha 28 + 29 +include $(LOCAL_PATH)/jsqlite-R4.2.0.mk 30 +include $(LOCAL_PATH)/iconv-1.13.1.mk 31 +include $(LOCAL_PATH)/sqlite-3080403.mk 32 +include $(LOCAL_PATH)/proj4-4.8.0.mk 33 +include $(LOCAL_PATH)/geos-3.4.2.mk 34 +include $(LOCAL_PATH)/spatialite-4.2.0.mk 35 +include $(LOCAL_PATH)/libjpeg-8d.mk 36 +include $(LOCAL_PATH)/giflib-5.0.6.mk 37 +include $(LOCAL_PATH)/libpng-1.6.10.mk 38 +include $(LOCAL_PATH)/libtiff-4.0.3.mk 39 +include $(LOCAL_PATH)/libwebp-0.4.0.mk 40 +include $(LOCAL_PATH)/pixman-0.32.4.mk 41 +include $(LOCAL_PATH)/freetype-2.5.3.mk 42 +include $(LOCAL_PATH)/fontconfig-2.11.1.mk 43 +include $(LOCAL_PATH)/expat-2.1.0.mk 44 +include $(LOCAL_PATH)/cairo-1.12.14.mk 45 +include $(LOCAL_PATH)/libgeotiff-1.4.0.mk 46 +include $(LOCAL_PATH)/libxml2-2.9.1.mk 47 +include $(LOCAL_PATH)/libcurl-7.36.0.mk 48 +include $(LOCAL_PATH)/lzma-xz-5.1.3a.mk 49 +include $(LOCAL_PATH)/rasterlite2-4.2.0.mk 50 +$(call import-module,android/cpufeatures)
Deleted Android_R4.3.0.mk.
1 -# ------------------- 2 -# Android_R4.3.0.mk 3 -# ndk-build clean 4 -# ndk-build 5 -# ------------------- 6 -LOCAL_PATH := $(call my-dir) 7 -JSQLITE_PATH := javasqlite-20120209 8 -SPATIALITE_PATH := libspatialite-4.3.0 9 -GEOS_PATH := geos-3.4.2 10 -PROJ4_PATH := proj-4.9.1 11 -SQLITE_PATH := sqlite-amalgamation-3081002 12 -ICONV_PATH := libiconv-1.13.1 13 -RASTERLITE2_PATH := librasterlite2-4.3.0 14 -GEOTIFF_PATH := libgeotiff-1.4.0 15 -TIFF_PATH := tiff-4.0.3/libtiff 16 -JPEG_PATH := jpeg-8d 17 -GIF_PATH := giflib-5.0.6/lib 18 -CAIRO_PATH := cairo-1.12.14/src 19 -FREETYPE_PATH := freetype-2.5.3 20 -FONTCONFIG_PATH := fontconfig-2.11.1 21 -EXPAT_PATH := expat-2.1.0 22 -PIXMAN_PATH := pixman-0.32.4 23 -PNG_PATH := libpng-1.6.10 24 -WEBP_PATH := libwebp-0.4.0 25 -XML2_PATH := libxml2-2.9.1 26 -CURL_PATH := curl-7.36.0 27 -LZMA_PATH := xz-5.1.3alpha 28 -CHARLS_PATH := charls-1.0 29 -OPENJPEG_PATH := openjpeg-2.0.0 30 - 31 -include $(LOCAL_PATH)/charls-1.0.mk 32 -include $(LOCAL_PATH)/jsqlite-R4.2.0.mk 33 -include $(LOCAL_PATH)/iconv-1.13.1.mk 34 -include $(LOCAL_PATH)/sqlite-3081002.mk 35 -include $(LOCAL_PATH)/proj4-4.9.1.mk 36 -include $(LOCAL_PATH)/geos-3.4.2.mk 37 -include $(LOCAL_PATH)/spatialite-4.3.0.mk 38 -include $(LOCAL_PATH)/libjpeg-8d.mk 39 -include $(LOCAL_PATH)/openjpeg-2.0.0.mk 40 -include $(LOCAL_PATH)/giflib-5.0.6.mk 41 -include $(LOCAL_PATH)/libpng-1.6.10.mk 42 -include $(LOCAL_PATH)/libtiff-4.0.3.mk 43 -include $(LOCAL_PATH)/libwebp-0.4.0.mk 44 -include $(LOCAL_PATH)/pixman-0.32.4.mk 45 -include $(LOCAL_PATH)/freetype-2.5.3.mk 46 -include $(LOCAL_PATH)/fontconfig-2.11.1.mk 47 -include $(LOCAL_PATH)/expat-2.1.0.mk 48 -include $(LOCAL_PATH)/cairo-1.12.14.mk 49 -include $(LOCAL_PATH)/libgeotiff-1.4.0.mk 50 -include $(LOCAL_PATH)/libxml2-2.9.1.mk 51 -include $(LOCAL_PATH)/libcurl-7.36.0.mk 52 -include $(LOCAL_PATH)/lzma-xz-5.1.3a.mk 53 -include $(LOCAL_PATH)/rasterlite2-4.3.0.mk 54 -$(call import-module,android/cpufeatures)
Changes to Makefile.am.
1 1 ACLOCAL_AMFLAGS = -I m4 2 2 3 3 SUBDIRS = headers src test tools 4 4 5 -EXTRA_DIST = mainpage.doxy Android_R4.3.0.mk rasterlite2-4.3.0.mk \ 5 +EXTRA_DIST = mainpage.doxy Android_R4.2.0.mk rasterlite2-4.2.0.mk \ 6 6 Makefile-static-MinGW 7 7 8 -AUTOMAKE_OPTIONS = dist-zip foreign 8 +AUTOMAKE_OPTIONS = dist-zip 9 9 10 10 pkgconfigdir = $(libdir)/pkgconfig 11 11 pkgconfig_DATA = rasterlite2.pc 12 12 13 13 coverage-init: 14 14 lcov --directory src --capture --initial --output-file rasterlite2_cov.info 15 15 16 16 coverage:: 17 17 lcov --rc lcov_branch_coverage=1 --directory src --output-file rasterlite2_cov.info --capture 18 18 genhtml --rc lcov_branch_coverage=1 -o covresults rasterlite2_cov.info 19 19 20 20 MOSTLYCLEANFILES = rasterlite2_cov.info
Changes to Makefile.in.
1 -# Makefile.in generated by automake 1.15 from Makefile.am. 1 +# Makefile.in generated by automake 1.14.1 from Makefile.am. 2 2 # @configure_input@ 3 3 4 -# Copyright (C) 1994-2014 Free Software Foundation, Inc. 4 +# Copyright (C) 1994-2013 Free Software Foundation, Inc. 5 5 6 6 # This Makefile.in is free software; the Free Software Foundation 7 7 # gives unlimited permission to copy and/or distribute it, 8 8 # with or without modifications, as long as this notice is preserved. 9 9 10 10 # This program is distributed in the hope that it will be useful, 11 11 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 12 12 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 13 13 # PARTICULAR PURPOSE. 14 14 15 15 @SET_MAKE@ 16 16 17 17 VPATH = @srcdir@ 18 -am__is_gnu_make = { \ 19 - if test -z '$(MAKELEVEL)'; then \ 20 - false; \ 21 - elif test -n '$(MAKE_HOST)'; then \ 22 - true; \ 23 - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ 24 - true; \ 25 - else \ 26 - false; \ 27 - fi; \ 28 -} 18 +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 29 19 am__make_running_with_option = \ 30 20 case $${target_option-} in \ 31 21 ?) ;; \ 32 22 *) echo "am__make_running_with_option: internal error: invalid" \ 33 23 "target option '$${target_option-}' specified" >&2; \ 34 24 exit 1;; \ 35 25 esac; \ ................................................................................ 85 75 POST_INSTALL = : 86 76 NORMAL_UNINSTALL = : 87 77 PRE_UNINSTALL = : 88 78 POST_UNINSTALL = : 89 79 build_triplet = @build@ 90 80 host_triplet = @host@ 91 81 subdir = . 82 +DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \ 83 + $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ 84 + $(top_srcdir)/configure $(am__configure_deps) \ 85 + $(srcdir)/config.h.in $(srcdir)/Doxyfile.in \ 86 + $(srcdir)/rasterlite2.pc.in COPYING compile config.guess \ 87 + config.sub depcomp install-sh missing ltmain.sh 92 88 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 93 89 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ 94 90 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ 95 91 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ 96 92 $(top_srcdir)/configure.ac 97 93 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 98 94 $(ACLOCAL_M4) 99 -DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ 100 - $(am__configure_deps) $(am__DIST_COMMON) 101 95 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ 102 96 configure.lineno config.status.lineno 103 97 mkinstalldirs = $(install_sh) -d 104 98 CONFIG_HEADER = config.h 105 99 CONFIG_CLEAN_FILES = Doxyfile rasterlite2.pc 106 100 CONFIG_CLEAN_VPATH_FILES = 107 101 AM_V_P = $(am__v_P_@AM_V@) ................................................................................ 186 180 unique=`for i in $$list; do \ 187 181 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 188 182 done | $(am__uniquify_input)` 189 183 ETAGS = etags 190 184 CTAGS = ctags 191 185 CSCOPE = cscope 192 186 DIST_SUBDIRS = $(SUBDIRS) 193 -am__DIST_COMMON = $(srcdir)/Doxyfile.in $(srcdir)/Makefile.in \ 194 - $(srcdir)/config.h.in $(srcdir)/rasterlite2.pc.in AUTHORS \ 195 - COPYING ChangeLog INSTALL NEWS README compile config.guess \ 196 - config.sub depcomp install-sh ltmain.sh missing 197 187 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 198 188 distdir = $(PACKAGE)-$(VERSION) 199 189 top_distdir = $(distdir) 200 190 am__remove_distdir = \ 201 191 if test -d "$(distdir)"; then \ 202 192 find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ 203 193 && rm -rf "$(distdir)" \ ................................................................................ 376 366 sysconfdir = @sysconfdir@ 377 367 target_alias = @target_alias@ 378 368 top_build_prefix = @top_build_prefix@ 379 369 top_builddir = @top_builddir@ 380 370 top_srcdir = @top_srcdir@ 381 371 ACLOCAL_AMFLAGS = -I m4 382 372 SUBDIRS = headers src test tools 383 -EXTRA_DIST = mainpage.doxy Android_R4.3.0.mk rasterlite2-4.3.0.mk \ 373 +EXTRA_DIST = mainpage.doxy Android_R4.2.0.mk rasterlite2-4.2.0.mk \ 384 374 Makefile-static-MinGW 385 375 386 -AUTOMAKE_OPTIONS = dist-zip foreign 376 +AUTOMAKE_OPTIONS = dist-zip 387 377 pkgconfigdir = $(libdir)/pkgconfig 388 378 pkgconfig_DATA = rasterlite2.pc 389 379 MOSTLYCLEANFILES = rasterlite2_cov.info 390 380 all: config.h 391 381 $(MAKE) $(AM_MAKEFLAGS) all-recursive 392 382 393 383 .SUFFIXES: 394 384 am--refresh: Makefile 395 385 @: 396 386 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) 397 387 @for dep in $?; do \ 398 388 case '$(am__configure_deps)' in \ 399 389 *$$dep*) \ 400 - echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ 401 - $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ 390 + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ 391 + $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ 402 392 && exit 0; \ 403 393 exit 1;; \ 404 394 esac; \ 405 395 done; \ 406 - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ 396 + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ 407 397 $(am__cd) $(top_srcdir) && \ 408 - $(AUTOMAKE) --foreign Makefile 398 + $(AUTOMAKE) --gnu Makefile 399 +.PRECIOUS: Makefile 409 400 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 410 401 @case '$?' in \ 411 402 *config.status*) \ 412 403 echo ' $(SHELL) ./config.status'; \ 413 404 $(SHELL) ./config.status;; \ 414 405 *) \ 415 406 echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ ................................................................................ 657 648 $(am__post_remove_distdir) 658 649 659 650 dist-xz: distdir 660 651 tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz 661 652 $(am__post_remove_distdir) 662 653 663 654 dist-tarZ: distdir 664 - @echo WARNING: "Support for distribution archives compressed with" \ 665 - "legacy program 'compress' is deprecated." >&2 655 + @echo WARNING: "Support for shar distribution archives is" \ 656 + "deprecated." >&2 666 657 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 667 658 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z 668 659 $(am__post_remove_distdir) 669 660 670 661 dist-shar: distdir 671 - @echo WARNING: "Support for shar distribution archives is" \ 672 - "deprecated." >&2 662 + @echo WARNING: "Support for distribution archives compressed with" \ 663 + "legacy program 'compress' is deprecated." >&2 673 664 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 674 665 shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz 675 666 $(am__post_remove_distdir) 676 667 dist-zip: distdir 677 668 -rm -f $(distdir).zip 678 669 zip -rq $(distdir).zip $(distdir) 679 670 $(am__post_remove_distdir) ................................................................................ 700 691 *.shar.gz*) \ 701 692 GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ 702 693 *.zip*) \ 703 694 unzip $(distdir).zip ;;\ 704 695 esac 705 696 chmod -R a-w $(distdir) 706 697 chmod u+w $(distdir) 707 - mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst 698 + mkdir $(distdir)/_build $(distdir)/_inst 708 699 chmod a-w $(distdir) 709 700 test -d $(distdir)/_build || exit 0; \ 710 701 dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ 711 702 && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ 712 703 && am__cwd=`pwd` \ 713 - && $(am__cd) $(distdir)/_build/sub \ 714 - && ../../configure \ 704 + && $(am__cd) $(distdir)/_build \ 705 + && ../configure \ 715 706 $(AM_DISTCHECK_CONFIGURE_FLAGS) \ 716 707 $(DISTCHECK_CONFIGURE_FLAGS) \ 717 - --srcdir=../.. --prefix="$$dc_install_base" \ 708 + --srcdir=.. --prefix="$$dc_install_base" \ 718 709 && $(MAKE) $(AM_MAKEFLAGS) \ 719 710 && $(MAKE) $(AM_MAKEFLAGS) dvi \ 720 711 && $(MAKE) $(AM_MAKEFLAGS) check \ 721 712 && $(MAKE) $(AM_MAKEFLAGS) install \ 722 713 && $(MAKE) $(AM_MAKEFLAGS) installcheck \ 723 714 && $(MAKE) $(AM_MAKEFLAGS) uninstall \ 724 715 && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ ................................................................................ 891 882 install-man install-pdf install-pdf-am install-pkgconfigDATA \ 892 883 install-ps install-ps-am install-strip installcheck \ 893 884 installcheck-am installdirs installdirs-am maintainer-clean \ 894 885 maintainer-clean-generic mostlyclean mostlyclean-generic \ 895 886 mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ 896 887 uninstall-am uninstall-pkgconfigDATA 897 888 898 -.PRECIOUS: Makefile 899 - 900 889 901 890 coverage-init: 902 891 lcov --directory src --capture --initial --output-file rasterlite2_cov.info 903 892 904 893 coverage:: 905 894 lcov --rc lcov_branch_coverage=1 --directory src --output-file rasterlite2_cov.info --capture 906 895 genhtml --rc lcov_branch_coverage=1 -o covresults rasterlite2_cov.info 907 896 908 897 # Tell versions [3.59,3.63) of GNU make to not export all variables. 909 898 # Otherwise a system limit (for SysV at least) may be exceeded. 910 899 .NOEXPORT:
Changes to aclocal.m4.
1 -# generated automatically by aclocal 1.15 -*- Autoconf -*- 1 +# generated automatically by aclocal 1.14.1 -*- Autoconf -*- 2 2 3 -# Copyright (C) 1996-2014 Free Software Foundation, Inc. 3 +# Copyright (C) 1996-2013 Free Software Foundation, Inc. 4 4 5 5 # This file is free software; the Free Software Foundation 6 6 # gives unlimited permission to copy and/or distribute it, 7 7 # with or without modifications, as long as this notice is preserved. 8 8 9 9 # This program is distributed in the hope that it will be useful, 10 10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without ................................................................................ 231 231 232 232 _PKG_CONFIG([$1], [variable="][$3]["], [$2]) 233 233 AS_VAR_COPY([$1], [pkg_cv_][$1]) 234 234 235 235 AS_VAR_IF([$1], [""], [$5], [$4])dnl 236 236 ])# PKG_CHECK_VAR 237 237 238 -# Copyright (C) 2002-2014 Free Software Foundation, Inc. 238 +# Copyright (C) 2002-2013 Free Software Foundation, Inc. 239 239 # 240 240 # This file is free software; the Free Software Foundation 241 241 # gives unlimited permission to copy and/or distribute it, 242 242 # with or without modifications, as long as this notice is preserved. 243 243 244 244 # AM_AUTOMAKE_VERSION(VERSION) 245 245 # ---------------------------- 246 246 # Automake X.Y traces this macro to ensure aclocal.m4 has been 247 247 # generated from the m4 files accompanying Automake X.Y. 248 248 # (This private macro should not be called outside this file.) 249 249 AC_DEFUN([AM_AUTOMAKE_VERSION], 250 -[am__api_version='1.15' 250 +[am__api_version='1.14' 251 251 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to 252 252 dnl require some minimum version. Point them to the right macro. 253 -m4_if([$1], [1.15], [], 253 +m4_if([$1], [1.14.1], [], 254 254 [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl 255 255 ]) 256 256 257 257 # _AM_AUTOCONF_VERSION(VERSION) 258 258 # ----------------------------- 259 259 # aclocal traces this macro to find the Autoconf version. 260 260 # This is a private macro too. Using m4_define simplifies ................................................................................ 262 262 m4_define([_AM_AUTOCONF_VERSION], []) 263 263 264 264 # AM_SET_CURRENT_AUTOMAKE_VERSION 265 265 # ------------------------------- 266 266 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. 267 267 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. 268 268 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], 269 -[AM_AUTOMAKE_VERSION([1.15])dnl 269 +[AM_AUTOMAKE_VERSION([1.14.1])dnl 270 270 m4_ifndef([AC_AUTOCONF_VERSION], 271 271 [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl 272 272 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) 273 273 274 274 # AM_AUX_DIR_EXPAND -*- Autoconf -*- 275 275 276 -# Copyright (C) 2001-2014 Free Software Foundation, Inc. 276 +# Copyright (C) 2001-2013 Free Software Foundation, Inc. 277 277 # 278 278 # This file is free software; the Free Software Foundation 279 279 # gives unlimited permission to copy and/or distribute it, 280 280 # with or without modifications, as long as this notice is preserved. 281 281 282 282 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets 283 283 # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to ................................................................................ 314 314 # configure, and could therefore not use this "fixed" $ac_aux_dir. 315 315 # 316 316 # Another solution, used here, is to always expand $ac_aux_dir to an 317 317 # absolute PATH. The drawback is that using absolute paths prevent a 318 318 # configured tree to be moved without reconfiguration. 319 319 320 320 AC_DEFUN([AM_AUX_DIR_EXPAND], 321 -[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl 322 -# Expand $ac_aux_dir to an absolute path. 323 -am_aux_dir=`cd "$ac_aux_dir" && pwd` 321 +[dnl Rely on autoconf to set up CDPATH properly. 322 +AC_PREREQ([2.50])dnl 323 +# expand $ac_aux_dir to an absolute path 324 +am_aux_dir=`cd $ac_aux_dir && pwd` 324 325 ]) 325 326 326 327 # AM_CONDITIONAL -*- Autoconf -*- 327 328 328 -# Copyright (C) 1997-2014 Free Software Foundation, Inc. 329 +# Copyright (C) 1997-2013 Free Software Foundation, Inc. 329 330 # 330 331 # This file is free software; the Free Software Foundation 331 332 # gives unlimited permission to copy and/or distribute it, 332 333 # with or without modifications, as long as this notice is preserved. 333 334 334 335 # AM_CONDITIONAL(NAME, SHELL-CONDITION) 335 336 # ------------------------------------- ................................................................................ 352 353 fi 353 354 AC_CONFIG_COMMANDS_PRE( 354 355 [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then 355 356 AC_MSG_ERROR([[conditional "$1" was never defined. 356 357 Usually this means the macro was only invoked conditionally.]]) 357 358 fi])]) 358 359 359 -# Copyright (C) 1999-2014 Free Software Foundation, Inc. 360 +# Copyright (C) 1999-2013 Free Software Foundation, Inc. 360 361 # 361 362 # This file is free software; the Free Software Foundation 362 363 # gives unlimited permission to copy and/or distribute it, 363 364 # with or without modifications, as long as this notice is preserved. 364 365 365 366 366 367 # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be ................................................................................ 543 544 _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl 544 545 AC_SUBST([am__nodep])dnl 545 546 _AM_SUBST_NOTMAKE([am__nodep])dnl 546 547 ]) 547 548 548 549 # Generate code to set up dependency tracking. -*- Autoconf -*- 549 550 550 -# Copyright (C) 1999-2014 Free Software Foundation, Inc. 551 +# Copyright (C) 1999-2013 Free Software Foundation, Inc. 551 552 # 552 553 # This file is free software; the Free Software Foundation 553 554 # gives unlimited permission to copy and/or distribute it, 554 555 # with or without modifications, as long as this notice is preserved. 555 556 556 557 557 558 # _AM_OUTPUT_DEPENDENCY_COMMANDS ................................................................................ 619 620 [AC_CONFIG_COMMANDS([depfiles], 620 621 [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], 621 622 [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) 622 623 ]) 623 624 624 625 # Do all the work for Automake. -*- Autoconf -*- 625 626 626 -# Copyright (C) 1996-2014 Free Software Foundation, Inc. 627 +# Copyright (C) 1996-2013 Free Software Foundation, Inc. 627 628 # 628 629 # This file is free software; the Free Software Foundation 629 630 # gives unlimited permission to copy and/or distribute it, 630 631 # with or without modifications, as long as this notice is preserved. 631 632 632 633 # This macro actually does too much. Some checks are only needed if 633 634 # your package does certain things. But this isn't really a big deal. ................................................................................ 709 710 AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl 710 711 AC_REQUIRE([AC_PROG_MKDIR_P])dnl 711 712 # For better backward compatibility. To be removed once Automake 1.9.x 712 713 # dies out for good. For more background, see: 713 714 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> 714 715 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> 715 716 AC_SUBST([mkdir_p], ['$(MKDIR_P)']) 716 -# We need awk for the "check" target (and possibly the TAP driver). The 717 -# system "awk" is bad on some platforms. 717 +# We need awk for the "check" target. The system "awk" is bad on 718 +# some platforms. 718 719 AC_REQUIRE([AC_PROG_AWK])dnl 719 720 AC_REQUIRE([AC_PROG_MAKE_SET])dnl 720 721 AC_REQUIRE([AM_SET_LEADING_DOT])dnl 721 722 _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], 722 723 [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], 723 724 [_AM_PROG_TAR([v7])])]) 724 725 _AM_IF_OPTION([no-dependencies],, ................................................................................ 783 784 If you want to complete the configuration process using your problematic 784 785 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM 785 786 to "yes", and re-run configure. 786 787 787 788 END 788 789 AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) 789 790 fi 790 -fi 791 -dnl The trailing newline in this macro's definition is deliberate, for 792 -dnl backward compatibility and to allow trailing 'dnl'-style comments 793 -dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. 794 -]) 791 +fi]) 795 792 796 793 dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not 797 794 dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further 798 795 dnl mangled by Autoconf and run in a shell conditional statement. 799 796 m4_define([_AC_COMPILER_EXEEXT], 800 797 m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) 801 798 ................................................................................ 816 813 break ;; 817 814 * ) 818 815 _am_stamp_count=`expr $_am_stamp_count + 1` ;; 819 816 esac 820 817 done 821 818 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) 822 819 823 -# Copyright (C) 2001-2014 Free Software Foundation, Inc. 820 +# Copyright (C) 2001-2013 Free Software Foundation, Inc. 824 821 # 825 822 # This file is free software; the Free Software Foundation 826 823 # gives unlimited permission to copy and/or distribute it, 827 824 # with or without modifications, as long as this notice is preserved. 828 825 829 826 # AM_PROG_INSTALL_SH 830 827 # ------------------ 831 828 # Define $install_sh. 832 829 AC_DEFUN([AM_PROG_INSTALL_SH], 833 830 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl 834 -if test x"${install_sh+set}" != xset; then 831 +if test x"${install_sh}" != xset; then 835 832 case $am_aux_dir in 836 833 *\ * | *\ *) 837 834 install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; 838 835 *) 839 836 install_sh="\${SHELL} $am_aux_dir/install-sh" 840 837 esac 841 838 fi 842 839 AC_SUBST([install_sh])]) 843 840 844 -# Copyright (C) 2003-2014 Free Software Foundation, Inc. 841 +# Copyright (C) 2003-2013 Free Software Foundation, Inc. 845 842 # 846 843 # This file is free software; the Free Software Foundation 847 844 # gives unlimited permission to copy and/or distribute it, 848 845 # with or without modifications, as long as this notice is preserved. 849 846 850 847 # Check whether the underlying file-system supports filenames 851 848 # with a leading dot. For instance MS-DOS doesn't. ................................................................................ 859 856 fi 860 857 rmdir .tst 2>/dev/null 861 858 AC_SUBST([am__leading_dot])]) 862 859 863 860 # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- 864 861 # From Jim Meyering 865 862 866 -# Copyright (C) 1996-2014 Free Software Foundation, Inc. 863 +# Copyright (C) 1996-2013 Free Software Foundation, Inc. 867 864 # 868 865 # This file is free software; the Free Software Foundation 869 866 # gives unlimited permission to copy and/or distribute it, 870 867 # with or without modifications, as long as this notice is preserved. 871 868 872 869 # AM_MAINTAINER_MODE([DEFAULT-MODE]) 873 870 # ---------------------------------- ................................................................................ 894 891 MAINT=$MAINTAINER_MODE_TRUE 895 892 AC_SUBST([MAINT])dnl 896 893 ] 897 894 ) 898 895 899 896 # Check to see how 'make' treats includes. -*- Autoconf -*- 900 897 901 -# Copyright (C) 2001-2014 Free Software Foundation, Inc. 898 +# Copyright (C) 2001-2013 Free Software Foundation, Inc. 902 899 # 903 900 # This file is free software; the Free Software Foundation 904 901 # gives unlimited permission to copy and/or distribute it, 905 902 # with or without modifications, as long as this notice is preserved. 906 903 907 904 # AM_MAKE_INCLUDE() 908 905 # ----------------- ................................................................................ 944 941 AC_SUBST([am__quote]) 945 942 AC_MSG_RESULT([$_am_result]) 946 943 rm -f confinc confmf 947 944 ]) 948 945 949 946 # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- 950 947 951 -# Copyright (C) 1997-2014 Free Software Foundation, Inc. 948 +# Copyright (C) 1997-2013 Free Software Foundation, Inc. 952 949 # 953 950 # This file is free software; the Free Software Foundation 954 951 # gives unlimited permission to copy and/or distribute it, 955 952 # with or without modifications, as long as this notice is preserved. 956 953 957 954 # AM_MISSING_PROG(NAME, PROGRAM) 958 955 # ------------------------------ ................................................................................ 985 982 fi 986 983 ]) 987 984 988 985 # -*- Autoconf -*- 989 986 # Obsolete and "removed" macros, that must however still report explicit 990 987 # error messages when used, to smooth transition. 991 988 # 992 -# Copyright (C) 1996-2014 Free Software Foundation, Inc. 989 +# Copyright (C) 1996-2013 Free Software Foundation, Inc. 993 990 # 994 991 # This file is free software; the Free Software Foundation 995 992 # gives unlimited permission to copy and/or distribute it, 996 993 # with or without modifications, as long as this notice is preserved. 997 994 998 995 AC_DEFUN([AM_CONFIG_HEADER], 999 996 [AC_DIAGNOSE([obsolete], ................................................................................ 1012 1009 1013 1010 AC_DEFUN([AM_C_PROTOTYPES], 1014 1011 [AC_FATAL([automatic de-ANSI-fication support has been removed])]) 1015 1012 AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES]) 1016 1013 1017 1014 # Helper functions for option handling. -*- Autoconf -*- 1018 1015 1019 -# Copyright (C) 2001-2014 Free Software Foundation, Inc. 1016 +# Copyright (C) 2001-2013 Free Software Foundation, Inc. 1020 1017 # 1021 1018 # This file is free software; the Free Software Foundation 1022 1019 # gives unlimited permission to copy and/or distribute it, 1023 1020 # with or without modifications, as long as this notice is preserved. 1024 1021 1025 1022 # _AM_MANGLE_OPTION(NAME) 1026 1023 # ----------------------- ................................................................................ 1041 1038 1042 1039 # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) 1043 1040 # ------------------------------------------- 1044 1041 # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. 1045 1042 AC_DEFUN([_AM_IF_OPTION], 1046 1043 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) 1047 1044 1048 -# Copyright (C) 1999-2014 Free Software Foundation, Inc. 1045 +# Copyright (C) 1999-2013 Free Software Foundation, Inc. 1049 1046 # 1050 1047 # This file is free software; the Free Software Foundation 1051 1048 # gives unlimited permission to copy and/or distribute it, 1052 1049 # with or without modifications, as long as this notice is preserved. 1053 1050 1054 1051 # _AM_PROG_CC_C_O 1055 1052 # --------------- ................................................................................ 1088 1085 CC="$am_aux_dir/compile $CC" 1089 1086 fi 1090 1087 AC_LANG_POP([C])]) 1091 1088 1092 1089 # For backward compatibility. 1093 1090 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) 1094 1091 1095 -# Copyright (C) 2001-2014 Free Software Foundation, Inc. 1092 +# Copyright (C) 2001-2013 Free Software Foundation, Inc. 1096 1093 # 1097 1094 # This file is free software; the Free Software Foundation 1098 1095 # gives unlimited permission to copy and/or distribute it, 1099 1096 # with or without modifications, as long as this notice is preserved. 1100 1097 1101 1098 # AM_RUN_LOG(COMMAND) 1102 1099 # ------------------- ................................................................................ 1107 1104 ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD 1108 1105 ac_status=$? 1109 1106 echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD 1110 1107 (exit $ac_status); }]) 1111 1108 1112 1109 # Check to make sure that the build environment is sane. -*- Autoconf -*- 1113 1110 1114 -# Copyright (C) 1996-2014 Free Software Foundation, Inc. 1111 +# Copyright (C) 1996-2013 Free Software Foundation, Inc. 1115 1112 # 1116 1113 # This file is free software; the Free Software Foundation 1117 1114 # gives unlimited permission to copy and/or distribute it, 1118 1115 # with or without modifications, as long as this notice is preserved. 1119 1116 1120 1117 # AM_SANITY_CHECK 1121 1118 # --------------- ................................................................................ 1188 1185 # Hide warnings about reused PIDs. 1189 1186 wait $am_sleep_pid 2>/dev/null 1190 1187 fi 1191 1188 AC_MSG_RESULT([done])]) 1192 1189 rm -f conftest.file 1193 1190 ]) 1194 1191 1195 -# Copyright (C) 2009-2014 Free Software Foundation, Inc. 1192 +# Copyright (C) 2009-2013 Free Software Foundation, Inc. 1196 1193 # 1197 1194 # This file is free software; the Free Software Foundation 1198 1195 # gives unlimited permission to copy and/or distribute it, 1199 1196 # with or without modifications, as long as this notice is preserved. 1200 1197 1201 1198 # AM_SILENT_RULES([DEFAULT]) 1202 1199 # -------------------------- ................................................................................ 1248 1245 AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl 1249 1246 AC_SUBST([AM_DEFAULT_VERBOSITY])dnl 1250 1247 AM_BACKSLASH='\' 1251 1248 AC_SUBST([AM_BACKSLASH])dnl 1252 1249 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl 1253 1250 ]) 1254 1251 1255 -# Copyright (C) 2001-2014 Free Software Foundation, Inc. 1252 +# Copyright (C) 2001-2013 Free Software Foundation, Inc. 1256 1253 # 1257 1254 # This file is free software; the Free Software Foundation 1258 1255 # gives unlimited permission to copy and/or distribute it, 1259 1256 # with or without modifications, as long as this notice is preserved. 1260 1257 1261 1258 # AM_PROG_INSTALL_STRIP 1262 1259 # --------------------- ................................................................................ 1276 1273 dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. 1277 1274 if test "$cross_compiling" != no; then 1278 1275 AC_CHECK_TOOL([STRIP], [strip], :) 1279 1276 fi 1280 1277 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" 1281 1278 AC_SUBST([INSTALL_STRIP_PROGRAM])]) 1282 1279 1283 -# Copyright (C) 2006-2014 Free Software Foundation, Inc. 1280 +# Copyright (C) 2006-2013 Free Software Foundation, Inc. 1284 1281 # 1285 1282 # This file is free software; the Free Software Foundation 1286 1283 # gives unlimited permission to copy and/or distribute it, 1287 1284 # with or without modifications, as long as this notice is preserved. 1288 1285 1289 1286 # _AM_SUBST_NOTMAKE(VARIABLE) 1290 1287 # --------------------------- ................................................................................ 1295 1292 # AM_SUBST_NOTMAKE(VARIABLE) 1296 1293 # -------------------------- 1297 1294 # Public sister of _AM_SUBST_NOTMAKE. 1298 1295 AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) 1299 1296 1300 1297 # Check how to create a tarball. -*- Autoconf -*- 1301 1298 1302 -# Copyright (C) 2004-2014 Free Software Foundation, Inc. 1299 +# Copyright (C) 2004-2013 Free Software Foundation, Inc. 1303 1300 # 1304 1301 # This file is free software; the Free Software Foundation 1305 1302 # gives unlimited permission to copy and/or distribute it, 1306 1303 # with or without modifications, as long as this notice is preserved. 1307 1304 1308 1305 # _AM_PROG_TAR(FORMAT) 1309 1306 # --------------------
Changes to configure.
1 1 #! /bin/sh 2 2 # Guess values for system-dependent variables and create Makefiles. 3 -# Generated by GNU Autoconf 2.69 for librasterlite2 1.0.0-devel. 3 +# Generated by GNU Autoconf 2.69 for librasterlite2 1.0.0-rc1. 4 4 # 5 5 # Report bugs to <a.furieri@lqt.it>. 6 6 # 7 7 # 8 8 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. 9 9 # 10 10 # ................................................................................ 586 586 subdirs= 587 587 MFLAGS= 588 588 MAKEFLAGS= 589 589 590 590 # Identity of this package. 591 591 PACKAGE_NAME='librasterlite2' 592 592 PACKAGE_TARNAME='librasterlite2' 593 -PACKAGE_VERSION='1.0.0-devel' 594 -PACKAGE_STRING='librasterlite2 1.0.0-devel' 593 +PACKAGE_VERSION='1.0.0-rc1' 594 +PACKAGE_STRING='librasterlite2 1.0.0-rc1' 595 595 PACKAGE_BUGREPORT='a.furieri@lqt.it' 596 596 PACKAGE_URL='' 597 597 598 598 # Factoring default headers for most tests. 599 599 ac_includes_default="\ 600 600 #include <stdio.h> 601 601 #ifdef HAVE_SYS_TYPES_H ................................................................................ 1368 1368 # 1369 1369 # Report the --help message. 1370 1370 # 1371 1371 if test "$ac_init_help" = "long"; then 1372 1372 # Omit some internal or obsolete options to make the list less imposing. 1373 1373 # This message is too long to be a string in the A/UX 3.1 sh. 1374 1374 cat <<_ACEOF 1375 -\`configure' configures librasterlite2 1.0.0-devel to adapt to many kinds of systems. 1375 +\`configure' configures librasterlite2 1.0.0-rc1 to adapt to many kinds of systems. 1376 1376 1377 1377 Usage: $0 [OPTION]... [VAR=VALUE]... 1378 1378 1379 1379 To assign environment variables (e.g., CC, CFLAGS...), specify them as 1380 1380 VAR=VALUE. See below for descriptions of some of the useful variables. 1381 1381 1382 1382 Defaults for the options are specified in brackets. ................................................................................ 1438 1438 --build=BUILD configure for building on BUILD [guessed] 1439 1439 --host=HOST cross-compile to build programs to run on HOST [BUILD] 1440 1440 _ACEOF 1441 1441 fi 1442 1442 1443 1443 if test -n "$ac_init_help"; then 1444 1444 case $ac_init_help in 1445 - short | recursive ) echo "Configuration of librasterlite2 1.0.0-devel:";; 1445 + short | recursive ) echo "Configuration of librasterlite2 1.0.0-rc1:";; 1446 1446 esac 1447 1447 cat <<\_ACEOF 1448 1448 1449 1449 Optional Features: 1450 1450 --disable-option-checking ignore unrecognized --enable/--with options 1451 1451 --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) 1452 1452 --enable-FEATURE[=ARG] include FEATURE [ARG=yes] ................................................................................ 1590 1590 cd "$ac_pwd" || { ac_status=$?; break; } 1591 1591 done 1592 1592 fi 1593 1593 1594 1594 test -n "$ac_init_help" && exit $ac_status 1595 1595 if $ac_init_version; then 1596 1596 cat <<\_ACEOF 1597 -librasterlite2 configure 1.0.0-devel 1597 +librasterlite2 configure 1.0.0-rc1 1598 1598 generated by GNU Autoconf 2.69 1599 1599 1600 1600 Copyright (C) 2012 Free Software Foundation, Inc. 1601 1601 This configure script is free software; the Free Software Foundation 1602 1602 gives unlimited permission to copy, distribute and modify it. 1603 1603 _ACEOF 1604 1604 exit ................................................................................ 2134 2134 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno 2135 2135 2136 2136 } # ac_fn_c_check_type 2137 2137 cat >config.log <<_ACEOF 2138 2138 This file contains any messages produced by compilers while 2139 2139 running configure, to aid debugging if configure makes a mistake. 2140 2140 2141 -It was created by librasterlite2 $as_me 1.0.0-devel, which was 2141 +It was created by librasterlite2 $as_me 1.0.0-rc1, which was 2142 2142 generated by GNU Autoconf 2.69. Invocation command line was 2143 2143 2144 2144 $ $0 $@ 2145 2145 2146 2146 _ACEOF 2147 2147 exec 5>>config.log 2148 2148 { ................................................................................ 2519 2519 ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. 2520 2520 ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. 2521 2521 ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. 2522 2522 2523 2523 2524 2524 2525 2525 2526 -am__api_version='1.15' 2526 +am__api_version='1.14' 2527 2527 2528 2528 # Find a good install program. We prefer a C program (faster), 2529 2529 # so one script is as good as another. But avoid the broken or 2530 2530 # incompatible versions: 2531 2531 # SysV /etc/install, /usr/sbin/install 2532 2532 # SunOS /usr/etc/install 2533 2533 # IRIX /sbin/install ................................................................................ 2691 2691 test "$program_suffix" != NONE && 2692 2692 program_transform_name="s&\$&$program_suffix&;$program_transform_name" 2693 2693 # Double any \ or $. 2694 2694 # By default was `s,x,x', remove it if useless. 2695 2695 ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' 2696 2696 program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` 2697 2697 2698 -# Expand $ac_aux_dir to an absolute path. 2699 -am_aux_dir=`cd "$ac_aux_dir" && pwd` 2698 +# expand $ac_aux_dir to an absolute path 2699 +am_aux_dir=`cd $ac_aux_dir && pwd` 2700 2700 2701 2701 if test x"${MISSING+set}" != xset; then 2702 2702 case $am_aux_dir in 2703 2703 *\ * | *\ *) 2704 2704 MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; 2705 2705 *) 2706 2706 MISSING="\${SHELL} $am_aux_dir/missing" ;; ................................................................................ 2711 2711 am_missing_run="$MISSING " 2712 2712 else 2713 2713 am_missing_run= 2714 2714 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 2715 2715 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} 2716 2716 fi 2717 2717 2718 -if test x"${install_sh+set}" != xset; then 2718 +if test x"${install_sh}" != xset; then 2719 2719 case $am_aux_dir in 2720 2720 *\ * | *\ *) 2721 2721 install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; 2722 2722 *) 2723 2723 install_sh="\${SHELL} $am_aux_dir/install-sh" 2724 2724 esac 2725 2725 fi ................................................................................ 3005 3005 CYGPATH_W=echo 3006 3006 fi 3007 3007 fi 3008 3008 3009 3009 3010 3010 # Define the identity of the package. 3011 3011 PACKAGE='librasterlite2' 3012 - VERSION='1.0.0-devel' 3012 + VERSION='1.0.0-rc1' 3013 3013 3014 3014 3015 3015 cat >>confdefs.h <<_ACEOF 3016 3016 #define PACKAGE "$PACKAGE" 3017 3017 _ACEOF 3018 3018 3019 3019 ................................................................................ 3039 3039 3040 3040 # For better backward compatibility. To be removed once Automake 1.9.x 3041 3041 # dies out for good. For more background, see: 3042 3042 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html> 3043 3043 # <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html> 3044 3044 mkdir_p='$(MKDIR_P)' 3045 3045 3046 -# We need awk for the "check" target (and possibly the TAP driver). The 3047 -# system "awk" is bad on some platforms. 3046 +# We need awk for the "check" target. The system "awk" is bad on 3047 +# some platforms. 3048 3048 # Always define AMTAR for backward compatibility. Yes, it's still used 3049 3049 # in the wild :-( We should find a proper way to deprecate it ... 3050 3050 AMTAR='$${TAR-tar}' 3051 3051 3052 3052 3053 3053 # We'll loop over all known methods to create a tar archive until one works. 3054 3054 _am_tools='gnutar pax cpio none' ................................................................................ 3097 3097 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM 3098 3098 to "yes", and re-run configure. 3099 3099 3100 3100 END 3101 3101 as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 3102 3102 fi 3103 3103 fi 3104 - 3105 3104 3106 3105 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 3107 3106 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } 3108 3107 # Check whether --enable-maintainer-mode was given. 3109 3108 if test "${enable_maintainer_mode+set}" = set; then : 3110 3109 enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval 3111 3110 else ................................................................................ 19157 19156 test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 19158 19157 19159 19158 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 19160 19159 # Save the log message, to keep $0 and so on meaningful, and to 19161 19160 # report actual input values of CONFIG_FILES etc. instead of their 19162 19161 # values after options handling. 19163 19162 ac_log=" 19164 -This file was extended by librasterlite2 $as_me 1.0.0-devel, which was 19163 +This file was extended by librasterlite2 $as_me 1.0.0-rc1, which was 19165 19164 generated by GNU Autoconf 2.69. Invocation command line was 19166 19165 19167 19166 CONFIG_FILES = $CONFIG_FILES 19168 19167 CONFIG_HEADERS = $CONFIG_HEADERS 19169 19168 CONFIG_LINKS = $CONFIG_LINKS 19170 19169 CONFIG_COMMANDS = $CONFIG_COMMANDS 19171 19170 $ $0 $@ ................................................................................ 19223 19222 19224 19223 Report bugs to <a.furieri@lqt.it>." 19225 19224 19226 19225 _ACEOF 19227 19226 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 19228 19227 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" 19229 19228 ac_cs_version="\\ 19230 -librasterlite2 config.status 1.0.0-devel 19229 +librasterlite2 config.status 1.0.0-rc1 19231 19230 configured by $0, generated by GNU Autoconf 2.69, 19232 19231 with options \\"\$ac_cs_config\\" 19233 19232 19234 19233 Copyright (C) 2012 Free Software Foundation, Inc. 19235 19234 This config.status script is free software; the Free Software Foundation 19236 19235 gives unlimited permission to copy, distribute and modify it." 19237 19236
Changes to configure.ac.
1 1 # -*- Autoconf -*- 2 2 # Process this file with autoconf to produce a configure script. 3 3 4 4 AC_PREREQ(2.61) 5 -AC_INIT(librasterlite2, 1.0.0-devel, a.furieri@lqt.it) 5 +AC_INIT(librasterlite2, 1.0.0-rc1, a.furieri@lqt.it) 6 6 AC_LANG(C) 7 7 AC_CONFIG_AUX_DIR([.]) 8 8 AC_CONFIG_MACRO_DIR([m4]) 9 9 10 10 AM_INIT_AUTOMAKE 11 11 AM_MAINTAINER_MODE 12 12 AM_CONFIG_HEADER(config.h)
Changes to headers/Makefile.in.
1 -# Makefile.in generated by automake 1.15 from Makefile.am. 1 +# Makefile.in generated by automake 1.14.1 from Makefile.am. 2 2 # @configure_input@ 3 3 4 -# Copyright (C) 1994-2014 Free Software Foundation, Inc. 4 +# Copyright (C) 1994-2013 Free Software Foundation, Inc. 5 5 6 6 # This Makefile.in is free software; the Free Software Foundation 7 7 # gives unlimited permission to copy and/or distribute it, 8 8 # with or without modifications, as long as this notice is preserved. 9 9 10 10 # This program is distributed in the hope that it will be useful, 11 11 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 12 12 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 13 13 # PARTICULAR PURPOSE. 14 14 15 15 @SET_MAKE@ 16 16 17 17 VPATH = @srcdir@ 18 -am__is_gnu_make = { \ 19 - if test -z '$(MAKELEVEL)'; then \ 20 - false; \ 21 - elif test -n '$(MAKE_HOST)'; then \ 22 - true; \ 23 - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ 24 - true; \ 25 - else \ 26 - false; \ 27 - fi; \ 28 -} 18 +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 29 19 am__make_running_with_option = \ 30 20 case $${target_option-} in \ 31 21 ?) ;; \ 32 22 *) echo "am__make_running_with_option: internal error: invalid" \ 33 23 "target option '$${target_option-}' specified" >&2; \ 34 24 exit 1;; \ 35 25 esac; \ ................................................................................ 85 75 POST_INSTALL = : 86 76 NORMAL_UNINSTALL = : 87 77 PRE_UNINSTALL = : 88 78 POST_UNINSTALL = : 89 79 build_triplet = @build@ 90 80 host_triplet = @host@ 91 81 subdir = headers 82 +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ 83 + $(nobase_include_HEADERS) $(noinst_HEADERS) 92 84 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 93 85 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ 94 86 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ 95 87 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ 96 88 $(top_srcdir)/configure.ac 97 89 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 98 90 $(ACLOCAL_M4) 99 -DIST_COMMON = $(srcdir)/Makefile.am $(nobase_include_HEADERS) \ 100 - $(noinst_HEADERS) $(am__DIST_COMMON) 101 91 mkinstalldirs = $(install_sh) -d 102 92 CONFIG_HEADER = $(top_builddir)/config.h 103 93 CONFIG_CLEAN_FILES = 104 94 CONFIG_CLEAN_VPATH_FILES = 105 95 AM_V_P = $(am__v_P_@AM_V@) 106 96 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) 107 97 am__v_P_0 = false ................................................................................ 165 155 am__define_uniq_tagged_files = \ 166 156 list='$(am__tagged_files)'; \ 167 157 unique=`for i in $$list; do \ 168 158 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 169 159 done | $(am__uniquify_input)` 170 160 ETAGS = etags 171 161 CTAGS = ctags 172 -am__DIST_COMMON = $(srcdir)/Makefile.in 173 162 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 174 163 ACLOCAL = @ACLOCAL@ 175 164 AMTAR = @AMTAR@ 176 165 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 177 166 AR = @AR@ 178 167 AS = @AS@ 179 168 AUTOCONF = @AUTOCONF@ ................................................................................ 332 321 && { if test -f $@; then exit 0; else break; fi; }; \ 333 322 exit 1;; \ 334 323 esac; \ 335 324 done; \ 336 325 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu headers/Makefile'; \ 337 326 $(am__cd) $(top_srcdir) && \ 338 327 $(AUTOMAKE) --gnu headers/Makefile 328 +.PRECIOUS: Makefile 339 329 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 340 330 @case '$?' in \ 341 331 *config.status*) \ 342 332 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ 343 333 *) \ 344 334 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ 345 335 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ ................................................................................ 581 571 install-nobase_includeHEADERS install-pdf install-pdf-am \ 582 572 install-ps install-ps-am install-strip installcheck \ 583 573 installcheck-am installdirs maintainer-clean \ 584 574 maintainer-clean-generic mostlyclean mostlyclean-generic \ 585 575 mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ 586 576 uninstall-am uninstall-nobase_includeHEADERS 587 577 588 -.PRECIOUS: Makefile 589 - 590 578 591 579 # Tell versions [3.59,3.63) of GNU make to not export all variables. 592 580 # Otherwise a system limit (for SysV at least) may be exceeded. 593 581 .NOEXPORT:
Changes to headers/rasterlite2_private.h.
1097 1097 } rl2Point; 1098 1098 typedef rl2Point *rl2PointPtr; 1099 1099 1100 1100 typedef struct rl2_linestring 1101 1101 { 1102 1102 int points; 1103 1103 double *coords; 1104 - double minx; 1105 - double miny; 1106 - double maxx; 1107 - double maxy; 1108 1104 struct rl2_linestring *next; 1109 1105 } rl2Linestring; 1110 1106 typedef rl2Linestring *rl2LinestringPtr; 1111 1107 1112 1108 typedef struct rl2_ring 1113 1109 { 1114 1110 int points; 1115 1111 double *coords; 1116 - double minx; 1117 - double miny; 1118 - double maxx; 1119 - double maxy; 1120 1112 struct rl2_ring *next; 1121 1113 } rl2Ring; 1122 1114 typedef rl2Ring *rl2RingPtr; 1123 1115 1124 1116 typedef struct rl2_polygon 1125 1117 { 1126 1118 rl2RingPtr exterior; ................................................................................ 1261 1253 unsigned int *height, 1262 1254 unsigned char sample_type, 1263 1255 unsigned char pixel_type, 1264 1256 unsigned char num_bands, 1265 1257 unsigned char **pixels, int *pixels_sz); 1266 1258 1267 1259 RL2_PRIVATE int 1268 - rl2_data_to_png (const unsigned char *pixels, 1269 - const unsigned char *mask, double opacity, 1270 - rl2PalettePtr plt, unsigned int width, 1271 - unsigned int height, unsigned char sample_type, 1272 - unsigned char pixel_type, unsigned char num_bands, 1273 - unsigned char **compr_data, int *compressed_size); 1260 + rl2_data_to_png (const unsigned char *pixels, const unsigned char *mask, 1261 + double opacity, rl2PalettePtr plt, 1262 + unsigned int width, unsigned int height, 1263 + unsigned char sample_type, unsigned char pixel_type, 1264 + unsigned char num_bands, unsigned char **compr_data, 1265 + int *compressed_size); 1274 1266 1275 1267 RL2_PRIVATE int 1276 1268 rl2_decode_png (const unsigned char *png, int png_sz, 1277 1269 unsigned int *width, unsigned int *height, 1278 1270 unsigned char *sample_type, unsigned char *pixel_type, 1279 1271 unsigned char *num_bands, unsigned char **pixels, 1280 1272 int *pixels_sz, unsigned char **mask, int *mask_sz, ................................................................................ 1286 1278 unsigned char pixel_type, unsigned char num_bands, 1287 1279 unsigned char **compr_data, int *compressed_size); 1288 1280 1289 1281 RL2_PRIVATE int 1290 1282 rl2_decode_charls (const unsigned char *charls, int charls_sz, 1291 1283 unsigned int *width, unsigned int *height, 1292 1284 unsigned char *sample_type, 1293 - unsigned char *pixel_type, 1294 - unsigned char *num_bands, unsigned char **pixels, 1295 - int *pixels_sz); 1285 + unsigned char *pixel_type, unsigned char *num_bands, 1286 + unsigned char **pixels, int *pixels_sz); 1296 1287 1297 1288 RL2_PRIVATE int 1298 1289 rl2_data_to_gif (const unsigned char *pixels, 1299 1290 rl2PalettePtr plt, unsigned int width, 1300 1291 unsigned int height, unsigned char sample_type, 1301 1292 unsigned char pixel_type, unsigned char **compr_data, 1302 1293 int *compressed_size); ................................................................................ 1352 1343 unsigned int height, 1353 1344 unsigned char sample_type, 1354 1345 unsigned char num_bands, 1355 1346 unsigned char auto_ndvi, 1356 1347 unsigned char red_band_index, 1357 1348 unsigned char nir_band_index, 1358 1349 double x_res, double y_res, 1359 - double minx, double miny, 1360 - double maxx, double maxy, int level, 1361 - int scale, rl2PalettePtr palette, 1350 + double minx, double miny, double maxx, 1351 + double maxy, int level, int scale, 1352 + rl2PalettePtr palette, 1362 1353 rl2PixelPtr no_data, 1363 1354 rl2RasterSymbolizerPtr style, 1364 1355 rl2RasterStatisticsPtr stats); 1365 1356 1366 1357 RL2_PRIVATE int rl2_load_dbms_tiles_section (sqlite3 * handle, 1367 1358 int max_threads, 1368 1359 sqlite3_int64 section_id, ................................................................................ 1456 1447 int scale, double x_res, 1457 1448 double y_res); 1458 1449 1459 1450 RL2_PRIVATE int rl2_find_best_resolution_level (sqlite3 * handle, 1460 1451 const char *coverage, 1461 1452 int by_section, 1462 1453 sqlite3_int64 section_id, 1463 - double x_res, 1464 - double y_res, 1454 + double x_res, double y_res, 1465 1455 int *level_id, int *scale, 1466 1456 int *real_scale, 1467 1457 double *xx_res, 1468 1458 double *yy_res); 1469 1459 1470 1460 RL2_PRIVATE unsigned char get_palette_format (rl2PrivPalettePtr plt); 1471 1461 ................................................................................ 1507 1497 unsigned char format, 1508 1498 int quality, 1509 1499 unsigned char **image, 1510 1500 int *image_sz); 1511 1501 1512 1502 RL2_PRIVATE int get_payload_from_palette_transparent (unsigned int width, 1513 1503 unsigned int height, 1514 - unsigned char 1515 - *pixels, 1516 - rl2PalettePtr 1517 - palette, 1518 - unsigned char 1519 - format, int quality, 1520 - unsigned char 1521 - **image, 1504 + unsigned char *pixels, 1505 + rl2PalettePtr palette, 1506 + unsigned char format, 1507 + int quality, 1508 + unsigned char **image, 1522 1509 int *image_sz, 1523 - unsigned char 1524 - bg_red, 1510 + unsigned char bg_red, 1525 1511 unsigned char 1526 1512 bg_green, 1527 1513 unsigned char 1528 1514 bg_blue, 1529 1515 double opacity); 1530 1516 1531 1517 RL2_PRIVATE int get_payload_from_grayscale_opaque (unsigned int width, 1532 1518 unsigned int height, 1533 1519 sqlite3 * handle, 1534 - double minx, 1535 - double miny, 1536 - double maxx, 1537 - double maxy, int srid, 1520 + double minx, double miny, 1521 + double maxx, double maxy, 1522 + int srid, 1538 1523 unsigned char *pixels, 1539 1524 unsigned char format, 1540 1525 int quality, 1541 1526 unsigned char **image, 1542 1527 int *image_sz); 1543 1528 1544 1529 RL2_PRIVATE int get_payload_from_grayscale_transparent (unsigned int 1545 1530 width, 1546 1531 unsigned int 1547 1532 height, 1548 1533 unsigned char 1549 1534 *pixels, 1550 1535 unsigned char 1551 - format, 1552 - int quality, 1536 + format, int quality, 1553 1537 unsigned char 1554 1538 **image, 1555 1539 int *image_sz, 1556 1540 unsigned char 1557 1541 bg_gray, 1558 1542 double opacity); 1559 1543 1560 1544 RL2_PRIVATE int get_payload_from_rgb_opaque (unsigned int width, 1561 1545 unsigned int height, 1562 - sqlite3 * handle, 1563 - double minx, double miny, 1564 - double maxx, double maxy, 1565 - int srid, 1546 + sqlite3 * handle, double minx, 1547 + double miny, double maxx, 1548 + double maxy, int srid, 1566 1549 unsigned char *pixels, 1567 1550 unsigned char format, 1568 1551 int quality, 1569 1552 unsigned char **image, 1570 1553 int *image_sz); 1571 1554 1572 1555 RL2_PRIVATE int get_payload_from_rgb_transparent (unsigned int width, ................................................................................ 1591 1574 RL2_PRIVATE int get_rgba_from_monochrome_opaque (unsigned int width, 1592 1575 unsigned int height, 1593 1576 unsigned char *pixels, 1594 1577 unsigned char *rgba); 1595 1578 1596 1579 RL2_PRIVATE int get_rgba_from_monochrome_transparent (unsigned int width, 1597 1580 unsigned int height, 1598 - unsigned char 1599 - *pixels, 1581 + unsigned char *pixels, 1600 1582 unsigned char *rgba); 1601 1583 1602 1584 RL2_PRIVATE int get_rgba_from_palette_mask (unsigned int base_width, 1603 1585 unsigned int base_height, 1604 1586 unsigned char *pixels, 1605 1587 unsigned char *mask, 1606 1588 rl2PalettePtr palette, ................................................................................ 1632 1614 RL2_PRIVATE int get_rgba_from_grayscale_opaque (unsigned int width, 1633 1615 unsigned int height, 1634 1616 unsigned char *pixels, 1635 1617 unsigned char *rgba); 1636 1618 1637 1619 RL2_PRIVATE int get_rgba_from_grayscale_transparent (unsigned int width, 1638 1620 unsigned int height, 1639 - unsigned char 1640 - *pixels, 1621 + unsigned char *pixels, 1641 1622 unsigned char *rgba, 1642 1623 unsigned char bg_gray); 1643 1624 1644 1625 RL2_PRIVATE int get_rgba_from_rgb_mask (unsigned int width, 1645 1626 unsigned int height, 1646 1627 unsigned char *pixels, 1647 1628 unsigned char *mask, ................................................................................ 1677 1658 unsigned char *mask, 1678 1659 rl2PrivPixelPtr no_made, 1679 1660 unsigned char *rgba); 1680 1661 1681 1662 RL2_PRIVATE int get_payload_from_gray_rgba_opaque (unsigned int width, 1682 1663 unsigned int height, 1683 1664 sqlite3 * handle, 1684 - double minx, 1685 - double miny, 1686 - double maxx, 1687 - double maxy, int srid, 1665 + double minx, double miny, 1666 + double maxx, double maxy, 1667 + int srid, 1688 1668 unsigned char *rgb, 1689 1669 unsigned char format, 1690 1670 int quality, 1691 1671 unsigned char **image, 1692 1672 int *image_sz); 1693 1673 1694 1674 RL2_PRIVATE int get_payload_from_gray_rgba_transparent (unsigned int 1695 1675 width, 1696 1676 unsigned int 1697 1677 height, 1698 - unsigned char 1699 - *rgb, 1678 + unsigned char *rgb, 1700 1679 unsigned char 1701 1680 *alpha, 1702 1681 unsigned char 1703 - format, 1704 - int quality, 1682 + format, int quality, 1705 1683 unsigned char 1706 1684 **image, 1707 1685 int *image_sz, 1708 1686 double opacity); 1709 1687 1710 1688 RL2_PRIVATE int get_payload_from_rgb_rgba_opaque (unsigned int width, 1711 1689 unsigned int height, 1712 1690 sqlite3 * handle, 1713 - double minx, 1714 - double miny, 1715 - double maxx, 1716 - double maxy, int srid, 1691 + double minx, double miny, 1692 + double maxx, double maxy, 1693 + int srid, 1717 1694 unsigned char *rgb, 1718 1695 unsigned char format, 1719 1696 int quality, 1720 1697 unsigned char **image, 1721 1698 int *image_sz); 1722 1699 1723 1700 RL2_PRIVATE int get_payload_from_rgb_rgba_transparent (unsigned int width, 1724 1701 unsigned int 1725 1702 height, 1726 1703 unsigned char *rgb, 1727 - unsigned char 1728 - *alpha, 1729 - unsigned char 1730 - format, 1704 + unsigned char *alpha, 1705 + unsigned char format, 1731 1706 int quality, 1732 1707 unsigned char 1733 1708 **image, 1734 1709 int *image_sz, 1735 1710 double opacity, 1736 1711 int 1737 1712 half_transparent); 1738 1713 1739 1714 RL2_PRIVATE int build_rgb_alpha (unsigned int width, 1740 1715 unsigned int height, unsigned char *rgba, 1741 - unsigned char **rgb, 1742 - unsigned char **alpha, 1716 + unsigned char **rgb, unsigned char **alpha, 1743 1717 unsigned char bg_red, 1744 1718 unsigned char bg_green, 1745 1719 unsigned char bg_blue); 1746 1720 1747 1721 RL2_PRIVATE int get_rgba_from_multiband8 (unsigned int width, 1748 1722 unsigned int height, 1749 1723 unsigned char red_band, ................................................................................ 1768 1742 RL2_PRIVATE int parse_worldfile (FILE * in, double *px, double *py, 1769 1743 double *pres_x, double *pres_y); 1770 1744 1771 1745 RL2_PRIVATE rl2CoverageStylePtr coverage_style_from_xml (char *name, 1772 1746 unsigned char 1773 1747 *xml); 1774 1748 1775 - RL2_PRIVATE rl2FeatureTypeStylePtr feature_type_style_from_xml (char 1776 - *name, 1749 + RL2_PRIVATE rl2FeatureTypeStylePtr feature_type_style_from_xml (char *name, 1777 1750 unsigned 1778 1751 char *xml); 1779 1752 1780 1753 RL2_PRIVATE rl2GroupStylePtr group_style_from_sld_xml (char *name, 1781 1754 unsigned char *xml); 1782 1755 1783 1756 RL2_PRIVATE rl2PrivCoverageStylePtr ................................................................................ 1858 1831 1859 1832 RL2_PRIVATE void rl2_destroy_point_symbolizer (rl2PrivPointSymbolizerPtr 1860 1833 symbolizer); 1861 1834 1862 1835 RL2_PRIVATE void rl2_destroy_line_symbolizer (rl2PrivLineSymbolizerPtr 1863 1836 symbolizer); 1864 1837 1865 - RL2_PRIVATE void 1866 - rl2_destroy_polygon_symbolizer (rl2PrivPolygonSymbolizerPtr symbolizer); 1838 + RL2_PRIVATE void rl2_destroy_polygon_symbolizer (rl2PrivPolygonSymbolizerPtr 1839 + symbolizer); 1867 1840 1868 1841 RL2_PRIVATE void rl2_destroy_text_symbolizer (rl2PrivTextSymbolizerPtr 1869 1842 symbolizer); 1870 1843 1871 1844 RL2_PRIVATE rl2PrivRuleSingleArgPtr 1872 1845 rl2_create_default_rule_single_arg (void); 1873 1846 ................................................................................ 1908 1881 rl2RasterSymbolizerPtr style, 1909 1882 rl2RasterStatisticsPtr stats); 1910 1883 1911 1884 RL2_PRIVATE unsigned char *rl2_copy_endian_raw_pixels (const unsigned char 1912 1885 *pixels, 1913 1886 int pixels_sz, 1914 1887 unsigned int width, 1915 - unsigned int 1916 - height, 1888 + unsigned int height, 1917 1889 unsigned char 1918 1890 sample_type, 1919 1891 unsigned char 1920 1892 num_bands, 1921 1893 int big_endian); 1922 1894 1923 1895 RL2_PRIVATE int rl2_build_shaded_relief_mask (sqlite3 * handle, ................................................................................ 1938 1910 const char *title, 1939 1911 const char *abstract); 1940 1912 1941 1913 RL2_PRIVATE int rl2_test_layer_group (sqlite3 * handle, 1942 1914 const char *group_name); 1943 1915 1944 1916 RL2_PRIVATE int rl2_rgba_raster_data (sqlite3 * handle, 1945 - const char *coverage_name, 1946 - void *ctx, int level, double minx, 1947 - double miny, double maxx, 1948 - double maxy, rl2PalettePtr palette, 1917 + const char *coverage_name, void *ctx, 1918 + int level, double minx, double miny, 1919 + double maxx, double maxy, 1920 + rl2PalettePtr palette, 1949 1921 rl2PixelPtr no_data); 1950 1922 1951 1923 RL2_PRIVATE int rl2_aux_render_image (struct aux_renderer *aux, 1952 1924 unsigned char **ximage, 1953 1925 int *ximage_size); 1954 1926 1955 - RL2_PRIVATE int rl2_aux_default_image (unsigned int width, 1956 - unsigned int height, 1957 - unsigned char red, 1958 - unsigned char green, 1959 - unsigned char blue, int format_id, 1960 - int transparent, int quality, 1961 - unsigned char **ximage, 1962 - int *ximage_size); 1963 - 1964 1927 RL2_PRIVATE void rl2_aux_group_renderer (struct aux_group_renderer *auxgrp); 1965 1928 1966 1929 RL2_PRIVATE double rl2_get_shaded_relief_scale_factor (sqlite3 * handle, 1967 1930 const char 1968 1931 *coverage); 1969 1932 1970 1933 RL2_PRIVATE void *rl2_CreateMD5Checksum (void); ................................................................................ 1987 1950 rl2CoveragePtr cvg, 1988 1951 int by_section, 1989 1952 sqlite3_int64 section_id, 1990 1953 unsigned int width, 1991 1954 unsigned int height, 1992 1955 double minx, double miny, 1993 1956 double maxx, double maxy, 1994 - double x_res, 1995 - double y_res, 1957 + double x_res, double y_res, 1996 1958 unsigned char **buffer, 1997 1959 int *buf_size, 1998 1960 rl2PalettePtr * palette, 1999 1961 unsigned char out_pixel, 2000 1962 rl2PixelPtr bgcolor, 2001 1963 rl2RasterSymbolizerPtr 2002 1964 style, ................................................................................ 2010 1972 double *x, double *y); 2011 1973 2012 1974 RL2_PRIVATE int rl2_parse_point_generic (sqlite3 * sqlite, 2013 1975 const unsigned char *blob, 2014 1976 int blob_sz, double *x, double *y); 2015 1977 2016 1978 RL2_PRIVATE int rl2_parse_bbox_srid (sqlite3 * sqlite, 2017 - const unsigned char *blob, 2018 - int blob_sz, int *srid, double *minx, 2019 - double *miny, double *maxx, 2020 - double *maxy); 1979 + const unsigned char *blob, int blob_sz, 1980 + int *srid, double *minx, double *miny, 1981 + double *maxx, double *maxy); 2021 1982 2022 - RL2_PRIVATE int rl2_parse_bbox (sqlite3 * sqlite, 2023 - const unsigned char *blob, int blob_sz, 2024 - double *minx, double *miny, double *maxx, 2025 - double *maxy); 1983 + RL2_PRIVATE int rl2_parse_bbox (sqlite3 * sqlite, const unsigned char *blob, 1984 + int blob_sz, double *minx, double *miny, 1985 + double *maxx, double *maxy); 2026 1986 2027 1987 RL2_PRIVATE int rl2_build_bbox (sqlite3 * sqlite, int srid, double minx, 2028 1988 double miny, double maxx, double maxy, 2029 1989 unsigned char **blob, int *blob_sz); 2030 1990 2031 1991 RL2_PRIVATE int rl2_delta_encode (unsigned char *buffer, int size, 2032 1992 int distance); 2033 1993 2034 1994 RL2_PRIVATE int rl2_delta_decode (unsigned char *buffer, int size, 2035 1995 int distance); 2036 1996 2037 - RL2_PRIVATE rl2PrivVariantValuePtr rl2_create_variant_int (const char 2038 - *name, 1997 + RL2_PRIVATE rl2PrivVariantValuePtr rl2_create_variant_int (const char *name, 2039 1998 sqlite3_int64 2040 1999 value); 2041 2000 2042 2001 RL2_PRIVATE rl2PrivVariantValuePtr rl2_create_variant_double (const char 2043 2002 *name, 2044 2003 double value); 2045 2004 ................................................................................ 2053 2012 2054 2013 RL2_PRIVATE rl2PrivVariantValuePtr rl2_create_variant_null (const char 2055 2014 *name); 2056 2015 2057 2016 RL2_PRIVATE void rl2_destroy_variant_value (rl2PrivVariantValuePtr value); 2058 2017 2059 2018 RL2_PRIVATE void rl2_draw_vector_feature (void *ctx, sqlite3 * handle, 2060 - const void *priv_data, 2061 - rl2VectorSymbolizerPtr 2062 - symbolizer, int height, 2063 - double minx, double miny, 2064 - double maxx, double maxy, 2065 - double x_res, double y_res, 2019 + rl2VectorSymbolizerPtr symbolizer, 2020 + int height, double minx, 2021 + double miny, double x_res, 2022 + double y_res, 2066 2023 rl2GeometryPtr geom, 2067 2024 rl2VariantArrayPtr variant); 2068 2025 2069 2026 RL2_PRIVATE rl2GeometryPtr 2070 2027 rl2_geometry_from_blob (const unsigned char *blob, int blob_sz); 2071 2028 2072 2029 RL2_PRIVATE rl2GeometryPtr ................................................................................ 2077 2034 RL2_PRIVATE int rl2_serialize_linestring (rl2LinestringPtr line, 2078 2035 unsigned char **blob, 2079 2036 int *blob_sz); 2080 2037 2081 2038 RL2_PRIVATE int rl2_serialize_ring (rl2RingPtr ring, unsigned char **blob, 2082 2039 int *blob_sz); 2083 2040 2084 - RL2_PRIVATE int rl2_serialize_ring_as_linestring (rl2RingPtr ring, 2085 - unsigned char **blob, 2086 - int *blob_sz); 2087 - 2088 2041 RL2_PRIVATE double rl2_compute_curve_length (rl2GeometryPtr geom); 2089 2042 2090 2043 RL2_PRIVATE rl2GeometryPtr 2091 - rl2_curve_substring (sqlite3 * handle, rl2GeometryPtr geom, 2092 - double from, double to); 2044 + rl2_curve_substring (sqlite3 * handle, rl2GeometryPtr geom, double from, 2045 + double to); 2093 2046 2094 2047 RL2_PRIVATE rl2GeometryPtr rl2_clone_curve (rl2GeometryPtr in); 2095 2048 2096 2049 RL2_PRIVATE rl2GeometryPtr rl2_clone_linestring (rl2LinestringPtr in); 2097 2050 2098 2051 RL2_PRIVATE rl2GeometryPtr 2099 2052 rl2_build_circle (double x, double y, double radius); ................................................................................ 2101 2054 RL2_PRIVATE int rl2_load_font_into_dbms (sqlite3 * handle, 2102 2055 unsigned char *blob, int blob_sz); 2103 2056 2104 2057 RL2_PRIVATE int rl2_get_font_from_dbms (sqlite3 * handle, 2105 2058 const char *facename, 2106 2059 unsigned char **font, int *font_sz); 2107 2060 2108 - RL2_PRIVATE rl2LinestringPtr rl2_linestring_to_image (rl2LinestringPtr line, 2109 - int height, 2110 - double minx, 2111 - double miny, 2112 - double x_res, 2113 - double y_res); 2114 - 2115 - RL2_PRIVATE rl2RingPtr rl2_ring_to_image (rl2RingPtr ring, int height, 2116 - double minx, double miny, 2117 - double x_res, double y_res); 2118 - 2119 - RL2_PRIVATE void rl2DestroyLinestring (rl2LinestringPtr ptr); 2120 - 2121 - RL2_PRIVATE void rl2DestroyRing (rl2RingPtr ptr); 2122 - 2123 2061 #ifdef __cplusplus 2124 2062 } 2125 2063 #endif 2126 2064 2127 2065 #endif /* _RASTERLITE2_PRIVATE_H */
Changes to headers/rl2svg_private.h.
502 502 in); 503 503 504 504 RL2_PRIVATE rl2PrivSvgLinePtr svg_alloc_line (double x1, double y1, 505 505 double x2, double y2); 506 506 507 507 RL2_PRIVATE rl2PrivSvgLinePtr svg_clone_line (rl2PrivSvgLinePtr in); 508 508 509 - RL2_PRIVATE rl2PrivSvgPolylinePtr svg_alloc_polyline (int points, 510 - double *x, double *y); 509 + RL2_PRIVATE rl2PrivSvgPolylinePtr svg_alloc_polyline (int points, double *x, 510 + double *y); 511 511 512 - RL2_PRIVATE rl2PrivSvgPolylinePtr 513 - svg_clone_polyline (rl2PrivSvgPolylinePtr in); 512 + RL2_PRIVATE rl2PrivSvgPolylinePtr svg_clone_polyline (rl2PrivSvgPolylinePtr 513 + in); 514 514 515 515 RL2_PRIVATE rl2PrivSvgPolygonPtr svg_alloc_polygon (int points, double *x, 516 516 double *y); 517 517 518 518 RL2_PRIVATE rl2PrivSvgPolygonPtr svg_clone_polygon (rl2PrivSvgPolygonPtr 519 519 in); 520 520 521 521 RL2_PRIVATE rl2PrivSvgPathMovePtr svg_alloc_path_move (double x, double y); 522 522 523 - RL2_PRIVATE rl2PrivSvgPathMovePtr 524 - svg_clone_path_move (rl2PrivSvgPathMovePtr in); 523 + RL2_PRIVATE rl2PrivSvgPathMovePtr svg_clone_path_move (rl2PrivSvgPathMovePtr 524 + in); 525 525 526 526 RL2_PRIVATE rl2PrivSvgPathBezierPtr svg_alloc_path_bezier (double x1, 527 527 double y1, 528 528 double x2, 529 529 double y2, 530 530 double x, 531 531 double y); ................................................................................ 606 606 607 607 RL2_PRIVATE void svg_set_group_parent (rl2PrivSvgItemPtr item, 608 608 rl2PrivSvgGroupPtr grp); 609 609 610 610 RL2_PRIVATE rl2PrivSvgGradientStopPtr svg_alloc_gradient_stop (double 611 611 offset, 612 612 double red, 613 - double 614 - green, 615 - double 616 - blue, 613 + double green, 614 + double blue, 617 615 double 618 616 opacity); 619 617 620 618 RL2_PRIVATE rl2PrivSvgGradientStopPtr 621 619 svg_clone_gradient_stop (rl2PrivSvgGradientStopPtr in); 622 620 623 621 RL2_PRIVATE rl2PrivSvgGradientPtr svg_alloc_gradient (void); 624 622 625 - RL2_PRIVATE rl2PrivSvgGradientPtr 626 - svg_clone_gradient (rl2PrivSvgGradientPtr in, 627 - rl2PrivSvgGradientPtr old); 623 + RL2_PRIVATE rl2PrivSvgGradientPtr svg_clone_gradient (rl2PrivSvgGradientPtr 624 + in, 625 + rl2PrivSvgGradientPtr 626 + old); 628 627 629 628 RL2_PRIVATE rl2PrivSvgDocumentPtr svg_alloc_document (void); 630 629 631 630 RL2_PRIVATE void svg_close_group (rl2PrivSvgDocumentPtr svg_doc); 632 631 633 632 RL2_PRIVATE void svg_insert_group (rl2PrivSvgDocumentPtr svg_doc); 634 633 635 634 RL2_PRIVATE void svg_close_clip (rl2PrivSvgDocumentPtr svg_doc); 636 635 637 636 RL2_PRIVATE void svg_insert_clip (rl2PrivSvgDocumentPtr svg_doc); 638 637 639 - RL2_PRIVATE rl2PrivSvgUsePtr svg_insert_use (rl2PrivSvgDocumentPtr 640 - svg_doc, 638 + RL2_PRIVATE rl2PrivSvgUsePtr svg_insert_use (rl2PrivSvgDocumentPtr svg_doc, 641 639 const char *xlink_href, 642 640 double x, double y, 643 641 double width, double height); 644 642 645 - RL2_PRIVATE void svg_insert_shape (rl2PrivSvgDocumentPtr svg_doc, 646 - int type, void *data); 643 + RL2_PRIVATE void svg_insert_shape (rl2PrivSvgDocumentPtr svg_doc, int type, 644 + void *data); 647 645 648 646 RL2_PRIVATE void svg_insert_gradient_stop (rl2PrivSvgGradientPtr gradient, 649 647 double offset, double red, 650 648 double green, double blue, 651 649 double opacity); 652 650 653 651 RL2_PRIVATE rl2PrivSvgGradientPtr 654 652 svg_insert_linear_gradient (rl2PrivSvgDocumentPtr svg_doc, 655 653 const char *id, const char *xlink_href, 656 - double x1, double y1, double x2, 657 - double y2, int units); 654 + double x1, double y1, double x2, double y2, 655 + int units); 658 656 659 657 RL2_PRIVATE rl2PrivSvgGradientPtr 660 658 svg_insert_radial_gradient (rl2PrivSvgDocumentPtr svg_doc, 661 659 const char *id, const char *xlink_href, 662 - double cx, double cy, double fx, 663 - double fy, double r, int units); 660 + double cx, double cy, double fx, double fy, 661 + double r, int units); 664 662 665 663 RL2_PRIVATE rl2PrivSvgGradientPtr 666 664 svg_insert_radial_gradient (rl2PrivSvgDocumentPtr svg_doc, 667 665 const char *id, const char *xlink_href, 668 - double cx, double cy, double fx, 669 - double fy, double r, int units); 666 + double cx, double cy, double fx, double fy, 667 + double r, int units); 670 668 671 669 RL2_PRIVATE void svg_init_style (rl2PrivSvgStylePtr style); 672 670 673 671 RL2_PRIVATE void svg_style_cleanup (rl2PrivSvgStylePtr style); 674 672 675 673 676 674 #ifdef __cplusplus 677 675 } 678 676 #endif 679 677 680 678 #endif /* _RL2SVG_PRIVATE_H */
Added rasterlite2-4.2.0.mk.
1 +include $(CLEAR_VARS) 2 +# ./configure --build=x86_64-pc-linux-gnu --host=arm-linux-eabi 3 +LOCAL_MODULE := rasterlite2 4 + 5 +# SQLite flags copied from ASOP [may not be needed for rasterlite2] 6 +common_sqlite_flags := \ 7 + -DHAVE_USLEEP=1 \ 8 + -DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576 \ 9 + -DSQLITE_THREADSAFE=1 \ 10 + -DNDEBUG=1 \ 11 + -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 \ 12 + -DSQLITE_DEFAULT_AUTOVACUUM=1 \ 13 + -DSQLITE_TEMP_STORE=3 \ 14 + -DSQLITE_ENABLE_FTS3 \ 15 + -DSQLITE_ENABLE_FTS3_BACKWARDS \ 16 + -DSQLITE_ENABLE_RTREE=1 \ 17 + -DSQLITE_DEFAULT_FILE_FORMAT=4 18 + 19 +# comment out TARGET_CPU in config.h - will be replaced with TARGET_ARCH_ABI 20 +spatialite_flags := \ 21 + -DOMIT_FREEXL \ 22 + -DTARGET_CPU=\"$(TARGET_ARCH_ABI)\" \ 23 + -Dfdatasync=fsync \ 24 + -DSQLITE_ENABLE_RTREE=1 \ 25 + -DSQLITE_OMIT_BUILTIN_TEST=1 26 + 27 +# comment out TARGET_CPU in config.h - will be replaced with TARGET_ARCH_ABI 28 +rasterlite2_flags := \ 29 + -DTARGET_CPU=\"$(TARGET_ARCH_ABI)\" \ 30 + -O 31 + 32 +LOCAL_CFLAGS := \ 33 + $(common_sqlite_flags) \ 34 + $(spatialite_flags) \ 35 + $(rasterlite2_flags) 36 + 37 +LOCAL_C_INCLUDES := \ 38 + $(SQLITE_PATH) \ 39 + $(GEOTIFF_PATH)/libxtiff \ 40 + $(GEOTIFF_PATH) \ 41 + $(TIFF_PATH) \ 42 + $(JPEG_PATH) \ 43 + $(GIF_PATH) \ 44 + $(PNG_PATH) \ 45 + $(WEBP_PATH)/src/webp \ 46 + $(WEBP_PATH)/src/dec \ 47 + $(WEBP_PATH)/src/dsp \ 48 + $(WEBP_PATH)/src/enc \ 49 + $(WEBP_PATH)/src/utils \ 50 + $(WEBP_PATH)/src \ 51 + $(WEBP_PATH) \ 52 + $(CAIRO_PATH) \ 53 + $(ICONV_PATH)/include \ 54 + $(ICONV_PATH)/libcharset/include \ 55 + $(XML2_PATH)/include \ 56 + $(CURL_PATH) \ 57 + $(CURL_PATH)/include \ 58 + $(CURL_PATH)/lib \ 59 + $(RASTERLITE2_PATH) \ 60 + $(RASTERLITE2_PATH)/headers \ 61 + $(SPATIALITE_PATH)/src/headers \ 62 + $(LZMA_PATH)/src/liblzma/api 63 +LOCAL_SRC_FILES := \ 64 + $(RASTERLITE2_PATH)/src/rasterlite2.c \ 65 + $(RASTERLITE2_PATH)/src/rl2ascii.c \ 66 + $(RASTERLITE2_PATH)/src/rl2codec.c \ 67 + $(RASTERLITE2_PATH)/src/rl2dbms.c \ 68 + $(RASTERLITE2_PATH)/src/rl2gif.c \ 69 + $(RASTERLITE2_PATH)/src/rl2import.c \ 70 + $(RASTERLITE2_PATH)/src/rl2jpeg.c \ 71 + $(RASTERLITE2_PATH)/src/rl2paint.c \ 72 + $(RASTERLITE2_PATH)/src/rl2png.c \ 73 + $(RASTERLITE2_PATH)/src/rl2rastersym.c \ 74 + $(RASTERLITE2_PATH)/src/rl2raw.c \ 75 + $(RASTERLITE2_PATH)/src/rl2sql.c \ 76 + $(RASTERLITE2_PATH)/src/rl2sqlaux.c \ 77 + $(RASTERLITE2_PATH)/src/rl2svg.c \ 78 + $(RASTERLITE2_PATH)/src/rl2svgaux.c \ 79 + $(RASTERLITE2_PATH)/src/rl2svgxml.c \ 80 + $(RASTERLITE2_PATH)/src/rl2symbolizer.c \ 81 + $(RASTERLITE2_PATH)/src/rl2tiff.c \ 82 + $(RASTERLITE2_PATH)/src/rl2version.c \ 83 + $(RASTERLITE2_PATH)/src/rl2webp.c \ 84 + $(RASTERLITE2_PATH)/src/rl2wms.c 85 +LOCAL_STATIC_LIBRARIES := libpng libwebp libxml2 spatialite libfreetype libcairo libcurl libgeotiff libtiff libgif libjpeg 86 +include $(BUILD_STATIC_LIBRARY)
Deleted rasterlite2-4.3.0.mk.
1 -include $(CLEAR_VARS) 2 -# ./configure --build=x86_64-pc-linux-gnu --host=arm-linux-eabi 3 -LOCAL_MODULE := rasterlite2 4 - 5 -# SQLite flags copied from ASOP [may not be needed for rasterlite2] 6 -common_sqlite_flags := \ 7 - -DHAVE_USLEEP=1 \ 8 - -DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576 \ 9 - -DSQLITE_THREADSAFE=1 \ 10 - -DNDEBUG=1 \ 11 - -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 \ 12 - -DSQLITE_DEFAULT_AUTOVACUUM=1 \ 13 - -DSQLITE_TEMP_STORE=3 \ 14 - -DSQLITE_ENABLE_FTS3 \ 15 - -DSQLITE_ENABLE_FTS3_BACKWARDS \ 16 - -DSQLITE_ENABLE_RTREE=1 \ 17 - -DSQLITE_DEFAULT_FILE_FORMAT=4 18 - 19 -# comment out TARGET_CPU in config.h - will be replaced with TARGET_ARCH_ABI 20 -spatialite_flags := \ 21 - -DOMIT_FREEXL \ 22 - -DTARGET_CPU=\"$(TARGET_ARCH_ABI)\" \ 23 - -Dfdatasync=fsync \ 24 - -DSQLITE_ENABLE_RTREE=1 \ 25 - -DENABLE_GCP=1 \ 26 - -DENABLE_GEOPACKAGE=1 \ 27 - -DENABLE_LIBXML2=1 \ 28 - -DSQLITE_OMIT_BUILTIN_TEST=1 29 - 30 -# comment out TARGET_CPU in config.h - will be replaced with TARGET_ARCH_ABI 31 -# comment out VERSION in config.h - manually set to avoid conflict with other packages 32 -rasterlite2_flags := \ 33 - -DTARGET_CPU=\"$(TARGET_ARCH_ABI)\" \ 34 - -DVERSION=\"0.9\" \ 35 - -O 36 - 37 -LOCAL_CFLAGS := \ 38 - $(common_sqlite_flags) \ 39 - $(spatialite_flags) \ 40 - $(rasterlite2_flags) 41 - 42 -# 2014-10-03 - adapted based on ls -1 result 43 -LOCAL_C_INCLUDES := \ 44 - $(SQLITE_PATH) \ 45 - $(GEOTIFF_PATH)/libxtiff \ 46 - $(GEOTIFF_PATH) \ 47 - $(TIFF_PATH) \ 48 - $(JPEG_PATH) \ 49 - $(GIF_PATH) \ 50 - $(PNG_PATH) \ 51 - $(WEBP_PATH)/src/webp \ 52 - $(WEBP_PATH)/src/dec \ 53 - $(WEBP_PATH)/src/dsp \ 54 - $(WEBP_PATH)/src/enc \ 55 - $(WEBP_PATH)/src/utils \ 56 - $(WEBP_PATH)/src \ 57 - $(WEBP_PATH) \ 58 - $(CAIRO_PATH) \ 59 - $(FONTCONFIG_PATH) \ 60 - $(ICONV_PATH)/include \ 61 - $(FREETYPE_PATH)/include \ 62 - $(ICONV_PATH)/libcharset/include \ 63 - $(XML2_PATH)/include \ 64 - $(CURL_PATH) \ 65 - $(CURL_PATH)/include \ 66 - $(CURL_PATH)/lib \ 67 - $(RASTERLITE2_PATH) \ 68 - $(RASTERLITE2_PATH)/headers \ 69 - $(SPATIALITE_PATH)/src/headers \ 70 - $(LZMA_PATH)/src/liblzma/api \ 71 - $(OPENJPEG_PATH)/src/lib/openjp2 \ 72 - $(CHARLS_PATH) 73 - 74 -LOCAL_SRC_FILES := \ 75 - $(RASTERLITE2_PATH)/src/md5.c \ 76 - $(RASTERLITE2_PATH)/src/rasterlite2.c \ 77 - $(RASTERLITE2_PATH)/src/rl2ascii.c \ 78 - $(RASTERLITE2_PATH)/src/rl2auxfont.c \ 79 - $(RASTERLITE2_PATH)/src/rl2auxgeom.c \ 80 - $(RASTERLITE2_PATH)/src/rl2auxrender.c \ 81 - $(RASTERLITE2_PATH)/src/rl2charls.c \ 82 - $(RASTERLITE2_PATH)/src/rl2codec.c \ 83 - $(RASTERLITE2_PATH)/src/rl2dbms.c \ 84 - $(RASTERLITE2_PATH)/src/rl2gif.c \ 85 - $(RASTERLITE2_PATH)/src/rl2import.c \ 86 - $(RASTERLITE2_PATH)/src/rl2jpeg.c \ 87 - $(RASTERLITE2_PATH)/src/rl2md5.c \ 88 - $(RASTERLITE2_PATH)/src/rl2openjpeg.c \ 89 - $(RASTERLITE2_PATH)/src/rl2paint.c \ 90 - $(RASTERLITE2_PATH)/src/rl2png.c \ 91 - $(RASTERLITE2_PATH)/src/rl2pyramid.c \ 92 - $(RASTERLITE2_PATH)/src/rl2rastersym.c \ 93 - $(RASTERLITE2_PATH)/src/rl2raw.c \ 94 - $(RASTERLITE2_PATH)/src/rl2sql.c \ 95 - $(RASTERLITE2_PATH)/src/rl2sqlaux.c \ 96 - $(RASTERLITE2_PATH)/src/rl2svg.c \ 97 - $(RASTERLITE2_PATH)/src/rl2svgaux.c \ 98 - $(RASTERLITE2_PATH)/src/rl2svgxml.c \ 99 - $(RASTERLITE2_PATH)/src/rl2symbaux.c \ 100 - $(RASTERLITE2_PATH)/src/rl2symbolizer.c \ 101 - $(RASTERLITE2_PATH)/src/rl2tiff.c \ 102 - $(RASTERLITE2_PATH)/src/rl2version.c \ 103 - $(RASTERLITE2_PATH)/src/rl2webp.c \ 104 - $(RASTERLITE2_PATH)/src/rl2wms.c 105 -LOCAL_STATIC_LIBRARIES := libcharls libopenjpeg libpng libwebp libxml2 spatialite libfreetype libcairo libcurl libgeotiff libtiff libgif libjpeg 106 -include $(BUILD_STATIC_LIBRARY)
Changes to src/Makefile.am.
21 21 @LIBLZMA_LIBS@ @LIBCAIRO_LIBS@ @LIBCURL_LIBS@ \ 22 22 @LIBXML2_LIBS@ @LIBFREETYPE2_LIBS@ 23 23 24 24 if MINGW 25 25 librasterlite2_la_LDFLAGS = -avoid-version -no-undefined 26 26 librasterlite2_la_LIBADD += -lm 27 27 else 28 -librasterlite2_la_LDFLAGS = -version-info 1:0:0 28 +librasterlite2_la_LDFLAGS = -version-info 0:0:0 29 29 librasterlite2_la_LIBADD += -lpthread -lm 30 30 endif 31 31 32 32 mod_rasterlite2_la_SOURCES = rasterlite2.c rl2raw.c rl2codec.c \ 33 33 rl2jpeg.c rl2png.c rl2gif.c rl2webp.c rl2tiff.c rl2wms.c \ 34 34 rl2ascii.c rl2paint.c rl2dbms.c rl2import.c rl2pyramid.c \ 35 35 rl2sql.c rl2sqlaux.c rl2auxrender.c rl2svg.c rl2svgxml.c \ ................................................................................ 46 46 mod_rasterlite2_la_CPPFLAGS += -DLOADABLE_EXTENSION 47 47 mod_rasterlite2_la_LIBTOOLFLAGS = --tag=disable-static 48 48 49 49 if MINGW 50 50 mod_rasterlite2_la_LDFLAGS = -module -avoid-version -no-undefined 51 51 mod_rasterlite2_la_LIBADD += -lm 52 52 else 53 -mod_rasterlite2_la_LDFLAGS = -module -version-info 1:0:0 53 +mod_rasterlite2_la_LDFLAGS = -module -version-info 0:0:0 54 54 mod_rasterlite2_la_LIBADD += -lpthread -lm 55 55 endif 56 56 57 57 MOSTLYCLEANFILES = *.gcna *.gcno *.gcda
Changes to src/Makefile.in.
1 -# Makefile.in generated by automake 1.15 from Makefile.am. 1 +# Makefile.in generated by automake 1.14.1 from Makefile.am. 2 2 # @configure_input@ 3 3 4 -# Copyright (C) 1994-2014 Free Software Foundation, Inc. 4 +# Copyright (C) 1994-2013 Free Software Foundation, Inc. 5 5 6 6 # This Makefile.in is free software; the Free Software Foundation 7 7 # gives unlimited permission to copy and/or distribute it, 8 8 # with or without modifications, as long as this notice is preserved. 9 9 10 10 # This program is distributed in the hope that it will be useful, 11 11 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without ................................................................................ 12 12 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 13 13 # PARTICULAR PURPOSE. 14 14 15 15 @SET_MAKE@ 16 16 17 17 18 18 VPATH = @srcdir@ 19 -am__is_gnu_make = { \ 20 - if test -z '$(MAKELEVEL)'; then \ 21 - false; \ 22 - elif test -n '$(MAKE_HOST)'; then \ 23 - true; \ 24 - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ 25 - true; \ 26 - else \ 27 - false; \ 28 - fi; \ 29 -} 19 +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 30 20 am__make_running_with_option = \ 31 21 case $${target_option-} in \ 32 22 ?) ;; \ 33 23 *) echo "am__make_running_with_option: internal error: invalid" \ 34 24 "target option '$${target_option-}' specified" >&2; \ 35 25 exit 1;; \ 36 26 esac; \ ................................................................................ 90 80 build_triplet = @build@ 91 81 host_triplet = @host@ 92 82 @MINGW_TRUE@am__append_1 = -lm 93 83 @MINGW_FALSE@am__append_2 = -lpthread -lm 94 84 @MINGW_TRUE@am__append_3 = -lm 95 85 @MINGW_FALSE@am__append_4 = -lpthread -lm 96 86 subdir = src 87 +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ 88 + $(top_srcdir)/depcomp $(noinst_HEADERS) 97 89 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 98 90 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ 99 91 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ 100 92 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ 101 93 $(top_srcdir)/configure.ac 102 94 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 103 95 $(ACLOCAL_M4) 104 -DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ 105 - $(am__DIST_COMMON) 106 96 mkinstalldirs = $(install_sh) -d 107 97 CONFIG_HEADER = $(top_builddir)/config.h 108 98 CONFIG_CLEAN_FILES = 109 99 CONFIG_CLEAN_VPATH_FILES = 110 100 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; 111 101 am__vpath_adj = case $$p in \ 112 102 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ ................................................................................ 240 230 am__define_uniq_tagged_files = \ 241 231 list='$(am__tagged_files)'; \ 242 232 unique=`for i in $$list; do \ 243 233 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 244 234 done | $(am__uniquify_input)` 245 235 ETAGS = etags 246 236 CTAGS = ctags 247 -am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp 248 237 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 249 238 ACLOCAL = @ACLOCAL@ 250 239 AMTAR = @AMTAR@ 251 240 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 252 241 AR = @AR@ 253 242 AS = @AS@ 254 243 AUTOCONF = @AUTOCONF@ ................................................................................ 402 391 rl2svgaux.c rl2symbolizer.c rl2symbaux.c rl2rastersym.c \ 403 392 rl2version.c rl2md5.c md5.c rl2charls.c rl2openjpeg.c \ 404 393 rl2auxgeom.c rl2auxfont.c 405 394 406 395 librasterlite2_la_LIBADD = @LIBPNG_LIBS@ @LIBWEBP_LIBS@ @LIBLZMA_LIBS@ \ 407 396 @LIBCAIRO_LIBS@ @LIBCURL_LIBS@ @LIBXML2_LIBS@ \ 408 397 @LIBFREETYPE2_LIBS@ $(am__append_1) $(am__append_2) 409 -@MINGW_FALSE@librasterlite2_la_LDFLAGS = -version-info 1:0:0 398 +@MINGW_FALSE@librasterlite2_la_LDFLAGS = -version-info 0:0:0 410 399 @MINGW_TRUE@librasterlite2_la_LDFLAGS = -avoid-version -no-undefined 411 400 mod_rasterlite2_la_SOURCES = rasterlite2.c rl2raw.c rl2codec.c \ 412 401 rl2jpeg.c rl2png.c rl2gif.c rl2webp.c rl2tiff.c rl2wms.c \ 413 402 rl2ascii.c rl2paint.c rl2dbms.c rl2import.c rl2pyramid.c \ 414 403 rl2sql.c rl2sqlaux.c rl2auxrender.c rl2svg.c rl2svgxml.c \ 415 404 rl2svgaux.c rl2symbolizer.c rl2symbaux.c rl2rastersym.c \ 416 405 rl2version.c rl2md5.c md5.c rl2charls.c rl2openjpeg.c \ ................................................................................ 418 407 419 408 mod_rasterlite2_la_LIBADD = @LIBPNG_LIBS@ @LIBWEBP_LIBS@ \ 420 409 @LIBLZMA_LIBS@ @LIBCAIRO_LIBS@ @LIBCURL_LIBS@ @LIBXML2_LIBS@ \ 421 410 @LIBFREETYPE2_LIBS@ $(am__append_3) $(am__append_4) 422 411 mod_rasterlite2_la_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/headers -I. \ 423 412 -DLOADABLE_EXTENSION 424 413 mod_rasterlite2_la_LIBTOOLFLAGS = --tag=disable-static 425 -@MINGW_FALSE@mod_rasterlite2_la_LDFLAGS = -module -version-info 1:0:0 414 +@MINGW_FALSE@mod_rasterlite2_la_LDFLAGS = -module -version-info 0:0:0 426 415 @MINGW_TRUE@mod_rasterlite2_la_LDFLAGS = -module -avoid-version -no-undefined 427 416 MOSTLYCLEANFILES = *.gcna *.gcno *.gcda 428 417 all: all-am 429 418 430 419 .SUFFIXES: 431 420 .SUFFIXES: .c .lo .o .obj 432 421 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) ................................................................................ 437 426 && { if test -f $@; then exit 0; else break; fi; }; \ 438 427 exit 1;; \ 439 428 esac; \ 440 429 done; \ 441 430 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ 442 431 $(am__cd) $(top_srcdir) && \ 443 432 $(AUTOMAKE) --gnu src/Makefile 433 +.PRECIOUS: Makefile 444 434 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 445 435 @case '$?' in \ 446 436 *config.status*) \ 447 437 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ 448 438 *) \ 449 439 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ 450 440 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ ................................................................................ 1007 997 install-info-am install-libLTLIBRARIES install-man install-pdf \ 1008 998 install-pdf-am install-ps install-ps-am install-strip \ 1009 999 installcheck installcheck-am installdirs maintainer-clean \ 1010 1000 maintainer-clean-generic mostlyclean mostlyclean-compile \ 1011 1001 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ 1012 1002 tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES 1013 1003 1014 -.PRECIOUS: Makefile 1015 - 1016 1004 1017 1005 # Tell versions [3.59,3.63) of GNU make to not export all variables. 1018 1006 # Otherwise a system limit (for SysV at least) may be exceeded. 1019 1007 .NOEXPORT:
Changes to src/rasterlite2.c.
510 510 return RL2_FALSE; 511 511 #endif 512 512 }; 513 513 return RL2_ERROR; 514 514 } 515 515 516 516 static int 517 -check_coverage_no_data (rl2PrivPixelPtr pxl_no_data, 518 - unsigned char sample_type, unsigned char pixel_type, 519 - unsigned char num_samples) 517 +check_coverage_no_data (rl2PrivPixelPtr pxl_no_data, unsigned char sample_type, 518 + unsigned char pixel_type, unsigned char num_samples) 520 519 { 521 520 /* checking if the NoData pixel is consistent with the Coverage */ 522 521 if (pxl_no_data == NULL) 523 522 return 1; 524 523 if (pxl_no_data->sampleType != sample_type) 525 524 return 0; 526 525 if (pxl_no_data->pixelType != pixel_type) ................................................................................ 1252 1251 return (rl2RasterPtr) rst; 1253 1252 } 1254 1253 1255 1254 RL2_DECLARE rl2RasterPtr 1256 1255 rl2_create_raster (unsigned int width, unsigned int height, 1257 1256 unsigned char sample_type, unsigned char pixel_type, 1258 1257 unsigned char num_samples, unsigned char *bufpix, 1259 - int bufpix_size, rl2PalettePtr palette, 1260 - unsigned char *mask, int mask_size, rl2PixelPtr no_data) 1258 + int bufpix_size, rl2PalettePtr palette, unsigned char *mask, 1259 + int mask_size, rl2PixelPtr no_data) 1261 1260 { 1262 1261 /* allocating and initializing a Raster object with an optional Transparency Mask */ 1263 1262 return create_raster_common (width, height, sample_type, pixel_type, 1264 1263 num_samples, bufpix, bufpix_size, palette, 1265 1264 mask, mask_size, no_data, 0); 1266 1265 } 1267 1266 ................................................................................ 1429 1428 rst->minY = cy - vExt; 1430 1429 rst->maxX = cx + hExt; 1431 1430 rst->maxY = cy + vExt; 1432 1431 return RL2_OK; 1433 1432 } 1434 1433 1435 1434 RL2_DECLARE int 1436 -rl2_raster_georeference_upper_left (rl2RasterPtr ptr, int srid, 1437 - double horz_res, double vert_res, 1438 - double x, double y) 1435 +rl2_raster_georeference_upper_left (rl2RasterPtr ptr, int srid, double horz_res, 1436 + double vert_res, double x, double y) 1439 1437 { 1440 1438 /* setting the Raster's georeferencing infos - UpperLeft corner */ 1441 1439 rl2PrivRasterPtr rst = (rl2PrivRasterPtr) ptr; 1442 1440 double hExt; 1443 1441 double vExt; 1444 1442 if (rst == NULL) 1445 1443 return RL2_ERROR; ................................................................................ 1453 1451 rst->maxX = x + hExt; 1454 1452 rst->maxY = y; 1455 1453 return RL2_OK; 1456 1454 } 1457 1455 1458 1456 RL2_DECLARE int 1459 1457 rl2_raster_georeference_upper_right (rl2RasterPtr ptr, int srid, 1460 - double horz_res, double vert_res, 1461 - double x, double y) 1458 + double horz_res, double vert_res, double x, 1459 + double y) 1462 1460 { 1463 1461 /* setting the Raster's georeferencing infos - UpperRight corner */ 1464 1462 rl2PrivRasterPtr rst = (rl2PrivRasterPtr) ptr; 1465 1463 double hExt; 1466 1464 double vExt; 1467 1465 if (rst == NULL) 1468 1466 return RL2_ERROR; ................................................................................ 1475 1473 rst->minY = y - vExt; 1476 1474 rst->maxX = x; 1477 1475 rst->maxY = y; 1478 1476 return RL2_OK; 1479 1477 } 1480 1478 1481 1479 RL2_DECLARE int 1482 -rl2_raster_georeference_lower_left (rl2RasterPtr ptr, int srid, 1483 - double horz_res, double vert_res, 1484 - double x, double y) 1480 +rl2_raster_georeference_lower_left (rl2RasterPtr ptr, int srid, double horz_res, 1481 + double vert_res, double x, double y) 1485 1482 { 1486 1483 /* setting the Raster's georeferencing infos - LowerLeft corner */ 1487 1484 rl2PrivRasterPtr rst = (rl2PrivRasterPtr) ptr; 1488 1485 double hExt; 1489 1486 double vExt; 1490 1487 if (rst == NULL) 1491 1488 return RL2_ERROR; ................................................................................ 1499 1496 rst->maxX = x + hExt; 1500 1497 rst->maxY = y + vExt; 1501 1498 return RL2_OK; 1502 1499 } 1503 1500 1504 1501 RL2_DECLARE int 1505 1502 rl2_raster_georeference_lower_right (rl2RasterPtr ptr, int srid, 1506 - double horz_res, double vert_res, 1507 - double x, double y) 1503 + double horz_res, double vert_res, double x, 1504 + double y) 1508 1505 { 1509 1506 /* setting the Raster's georeferencing infos - LowerRight corner */ 1510 1507 rl2PrivRasterPtr rst = (rl2PrivRasterPtr) ptr; 1511 1508 double hExt; 1512 1509 double vExt; 1513 1510 if (rst == NULL) 1514 1511 return RL2_ERROR; ................................................................................ 1806 1803 entry->red = r; 1807 1804 entry->green = g; 1808 1805 entry->blue = b; 1809 1806 return RL2_OK; 1810 1807 } 1811 1808 1812 1809 RL2_DECLARE int 1813 -rl2_get_palette_index (rl2PalettePtr ptr, unsigned char *index, 1814 - unsigned char r, unsigned char g, unsigned char b) 1810 +rl2_get_palette_index (rl2PalettePtr ptr, unsigned char *index, unsigned char r, 1811 + unsigned char g, unsigned char b) 1815 1812 { 1816 1813 /* finding the index corresponding to the given color (if any) */ 1817 1814 int i; 1818 1815 rl2PrivPaletteEntryPtr entry; 1819 1816 rl2PrivPalettePtr plt = (rl2PrivPalettePtr) ptr; 1820 1817 if (plt == NULL) 1821 1818 return RL2_ERROR;
Changes to src/rl2ascii.c.
316 316 &no_data)) 317 317 { 318 318 fprintf (stderr, "ASCII Origin: invalid Header found on %s\n", path); 319 319 goto error; 320 320 } 321 321 322 322 ascii = 323 - alloc_ascii_origin (path, srid, sample_type, width, height, minx, 324 - miny, maxx, maxy, xres, yres, no_data); 323 + alloc_ascii_origin (path, srid, sample_type, width, height, minx, miny, 324 + maxx, maxy, xres, yres, no_data); 325 325 if (ascii == NULL) 326 326 goto error; 327 327 328 328 *buf = '\0'; 329 329 col_no = width; 330 330 /* creating the helper Temporary File */ 331 331 ascii->tmp = tmpfile (); ................................................................................ 614 614 return RL2_FALSE; 615 615 if (coverage->Srid != srid) 616 616 { 617 617 if (verbose) 618 618 fprintf (stderr, "Mismatching SRID !!!\n"); 619 619 return RL2_FALSE; 620 620 } 621 - if (rl2_get_ascii_grid_origin_resolution 622 - (ascii, &hResolution, &vResolution) != RL2_OK) 621 + if (rl2_get_ascii_grid_origin_resolution (ascii, &hResolution, &vResolution) 622 + != RL2_OK) 623 623 return RL2_FALSE; 624 624 confidence = coverage->hResolution / 100.0; 625 625 if (hResolution < (coverage->hResolution - confidence) 626 626 || hResolution > (coverage->hResolution + confidence)) 627 627 { 628 628 if (verbose) 629 629 fprintf (stderr, "Mismatching Horizontal Resolution !!!\n"); ................................................................................ 748 748 unsigned short *p_out = pixels + (y * width); 749 749 if (fseek (origin->tmp, offset, SEEK_SET) != 0) 750 750 return 0; 751 751 for (x = 0, col = startCol; x < width && col < origin->width; 752 752 x++, col++) 753 753 { 754 754 unsigned short uint16; 755 - if (fread (&uint16, sizeof (unsigned short), 1, origin->tmp) 756 - <= 0) 755 + if (fread (&uint16, sizeof (unsigned short), 1, origin->tmp) <= 756 + 0) 757 757 return 0; 758 758 *p_out++ = uint16; 759 759 } 760 760 } 761 761 return 1; 762 762 } 763 763 ................................................................................ 1068 1068 /* setting opaque pixels */ 1069 1069 memset (p, 1, shadow_x); 1070 1070 } 1071 1071 } 1072 1072 } 1073 1073 raster = 1074 1074 rl2_create_raster (coverage->tileWidth, coverage->tileHeight, 1075 - coverage->sampleType, RL2_PIXEL_DATAGRID, 1, 1076 - pixels, pixels_sz, NULL, mask, mask_size, NULL); 1075 + coverage->sampleType, RL2_PIXEL_DATAGRID, 1, pixels, 1076 + pixels_sz, NULL, mask, mask_size, NULL); 1077 1077 if (raster == NULL) 1078 1078 goto error; 1079 1079 return raster; 1080 1080 error: 1081 1081 if (pixels != NULL) 1082 1082 free (pixels); 1083 1083 if (mask != NULL)
Changes to src/rl2auxfont.c.
690 690 const unsigned char *blob = sqlite3_column_blob (stmt, 0); 691 691 int blob_sz = sqlite3_column_bytes (stmt, 0); 692 692 if (xfont != NULL) 693 693 { 694 694 free (xfont); 695 695 xfont = NULL; 696 696 } 697 - if (rl2_font_decode (blob, blob_sz, &xfont, &xfont_sz) 698 - == RL2_OK) 697 + if (rl2_font_decode (blob, blob_sz, &xfont, &xfont_sz) == 698 + RL2_OK) 699 699 { 700 700 *font = xfont; 701 701 *font_sz = xfont_sz; 702 702 } 703 703 } 704 704 } 705 705 else ................................................................................ 723 723 unsigned char **font, int *font_sz) 724 724 { 725 725 /* attempting to fetch a BLOB-encoded TrueType Font */ 726 726 const char *sql; 727 727 int ret; 728 728 sqlite3_stmt *stmt = NULL; 729 729 unsigned char *xfont = NULL; 730 + int xfont_sz; 730 731 if (facename == NULL) 731 732 return RL2_ERROR; 732 733 733 734 *font = NULL; 734 735 *font_sz = 0; 735 736 /* preparing the SQL query statement */ 736 737 sql = "SELECT font FROM SE_fonts WHERE Lower(font_facename) = Lower(?)";
Changes to src/rl2auxgeom.c.
122 122 static rl2LinestringPtr 123 123 rl2CreateLinestring (int vert) 124 124 { 125 125 /* LINESTRING object constructor */ 126 126 rl2LinestringPtr p = malloc (sizeof (rl2Linestring)); 127 127 p->coords = malloc (sizeof (double) * (vert * 2)); 128 128 p->points = vert; 129 - p->minx = DBL_MAX; 130 - p->miny = DBL_MAX; 131 - p->maxx = 0.0 - DBL_MAX; 132 - p->maxy = 0.0 - DBL_MAX; 133 129 p->next = NULL; 134 130 return p; 135 131 } 136 132 137 -RL2_PRIVATE void 133 +static void 138 134 rl2DestroyLinestring (rl2LinestringPtr ptr) 139 135 { 140 136 /* LINESTRING object desctructror */ 141 137 if (ptr) 142 138 { 143 139 if (ptr->coords) 144 140 free (ptr->coords); 145 141 free (ptr); 146 142 } 147 143 } 148 144 149 -RL2_PRIVATE rl2LinestringPtr 150 -rl2_linestring_to_image (rl2LinestringPtr line, int height, double minx, 151 - double miny, double x_res, double y_res) 152 -{ 153 -/* creating a Linestring in image coordinates */ 154 - rl2LinestringPtr out = NULL; 155 - int iv; 156 - double x; 157 - double y; 158 - double dx; 159 - double dy; 160 - 161 - if (line == NULL) 162 - return NULL; 163 - out = rl2CreateLinestring (line->points); 164 - if (out == NULL) 165 - return out; 166 - for (iv = 0; iv < line->points; iv++) 167 - { 168 - /* populating the X and Y arrays */ 169 - rl2GetPoint (line->coords, iv, &x, &y); 170 - dx = (x - minx) / x_res; 171 - dy = (double) height - ((y - miny) / y_res); 172 - rl2SetPoint (out->coords, iv, dx, dy); 173 - } 174 - return out; 175 -} 176 - 177 145 static rl2RingPtr 178 146 rl2CreateRing (int vert) 179 147 { 180 148 /* ring object constructor */ 181 149 rl2RingPtr p = malloc (sizeof (rl2Ring)); 182 150 p->coords = malloc (sizeof (double) * (vert * 2)); 183 151 p->points = vert; 184 - p->minx = DBL_MAX; 185 - p->miny = DBL_MAX; 186 - p->maxx = 0.0 - DBL_MAX; 187 - p->maxy = 0.0 - DBL_MAX; 188 152 p->next = NULL; 189 153 return p; 190 154 } 191 155 192 -RL2_PRIVATE rl2RingPtr 193 -rl2_ring_to_image (rl2RingPtr ring, int height, double minx, double miny, 194 - double x_res, double y_res) 195 -{ 196 -/* creating a Ring in image coordinates */ 197 - rl2RingPtr out = NULL; 198 - int iv; 199 - double x; 200 - double y; 201 - double dx; 202 - double dy; 203 - 204 - if (ring == NULL) 205 - return NULL; 206 - out = rl2CreateRing (ring->points); 207 - if (out == NULL) 208 - return out; 209 - for (iv = 0; iv < ring->points; iv++) 210 - { 211 - /* populating the X and Y arrays */ 212 - rl2GetPoint (ring->coords, iv, &x, &y); 213 - dx = (x - minx) / x_res; 214 - dy = (double) height - ((y - miny) / y_res); 215 - rl2SetPoint (out->coords, iv, dx, dy); 216 - } 217 - return out; 218 -} 219 - 220 -RL2_PRIVATE void 156 +static void 221 157 rl2DestroyRing (rl2RingPtr ptr) 222 158 { 223 159 /* ring object destructor */ 224 160 if (ptr) 225 161 { 226 162 if (ptr->coords) 227 163 free (ptr->coords); ................................................................................ 686 622 return; 687 623 line = rl2AddLinestringToGeometry (geom, points); 688 624 for (iv = 0; iv < points; iv++) 689 625 { 690 626 x = rl2GeomImport64 (blob + *offset, endian, endian_arch); 691 627 y = rl2GeomImport64 (blob + (*offset + 8), endian, endian_arch); 692 628 rl2SetPoint (line->coords, iv, x, y); 693 - if (x < line->minx) 694 - line->minx = x; 695 - if (x > line->maxx) 696 - line->maxx = x; 697 - if (y < line->miny) 698 - line->miny = y; 699 - if (y > line->maxy) 700 - line->maxy = y; 701 629 *offset += 16; 702 630 } 703 631 } 704 632 705 633 static void 706 634 rl2ParseLineZ (rl2GeometryPtr geom, const unsigned char *blob, int size, 707 635 int endian, int endian_arch, int *offset) ................................................................................ 720 648 return; 721 649 line = rl2AddLinestringToGeometry (geom, points); 722 650 for (iv = 0; iv < points; iv++) 723 651 { 724 652 x = rl2GeomImport64 (blob + *offset, endian, endian_arch); 725 653 y = rl2GeomImport64 (blob + (*offset + 8), endian, endian_arch); 726 654 rl2SetPoint (line->coords, iv, x, y); 727 - if (x < line->minx) 728 - line->minx = x; 729 - if (x > line->maxx) 730 - line->maxx = x; 731 - if (y < line->miny) 732 - line->miny = y; 733 - if (y > line->maxy) 734 - line->maxy = y; 735 655 *offset += 24; 736 656 } 737 657 } 738 658 739 659 static void 740 660 rl2ParseLineM (rl2GeometryPtr geom, const unsigned char *blob, int size, 741 661 int endian, int endian_arch, int *offset) ................................................................................ 754 674 return; 755 675 line = rl2AddLinestringToGeometry (geom, points); 756 676 for (iv = 0; iv < points; iv++) 757 677 { 758 678 x = rl2GeomImport64 (blob + *offset, endian, endian_arch); 759 679 y = rl2GeomImport64 (blob + (*offset + 8), endian, endian_arch); 760 680 rl2SetPoint (line->coords, iv, x, y); 761 - if (x < line->minx) 762 - line->minx = x; 763 - if (x > line->maxx) 764 - line->maxx = x; 765 - if (y < line->miny) 766 - line->miny = y; 767 - if (y > line->maxy) 768 - line->maxy = y; 769 681 *offset += 24; 770 682 } 771 683 } 772 684 773 685 static void 774 686 rl2ParseLineZM (rl2GeometryPtr geom, const unsigned char *blob, int size, 775 687 int endian, int endian_arch, int *offset) ................................................................................ 788 700 return; 789 701 line = rl2AddLinestringToGeometry (geom, points); 790 702 for (iv = 0; iv < points; iv++) 791 703 { 792 704 x = rl2GeomImport64 (blob + *offset, endian, endian_arch); 793 705 y = rl2GeomImport64 (blob + (*offset + 8), endian, endian_arch); 794 706 rl2SetPoint (line->coords, iv, x, y); 795 - if (x < line->minx) 796 - line->minx = x; 797 - if (x > line->maxx) 798 - line->maxx = x; 799 - if (y < line->miny) 800 - line->miny = y; 801 - if (y > line->maxy) 802 - line->maxy = y; 803 707 *offset += 32; 804 708 } 805 709 } 806 710 807 711 static rl2PolygonPtr 808 712 rl2AddPolygonToGeometry (rl2GeometryPtr p, int vert, int interiors) 809 713 { ................................................................................ 861 765 ring = rl2AddInteriorRing (polyg, ib - 1, nverts); 862 766 for (iv = 0; iv < nverts; iv++) 863 767 { 864 768 x = rl2GeomImport64 (blob + *offset, endian, endian_arch); 865 769 y = rl2GeomImport64 (blob + (*offset + 8), endian, endian_arch); 866 770 *offset += 16; 867 771 rl2SetPoint (ring->coords, iv, x, y); 868 - if (x < ring->minx) 869 - ring->minx = x; 870 - if (x > ring->maxx) 871 - ring->maxx = x; 872 - if (y < ring->miny) 873 - ring->miny = y; 874 - if (y > ring->maxy) 875 - ring->maxy = y; 876 772 } 877 773 } 878 774 } 879 775 880 776 static void 881 777 rl2ParsePolygonZ (rl2GeometryPtr geom, const unsigned char *blob, int size, 882 778 int endian, int endian_arch, int *offset) ................................................................................ 911 807 ring = rl2AddInteriorRing (polyg, ib - 1, nverts); 912 808 for (iv = 0; iv < nverts; iv++) 913 809 { 914 810 x = rl2GeomImport64 (blob + *offset, endian, endian_arch); 915 811 y = rl2GeomImport64 (blob + (*offset + 8), endian, endian_arch); 916 812 *offset += 24; 917 813 rl2SetPoint (ring->coords, iv, x, y); 918 - if (x < ring->minx) 919 - ring->minx = x; 920 - if (x > ring->maxx) 921 - ring->maxx = x; 922 - if (y < ring->miny) 923 - ring->miny = y; 924 - if (y > ring->maxy) 925 - ring->maxy = y; 926 814 } 927 815 } 928 816 } 929 817 930 818 static void 931 819 rl2ParsePolygonM (rl2GeometryPtr geom, const unsigned char *blob, int size, 932 820 int endian, int endian_arch, int *offset) ................................................................................ 961 849 ring = rl2AddInteriorRing (polyg, ib - 1, nverts); 962 850 for (iv = 0; iv < nverts; iv++) 963 851 { 964 852 x = rl2GeomImport64 (blob + *offset, endian, endian_arch); 965 853 y = rl2GeomImport64 (blob + (*offset + 8), endian, endian_arch); 966 854 *offset += 24; 967 855 rl2SetPoint (ring->coords, iv, x, y); 968 - if (x < ring->minx) 969 - ring->minx = x; 970 - if (x > ring->maxx) 971 - ring->maxx = x; 972 - if (y < ring->miny) 973 - ring->miny = y; 974 - if (y > ring->maxy) 975 - ring->maxy = y; 976 856 } 977 857 } 978 858 } 979 859 980 860 static void 981 861 rl2ParsePolygonZM (rl2GeometryPtr geom, const unsigned char *blob, int size, 982 862 int endian, int endian_arch, int *offset) ................................................................................ 1011 891 ring = rl2AddInteriorRing (polyg, ib - 1, nverts); 1012 892 for (iv = 0; iv < nverts; iv++) 1013 893 { 1014 894 x = rl2GeomImport64 (blob + *offset, endian, endian_arch); 1015 895 y = rl2GeomImport64 (blob + (*offset + 8), endian, endian_arch); 1016 896 *offset += 32; 1017 897 rl2SetPoint (ring->coords, iv, x, y); 1018 - if (x < ring->minx) 1019 - ring->minx = x; 1020 - if (x > ring->maxx) 1021 - ring->maxx = x; 1022 - if (y < ring->miny) 1023 - ring->miny = y; 1024 - if (y > ring->maxy) 1025 - ring->maxy = y; 1026 898 } 1027 899 } 1028 900 } 1029 901 1030 902 static void 1031 903 rl2ParseCompressedLine (rl2GeometryPtr geom, const unsigned char *blob, 1032 904 int size, int endian, int endian_arch, int *offset) ................................................................................ 1064 936 fy = rl2GeomImportF32 (blob + (*offset + 4), endian, 1065 937 endian_arch); 1066 938 x = last_x + fx; 1067 939 y = last_y + fy; 1068 940 *offset += 8; 1069 941 } 1070 942 rl2SetPoint (line->coords, iv, x, y); 1071 - if (x < line->minx) 1072 - line->minx = x; 1073 - if (x > line->maxx) 1074 - line->maxx = x; 1075 - if (y < line->miny) 1076 - line->miny = y; 1077 - if (y > line->maxy) 1078 - line->maxy = y; 1079 943 last_x = x; 1080 944 last_y = y; 1081 945 } 1082 946 } 1083 947 1084 948 static void 1085 949 rl2ParseCompressedLineZ (rl2GeometryPtr geom, const unsigned char *blob, ................................................................................ 1118 982 fy = rl2GeomImportF32 (blob + (*offset + 4), endian, 1119 983 endian_arch); 1120 984 x = last_x + fx; 1121 985 y = last_y + fy; 1122 986 *offset += 12; 1123 987 } 1124 988 rl2SetPoint (line->coords, iv, x, y); 1125 - if (x < line->minx) 1126 - line->minx = x; 1127 - if (x > line->maxx) 1128 - line->maxx = x; 1129 - if (y < line->miny) 1130 - line->miny = y; 1131 - if (y > line->maxy) 1132 - line->maxy = y; 1133 989 last_x = x; 1134 990 last_y = y; 1135 991 } 1136 992 } 1137 993 1138 994 static void 1139 995 rl2ParseCompressedLineM (rl2GeometryPtr geom, const unsigned char *blob, ................................................................................ 1172 1028 fy = rl2GeomImportF32 (blob + (*offset + 4), endian, 1173 1029 endian_arch); 1174 1030 x = last_x + fx; 1175 1031 y = last_y + fy; 1176 1032 *offset += 16; 1177 1033 } 1178 1034 rl2SetPoint (line->coords, iv, x, y); 1179 - if (x < line->minx) 1180 - line->minx = x; 1181 - if (x > line->maxx) 1182 - line->maxx = x; 1183 - if (y < line->miny) 1184 - line->miny = y; 1185 - if (y > line->maxy) 1186 - line->maxy = y; 1187 1035 last_x = x; 1188 1036 last_y = y; 1189 1037 } 1190 1038 } 1191 1039 1192 1040 static void 1193 1041 rl2ParseCompressedLineZM (rl2GeometryPtr geom, const unsigned char *blob, ................................................................................ 1226 1074 fy = rl2GeomImportF32 (blob + (*offset + 4), endian, 1227 1075 endian_arch); 1228 1076 x = last_x + fx; 1229 1077 y = last_y + fy; 1230 1078 *offset += 20; 1231 1079 } 1232 1080 rl2SetPoint (line->coords, iv, x, y); 1233 - if (x < line->minx) 1234 - line->minx = x; 1235 - if (x > line->maxx) 1236 - line->maxx = x; 1237 - if (y < line->miny) 1238 - line->miny = y; 1239 - if (y > line->maxy) 1240 - line->maxy = y; 1241 1081 last_x = x; 1242 1082 last_y = y; 1243 1083 } 1244 1084 } 1245 1085 1246 1086 static void 1247 1087 rl2ParseCompressedPolygon (rl2GeometryPtr geom, const unsigned char *blob, ................................................................................ 1297 1137 fy = rl2GeomImportF32 (blob + (*offset + 4), endian, 1298 1138 endian_arch); 1299 1139 x = last_x + fx; 1300 1140 y = last_y + fy; 1301 1141 *offset += 8; 1302 1142 } 1303 1143 rl2SetPoint (ring->coords, iv, x, y); 1304 - if (x < ring->minx) 1305 - ring->minx = x; 1306 - if (x > ring->maxx) 1307 - ring->maxx = x; 1308 - if (y < ring->miny) 1309 - ring->miny = y; 1310 - if (y > ring->maxy) 1311 - ring->maxy = y; 1312 1144 last_x = x; 1313 1145 last_y = y; 1314 1146 } 1315 1147 } 1316 1148 } 1317 1149 1318 1150 static void ................................................................................ 1369 1201 fy = rl2GeomImportF32 (blob + (*offset + 4), endian, 1370 1202 endian_arch); 1371 1203 x = last_x + fx; 1372 1204 y = last_y + fy; 1373 1205 *offset += 12; 1374 1206 } 1375 1207 rl2SetPoint (ring->coords, iv, x, y); 1376 - if (x < ring->minx) 1377 - ring->minx = x; 1378 - if (x > ring->maxx) 1379 - ring->maxx = x; 1380 - if (y < ring->miny) 1381 - ring->miny = y; 1382 - if (y > ring->maxy) 1383 - ring->maxy = y; 1384 1208 last_x = x; 1385 1209 last_y = y; 1386 1210 } 1387 1211 } 1388 1212 } 1389 1213 1390 1214 static void ................................................................................ 1441 1265 fy = rl2GeomImportF32 (blob + (*offset + 4), endian, 1442 1266 endian_arch); 1443 1267 x = last_x + fx; 1444 1268 y = last_y + fy; 1445 1269 *offset += 16; 1446 1270 } 1447 1271 rl2SetPoint (ring->coords, iv, x, y); 1448 - if (x < ring->minx) 1449 - ring->minx = x; 1450 - if (x > ring->maxx) 1451 - ring->maxx = x; 1452 - if (y < ring->miny) 1453 - ring->miny = y; 1454 - if (y > ring->maxy) 1455 - ring->maxy = y; 1456 1272 last_x = x; 1457 1273 last_y = y; 1458 1274 } 1459 1275 } 1460 1276 } 1461 1277 1462 1278 static void ................................................................................ 1513 1329 fy = rl2GeomImportF32 (blob + (*offset + 4), endian, 1514 1330 endian_arch); 1515 1331 x = last_x + fx; 1516 1332 y = last_y + fy; 1517 1333 *offset += 20; 1518 1334 } 1519 1335 rl2SetPoint (ring->coords, iv, x, y); 1520 - if (x < ring->minx) 1521 - ring->minx = x; 1522 - if (x > ring->maxx) 1523 - ring->maxx = x; 1524 - if (y < ring->miny) 1525 - ring->miny = y; 1526 - if (y > ring->maxy) 1527 - ring->maxy = y; 1528 1336 last_x = x; 1529 1337 last_y = y; 1530 1338 } 1531 1339 } 1532 1340 } 1533 1341 1534 1342 static void ................................................................................ 1591 1399 offset); 1592 1400 break; 1593 1401 case GAIA_COMPRESSED_LINESTRING: 1594 1402 rl2ParseCompressedLine (geom, blob, size, endian, endian_arch, 1595 1403 offset); 1596 1404 break; 1597 1405 case GAIA_COMPRESSED_LINESTRINGZ: 1598 - rl2ParseCompressedLineZ (geom, blob, size, endian, 1599 - endian_arch, offset); 1406 + rl2ParseCompressedLineZ (geom, blob, size, endian, endian_arch, 1407 + offset); 1600 1408 break; 1601 1409 case GAIA_COMPRESSED_LINESTRINGM: 1602 - rl2ParseCompressedLineM (geom, blob, size, endian, 1603 - endian_arch, offset); 1410 + rl2ParseCompressedLineM (geom, blob, size, endian, endian_arch, 1411 + offset); 1604 1412 break; 1605 1413 case GAIA_COMPRESSED_LINESTRINGZM: 1606 - rl2ParseCompressedLineZM (geom, blob, size, endian, 1607 - endian_arch, offset); 1414 + rl2ParseCompressedLineZM (geom, blob, size, endian, endian_arch, 1415 + offset); 1608 1416 break; 1609 1417 case GAIA_COMPRESSED_POLYGON: 1610 1418 rl2ParseCompressedPolygon (geom, blob, size, endian, 1611 1419 endian_arch, offset); 1612 1420 break; 1613 1421 case GAIA_COMPRESSED_POLYGONZ: 1614 1422 rl2ParseCompressedPolygonZ (geom, blob, size, endian, ................................................................................ 1698 1506 &offset); 1699 1507 break; 1700 1508 case GAIA_POLYGONZM: 1701 1509 rl2ParsePolygonZM (geom, blob, size, little_endian, endian_arch, 1702 1510 &offset); 1703 1511 break; 1704 1512 case GAIA_COMPRESSED_LINESTRING: 1705 - rl2ParseCompressedLine (geom, blob, size, little_endian, 1706 - endian_arch, &offset); 1513 + rl2ParseCompressedLine (geom, blob, size, little_endian, endian_arch, 1514 + &offset); 1707 1515 break; 1708 1516 case GAIA_COMPRESSED_LINESTRINGZ: 1709 - rl2ParseCompressedLineZ (geom, blob, size, little_endian, 1710 - endian_arch, &offset); 1517 + rl2ParseCompressedLineZ (geom, blob, size, little_endian, endian_arch, 1518 + &offset); 1711 1519 break; 1712 1520 case GAIA_COMPRESSED_LINESTRINGM: 1713 - rl2ParseCompressedLineM (geom, blob, size, little_endian, 1714 - endian_arch, &offset); 1521 + rl2ParseCompressedLineM (geom, blob, size, little_endian, endian_arch, 1522 + &offset); 1715 1523 break; 1716 1524 case GAIA_COMPRESSED_LINESTRINGZM: 1717 1525 rl2ParseCompressedLineZM (geom, blob, size, little_endian, 1718 1526 endian_arch, &offset); 1719 1527 break; 1720 1528 case GAIA_COMPRESSED_POLYGON: 1721 1529 rl2ParseCompressedPolygon (geom, blob, size, little_endian, ................................................................................ 1912 1720 rl2GeomExport64 (ptr + 8, y, 1, endian_arch); /* Y - exterior ring */ 1913 1721 ptr += 16; 1914 1722 } 1915 1723 *ptr = GAIA_MARK_END; /* END signature */ 1916 1724 return 1; 1917 1725 } 1918 1726 1919 -RL2_PRIVATE int 1920 -rl2_serialize_ring_as_linestring (rl2RingPtr ring, unsigned char **result, 1921 - int *size) 1922 -{ 1923 -/* serializing a BLOB Geometry - polygon ring as linestring */ 1924 - int iv; 1925 - unsigned char *ptr; 1926 - int endian_arch = rl2GeomEndianArch (); 1927 - double minx = DBL_MAX; 1928 - double maxx = 0.0 - DBL_MAX; 1929 - double miny = DBL_MAX; 1930 - double maxy = 0.0 - DBL_MAX; 1931 - double x; 1932 - double y; 1933 - 1934 - *result = NULL; 1935 - *size = 0; 1936 - if (ring == NULL) 1937 - return 0; 1938 - 1939 -/* computing the MBR */ 1940 - for (iv = 0; iv < ring->points; iv++) 1941 - { 1942 - rl2GetPoint (ring->coords, iv, &x, &y); 1943 - if (x < minx) 1944 - minx = x; 1945 - if (x > maxx) 1946 - maxx = x; 1947 - if (y < miny) 1948 - miny = y; 1949 - if (y > maxy) 1950 - maxy = y; 1951 - } 1952 -/* computing the size of BLOB */ 1953 - *size = 44; /* header size */ 1954 - *size += (4 + ((sizeof (double) * 2) * ring->points)); /* # points + [x,y] for each vertex */ 1955 - *result = malloc (*size); 1956 - ptr = *result; 1957 -/* building the BLOB */ 1958 - *ptr = GAIA_MARK_START; /* START signature */ 1959 - *(ptr + 1) = GAIA_LITTLE_ENDIAN; /* byte ordering */ 1960 - rl2GeomExport32 (ptr + 2, 4326, 1, endian_arch); /* the SRID */ 1961 - rl2GeomExport64 (ptr + 6, minx, 1, endian_arch); /* MBR - minimum X */ 1962 - rl2GeomExport64 (ptr + 14, miny, 1, endian_arch); /* MBR - minimum Y */ 1963 - rl2GeomExport64 (ptr + 22, maxx, 1, endian_arch); /* MBR - maximum X */ 1964 - rl2GeomExport64 (ptr + 30, maxy, 1, endian_arch); /* MBR - maximum Y */ 1965 - *(ptr + 38) = GAIA_MARK_MBR; /* MBR signature */ 1966 - rl2GeomExport32 (ptr + 39, GAIA_LINESTRING, 1, endian_arch); /* class LINESTRING */ 1967 - rl2GeomExport32 (ptr + 43, ring->points, 1, endian_arch); /* # points */ 1968 - ptr += 47; 1969 - for (iv = 0; iv < ring->points; iv++) 1970 - { 1971 - rl2GetPoint (ring->coords, iv, &x, &y); 1972 - rl2GeomExport64 (ptr, x, 1, endian_arch); 1973 - rl2GeomExport64 (ptr + 8, y, 1, endian_arch); 1974 - ptr += 16; 1975 - } 1976 - *ptr = GAIA_MARK_END; /* END signature */ 1977 - return 1; 1978 -} 1979 - 1980 1727 RL2_PRIVATE rl2GeometryPtr 1981 1728 rl2_curve_from_XY (int points, double *x, double *y) 1982 1729 { 1983 1730 /* creating a Linestring Geometry from X,Y coordinate arrays */ 1984 1731 rl2GeometryPtr geom = NULL; 1985 1732 rl2LinestringPtr ln; 1986 1733 int iv; ................................................................................ 1987 1734 1988 1735 if (points <= 0 || x == NULL || y == NULL) 1989 1736 return 0; 1990 1737 geom = rl2CreateGeometry (); 1991 1738 ln = rl2AddLinestringToGeometry (geom, points); 1992 1739 for (iv = 0; iv < points; iv++) 1993 1740 rl2SetPoint (ln->coords, iv, *(x + iv), *(y + iv)); 1994 - if (*(x + iv) < ln->minx) 1995 - ln->minx = *(x + iv); 1996 - if (*(x + iv) > ln->maxx) 1997 - ln->maxx = *(x + iv); 1998 - if (*(y + iv) < ln->miny) 1999 - ln->miny = *(y + iv); 2000 - if (*(y + iv) > ln->maxy) 2001 - ln->maxy = *(y + iv); 2002 1741 return geom; 2003 1742 } 2004 1743 2005 1744 RL2_PRIVATE double 2006 1745 rl2_compute_curve_length (rl2GeometryPtr geom) 2007 1746 { 2008 1747 /* computing the total length of some curve (single linestring expected) */ ................................................................................ 2111 1850 ln_out = rl2AddLinestringToGeometry (out, ln_in->points); 2112 1851 for (iv = 0; iv < ln_in->points; iv++) 2113 1852 { 2114 1853 double x; 2115 1854 double y; 2116 1855 rl2GetPoint (ln_in->coords, iv, &x, &y); 2117 1856 rl2SetPoint (ln_out->coords, iv, x, y); 2118 - if (x < ln_out->minx) 2119 - ln_out->minx = x; 2120 - if (x > ln_out->maxx) 2121 - ln_out->maxx = x; 2122 - if (y < ln_out->miny) 2123 - ln_out->miny = y; 2124 - if (y > ln_out->maxy) 2125 - ln_out->maxy = y; 2126 1857 } 2127 1858 return out; 2128 1859 } 2129 1860 2130 1861 RL2_PRIVATE rl2GeometryPtr 2131 1862 rl2_clone_linestring (rl2LinestringPtr in) 2132 1863 { ................................................................................ 2139 1870 ln_out = rl2AddLinestringToGeometry (out, in->points); 2140 1871 for (iv = 0; iv < in->points; iv++) 2141 1872 { 2142 1873 double x; 2143 1874 double y; 2144 1875 rl2GetPoint (in->coords, iv, &x, &y); 2145 1876 rl2SetPoint (ln_out->coords, iv, x, y); 2146 - if (x < ln_out->minx) 2147 - ln_out->minx = x; 2148 - if (x > ln_out->maxx) 2149 - ln_out->maxx = x; 2150 - if (y < ln_out->miny) 2151 - ln_out->miny = y; 2152 - if (y > ln_out->maxy) 2153 - ln_out->maxy = y; 2154 1877 } 2155 1878 return out; 2156 1879 } 2157 1880 2158 1881 RL2_PRIVATE rl2GeometryPtr 2159 1882 rl2_build_circle (double cx, double cy, double radius) 2160 1883 { 2161 -/* creating a circle */ 1884 +/* creating a cicrle */ 2162 1885 int iv = 0; 2163 1886 double pi = 3.14159265359; 2164 1887 double rads; 2165 1888 double x; 2166 1889 double y; 2167 1890 rl2LinestringPtr ln; 2168 1891 rl2GeometryPtr out = rl2CreateGeometry (); 2169 1892 ln = rl2AddLinestringToGeometry (out, 129); 2170 1893 for (rads = 0.0; rads <= (pi * 2.0); rads += pi / 64.0) 2171 1894 { 2172 1895 x = cx + (radius * cos (rads)); 2173 1896 y = cy + (radius * sin (rads)); 2174 1897 rl2SetPoint (ln->coords, iv, x, y); 2175 - if (x < ln->minx) 2176 - ln->minx = x; 2177 - if (x > ln->maxx) 2178 - ln->maxx = x; 2179 - if (y < ln->miny) 2180 - ln->miny = y; 2181 - if (y > ln->maxy) 2182 - ln->maxy = y; 2183 1898 iv++; 2184 1899 } 2185 1900 /* closure */ 2186 1901 rl2GetPoint (ln->coords, 0, &x, &y); 2187 1902 rl2SetPoint (ln->coords, 128, x, y); 2188 1903 return out; 2189 1904 }
Changes to src/rl2auxrender.c.
288 288 } 289 289 } 290 290 } 291 291 } 292 292 293 293 static void 294 294 copy_palette (unsigned char *rgba, unsigned int width, unsigned int height, 295 - unsigned char *inbuf, rl2PalettePtr palette, 296 - unsigned char bg_red, unsigned char bg_green, 297 - unsigned char bg_blue) 295 + unsigned char *inbuf, rl2PalettePtr palette, unsigned char bg_red, 296 + unsigned char bg_green, unsigned char bg_blue) 298 297 { 299 298 /* copying from Palette to RGBA */ 300 299 unsigned int x; 301 300 unsigned int y; 302 301 rl2PrivPalettePtr plt = (rl2PrivPalettePtr) palette; 303 302 unsigned char *p_in = inbuf; 304 303 unsigned char *p_out = rgba; ................................................................................ 451 450 goto error; 452 451 453 452 if (aux->base_width == aux->width && aux->base_height == aux->height) 454 453 { 455 454 if (aux->out_pixel == RL2_PIXEL_MONOCHROME) 456 455 { 457 456 /* Monochrome */ 458 - copy_monochrome (aggreg_rgba, aux->base_width, 459 - aux->base_height, aux->outbuf); 457 + copy_monochrome (aggreg_rgba, aux->base_width, aux->base_height, 458 + aux->outbuf); 460 459 aux->outbuf = NULL; 461 460 } 462 461 else if (aux->out_pixel == RL2_PIXEL_PALETTE) 463 462 { 464 463 /* Palette */ 465 464 copy_palette (aggreg_rgba, aux->base_width, aux->base_height, 466 465 aux->outbuf, aux->palette, aux->bg_red, 467 466 aux->bg_green, aux->bg_blue); 468 467 aux->outbuf = NULL; 469 468 } 470 469 else if (aux->out_pixel == RL2_PIXEL_GRAYSCALE) 471 470 { 472 471 /* Grayscale */ 473 - copy_grayscale (aggreg_rgba, aux->base_width, 474 - aux->base_height, aux->outbuf, aux->bg_red); 472 + copy_grayscale (aggreg_rgba, aux->base_width, aux->base_height, 473 + aux->outbuf, aux->bg_red); 475 474 aux->outbuf = NULL; 476 475 } 477 476 else 478 477 { 479 478 /* RGB */ 480 479 copy_rgb (aggreg_rgba, aux->base_width, aux->base_height, 481 480 aux->outbuf, aux->bg_red, aux->bg_green, ................................................................................ 608 607 } 609 608 } 610 609 else 611 610 { 612 611 if (!get_payload_from_monochrome_opaque 613 612 (aux->base_width, aux->base_height, aux->sqlite, 614 613 aux->minx, aux->miny, aux->maxx, aux->maxy, 615 - aux->srid, aux->outbuf, aux->format_id, 616 - aux->quality, &image, &image_size)) 614 + aux->srid, aux->outbuf, aux->format_id, aux->quality, 615 + &image, &image_size)) 617 616 { 618 617 aux->outbuf = NULL; 619 618 goto error; 620 619 } 621 620 } 622 621 aux->outbuf = NULL; 623 622 } ................................................................................ 637 636 } 638 637 } 639 638 else 640 639 { 641 640 if (!get_payload_from_palette_opaque 642 641 (aux->base_width, aux->base_height, aux->sqlite, 643 642 aux->minx, aux->miny, aux->maxx, aux->maxy, 644 - aux->srid, aux->outbuf, aux->palette, 645 - aux->format_id, aux->quality, &image, &image_size)) 643 + aux->srid, aux->outbuf, aux->palette, aux->format_id, 644 + aux->quality, &image, &image_size)) 646 645 { 647 646 aux->outbuf = NULL; 648 647 goto error; 649 648 } 650 649 } 651 650 aux->outbuf = NULL; 652 651 } ................................................................................ 665 664 } 666 665 } 667 666 else 668 667 { 669 668 if (!get_payload_from_grayscale_opaque 670 669 (aux->base_width, aux->base_height, aux->sqlite, 671 670 aux->minx, aux->miny, aux->maxx, aux->maxy, 672 - aux->srid, aux->outbuf, aux->format_id, 673 - aux->quality, &image, &image_size)) 671 + aux->srid, aux->outbuf, aux->format_id, aux->quality, 672 + &image, &image_size)) 674 673 { 675 674 aux->outbuf = NULL; 676 675 goto error; 677 676 } 678 677 } 679 678 aux->outbuf = NULL; 680 679 } ................................................................................ 694 693 } 695 694 } 696 695 else 697 696 { 698 697 if (!get_payload_from_rgb_opaque 699 698 (aux->base_width, aux->base_height, aux->sqlite, 700 699 aux->minx, aux->miny, aux->maxx, aux->maxy, 701 - aux->srid, aux->outbuf, aux->format_id, 702 - aux->quality, &image, &image_size)) 700 + aux->srid, aux->outbuf, aux->format_id, aux->quality, 701 + &image, &image_size)) 703 702 { 704 703 aux->outbuf = NULL; 705 704 goto error; 706 705 } 707 706 } 708 707 aux->outbuf = NULL; 709 708 } ................................................................................ 770 769 } 771 770 else if (aux->out_pixel == RL2_PIXEL_GRAYSCALE) 772 771 { 773 772 /* Grayscale */ 774 773 if (aux->transparent && aux->format_id == RL2_OUTPUT_FORMAT_PNG) 775 774 { 776 775 if (!get_rgba_from_grayscale_transparent 777 - (aux->base_width, aux->base_height, aux->outbuf, 778 - rgba, aux->bg_red)) 776 + (aux->base_width, aux->base_height, aux->outbuf, rgba, 777 + aux->bg_red)) 779 778 { 780 779 aux->outbuf = NULL; 781 780 goto error; 782 781 } 783 782 } 784 783 else 785 784 { ................................................................................ 795 794 } 796 795 else 797 796 { 798 797 /* RGB */ 799 798 if (aux->transparent && aux->format_id == RL2_OUTPUT_FORMAT_PNG) 800 799 { 801 800 if (!get_rgba_from_rgb_transparent 802 - (aux->base_width, aux->base_height, aux->outbuf, 803 - rgba, aux->bg_red, aux->bg_green, aux->bg_blue)) 801 + (aux->base_width, aux->base_height, aux->outbuf, rgba, 802 + aux->bg_red, aux->bg_green, aux->bg_blue)) 804 803 { 805 804 aux->outbuf = NULL; 806 805 goto error; 807 806 } 808 807 } 809 808 else 810 809 { ................................................................................ 839 838 { 840 839 /* Grayscale or Monochrome upsampled */ 841 840 if (aux->transparent && aux->format_id == RL2_OUTPUT_FORMAT_PNG) 842 841 { 843 842 if (alpha == NULL) 844 843 goto error; 845 844 if (!get_payload_from_gray_rgba_transparent 846 - (aux->width, aux->height, rgb, alpha, 847 - aux->format_id, aux->quality, &image, &image_size, 848 - aux->opacity)) 845 + (aux->width, aux->height, rgb, alpha, aux->format_id, 846 + aux->quality, &image, &image_size, aux->opacity)) 849 847 goto error; 850 848 } 851 849 else 852 850 { 853 851 if (alpha != NULL) 854 852 free (alpha); 855 853 alpha = NULL; ................................................................................ 864 862 { 865 863 /* RGB */ 866 864 if (aux->transparent && aux->format_id == RL2_OUTPUT_FORMAT_PNG) 867 865 { 868 866 if (alpha == NULL) 869 867 goto error; 870 868 if (!get_payload_from_rgb_rgba_transparent 871 - (aux->width, aux->height, rgb, alpha, 872 - aux->format_id, aux->quality, &image, &image_size, 873 - aux->opacity, 0)) 869 + (aux->width, aux->height, rgb, alpha, aux->format_id, 870 + aux->quality, &image, &image_size, aux->opacity, 0)) 874 871 goto error; 875 872 } 876 873 else 877 874 { 878 875 if (alpha != NULL) 879 876 free (alpha); 880 877 alpha = NULL; ................................................................................ 981 978 coverage = rl2_get_coverage_name (aux->coverage); 982 979 if (coverage == NULL) 983 980 return 0; 984 981 scale_factor = rl2_get_shaded_relief_scale_factor (aux->sqlite, coverage); 985 982 986 983 if (rl2_build_shaded_relief_mask 987 984 (aux->sqlite, aux->max_threads, aux->coverage, relief_factor, 988 - scale_factor, aux->base_width, aux->base_height, aux->minx, 989 - aux->miny, aux->maxx, aux->maxy, aux->xx_res, aux->yy_res, &shr_mask, 985 + scale_factor, aux->base_width, aux->base_height, aux->minx, aux->miny, 986 + aux->maxx, aux->maxy, aux->xx_res, aux->yy_res, &shr_mask, 990 987 &shr_size) != RL2_OK) 991 988 return 0; 992 989 993 990 /* allocating the RGBA buffer */ 994 991 rgba = malloc (aux->base_width * aux->base_height * 4); 995 992 if (rgba == NULL) 996 993 return 0; ................................................................................ 1537 1534 RL2_DECLARE int 1538 1535 rl2_get_raw_raster_data_mixed_resolutions (sqlite3 * handle, int max_threads, 1539 1536 rl2CoveragePtr cvg, 1540 1537 unsigned int width, 1541 1538 unsigned int height, double minx, 1542 1539 double miny, double maxx, 1543 1540 double maxy, double x_res, 1544 - double y_res, 1545 - unsigned char **buffer, 1541 + double y_res, unsigned char **buffer, 1546 1542 int *buf_size, 1547 1543 rl2PalettePtr * palette, 1548 1544 unsigned char *out_pixel, 1549 1545 unsigned char bg_red, 1550 1546 unsigned char bg_green, 1551 1547 unsigned char bg_blue, 1552 1548 rl2RasterSymbolizerPtr style, ................................................................................ 1749 1745 if (no_data != NULL) 1750 1746 rl2_destroy_pixel (no_data); 1751 1747 if (outbuf != NULL) 1752 1748 free (outbuf); 1753 1749 return RL2_ERROR; 1754 1750 } 1755 1751 1756 -static int 1757 -point_bbox_matches (rl2PointPtr point, double minx, double miny, double maxx, 1758 - double maxy) 1752 +static rl2GraphicsPatternPtr 1753 +load_external_graphic_from_dbms (sqlite3 * handle, rl2PrivGraphicPtr graphic) 1754 +{ 1755 +/* attempting to load an External Graphic from the DBMS */ 1756 + int ret; 1757 + sqlite3_stmt *stmt = NULL; 1758 + const char *sql; 1759 + const char *xlink_href = NULL; 1760 + rl2GraphicsPatternPtr pattern = NULL; 1761 + rl2PrivGraphicItemPtr item; 1762 + 1763 + if (graphic == NULL) 1764 + return NULL; 1765 + /* searching for an xlink_href pseudo-URL */ 1766 + item = graphic->first; 1767 + while (item != NULL) 1768 + { 1769 + if (item->type == RL2_EXTERNAL_GRAPHIC && item->item != NULL) 1770 + { 1771 + rl2PrivExternalGraphicPtr ext = 1772 + (rl2PrivExternalGraphicPtr) (item->item); 1773 + if (ext->xlink_href != NULL) 1774 + { 1775 + xlink_href = ext->xlink_href; 1776 + break; 1777 + } 1778 + } 1779 + item = item->next; 1780 + } 1781 + if (xlink_href == NULL) 1782 + return NULL; 1783 + 1784 + sql = "SELECT resource, GetMimeType(resource) FROM SE_external_graphics " 1785 + "WHERE xlink_href = ?"; 1786 + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); 1787 + if (ret != SQLITE_OK) 1788 + return NULL; 1789 + 1790 + sqlite3_reset (stmt); 1791 + sqlite3_clear_bindings (stmt); 1792 + sqlite3_bind_text (stmt, 1, xlink_href, strlen (xlink_href), SQLITE_STATIC); 1793 + while (1) 1794 + { 1795 + /* scrolling the result set rows */ 1796 + ret = sqlite3_step (stmt); 1797 + if (ret == SQLITE_DONE) 1798 + break; /* end of result set */ 1799 + if (ret == SQLITE_ROW) 1800 + { 1801 + rl2RasterPtr raster = NULL; 1802 + if (sqlite3_column_type (stmt, 0) == SQLITE_BLOB 1803 + && sqlite3_column_type (stmt, 1) == SQLITE_TEXT) 1804 + { 1805 + const unsigned char *blob = sqlite3_column_blob (stmt, 0); 1806 + int blob_sz = sqlite3_column_bytes (stmt, 0); 1807 + const char *mime_type = 1808 + (const char *) sqlite3_column_text (stmt, 1); 1809 + if (strcmp (mime_type, "image/gif") == 0) 1810 + raster = rl2_raster_from_gif (blob, blob_sz); 1811 + if (strcmp (mime_type, "image/png") == 0) 1812 + raster = rl2_raster_from_png (blob, blob_sz, 1); 1813 + if (strcmp (mime_type, "image/jpeg") == 0) 1814 + raster = rl2_raster_from_jpeg (blob, blob_sz); 1815 + if (strcmp (mime_type, "image/tiff") == 0) 1816 + raster = rl2_raster_from_tiff (blob, blob_sz); 1817 + } 1818 + if (raster != NULL) 1819 + { 1820 + unsigned char *rgba; 1821 + int rgba_sz; 1822 + unsigned int width; 1823 + unsigned int height; 1824 + if (rl2_get_raster_size (raster, &width, &height) != 1825 + RL2_OK) 1826 + { 1827 + rl2_destroy_raster (raster); 1828 + goto error; 1829 + } 1830 + if (rl2_raster_data_to_RGBA (raster, &rgba, &rgba_sz) != 1831 + RL2_OK) 1832 + { 1833 + rl2_destroy_raster (raster); 1834 + goto error; 1835 + } 1836 + pattern = 1837 + rl2_graph_create_pattern (rgba, width, height, 0); 1838 + rl2_destroy_raster (raster); 1839 + } 1840 + } 1841 + else 1842 + { 1843 + fprintf (stderr, "SQL error: %s\n%s\n", sql, 1844 + sqlite3_errmsg (handle)); 1845 + goto error; 1846 + } 1847 + } 1848 + return pattern; 1849 + 1850 + error: 1851 + if (stmt != NULL) 1852 + sqlite3_finalize (stmt); 1853 + return NULL; 1854 +} 1855 + 1856 +static rl2GraphicsBitmapPtr 1857 +load_external_bitmap_from_dbms (sqlite3 * handle, const char *xlink_href) 1759 1858 { 1760 -/* checks if the Point is visible */ 1761 - if (minx > point->x) 1762 - return 0; 1763 - if (maxx < point->x) 1764 - return 0; 1765 - if (miny > point->y) 1766 - return 0; 1767 - if (maxy < point->y) 1768 - return 0; 1769 - return 1; 1859 +/* attempting to load an External Graphic from the DBMS */ 1860 + int ret; 1861 + sqlite3_stmt *stmt = NULL; 1862 + const char *sql; 1863 + rl2GraphicsBitmapPtr bitmap = NULL; 1864 + 1865 + if (xlink_href == NULL) 1866 + return NULL; 1867 + 1868 + sql = "SELECT resource, GetMimeType(resource) FROM SE_external_graphics " 1869 + "WHERE xlink_href = ?"; 1870 + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); 1871 + if (ret != SQLITE_OK) 1872 + return NULL; 1873 + 1874 + sqlite3_reset (stmt); 1875 + sqlite3_clear_bindings (stmt); 1876 + sqlite3_bind_text (stmt, 1, xlink_href, strlen (xlink_href), SQLITE_STATIC); 1877 + while (1) 1878 + { 1879 + /* scrolling the result set rows */ 1880 + ret = sqlite3_step (stmt); 1881 + if (ret == SQLITE_DONE) 1882 + break; /* end of result set */ 1883 + if (ret == SQLITE_ROW) 1884 + { 1885 + rl2RasterPtr raster = NULL; 1886 + if (sqlite3_column_type (stmt, 0) == SQLITE_BLOB 1887 + && sqlite3_column_type (stmt, 1) == SQLITE_TEXT) 1888 + { 1889 + const unsigned char *blob = sqlite3_column_blob (stmt, 0); 1890 + int blob_sz = sqlite3_column_bytes (stmt, 0); 1891 + const char *mime_type = 1892 + (const char *) sqlite3_column_text (stmt, 1); 1893 + if (strcmp (mime_type, "image/gif") == 0) 1894 + raster = rl2_raster_from_gif (blob, blob_sz); 1895 + if (strcmp (mime_type, "image/png") == 0) 1896 + raster = rl2_raster_from_png (blob, blob_sz, 1); 1897 + if (strcmp (mime_type, "image/jpeg") == 0) 1898 + raster = rl2_raster_from_jpeg (blob, blob_sz); 1899 + if (strcmp (mime_type, "image/tiff") == 0) 1900 + raster = rl2_raster_from_tiff (blob, blob_sz); 1901 + } 1902 + if (raster != NULL) 1903 + { 1904 + unsigned char *rgba; 1905 + int rgba_sz; 1906 + unsigned int width; 1907 + unsigned int height; 1908 + if (rl2_get_raster_size (raster, &width, &height) != 1909 + RL2_OK) 1910 + { 1911 + rl2_destroy_raster (raster); 1912 + goto error; 1913 + } 1914 + if (rl2_raster_data_to_RGBA (raster, &rgba, &rgba_sz) != 1915 + RL2_OK) 1916 + { 1917 + rl2_destroy_raster (raster); 1918 + goto error; 1919 + } 1920 + bitmap = rl2_graph_create_bitmap (rgba, width, height); 1921 + rl2_destroy_raster (raster); 1922 + } 1923 + } 1924 + else 1925 + { 1926 + fprintf (stderr, "SQL error: %s\n%s\n", sql, 1927 + sqlite3_errmsg (handle)); 1928 + goto error; 1929 + } 1930 + } 1931 + return bitmap; 1932 + 1933 + error: 1934 + if (stmt != NULL) 1935 + sqlite3_finalize (stmt); 1936 + return NULL; 1770 1937 } 1771 1938 1772 1939 static void 1773 1940 draw_points (rl2GraphicsContextPtr ctx, sqlite3 * handle, 1774 1941 rl2PrivVectorSymbolizerPtr sym, int height, double minx, 1775 - double miny, double maxx, double maxy, double x_res, 1776 - double y_res, rl2GeometryPtr geom) 1942 + double miny, double x_res, double y_res, rl2GeometryPtr geom) 1777 1943 { 1778 1944 /* drawing Point-type features */ 1779 1945 rl2PrivVectorSymbolizerItemPtr item; 1780 1946 rl2PointPtr point; 1781 1947 1782 1948 item = sym->first; 1783 1949 while (item != NULL) ................................................................................ 1802 1968 unsigned char well_known_type; 1803 1969 int fill = 0; 1804 1970 int stroke = 0; 1805 1971 int pen_cap; 1806 1972 int pen_join; 1807 1973 double opacity; 1808 1974 unsigned char norm_opacity; 1809 - rl2GraphicsPatternPtr pattern = NULL; 1975 + rl2GraphicsBitmapPtr pattern = NULL; 1810 1976 rl2GraphicsPatternPtr pattern_fill = NULL; 1811 1977 rl2GraphicsPatternPtr pattern_stroke = NULL; 1812 1978 1813 1979 if (graphic->type == RL2_MARK_GRAPHIC) 1814 1980 { 1815 1981 rl2PrivMarkPtr mark = 1816 1982 (rl2PrivMarkPtr) (graphic->item); ................................................................................ 1819 1985 well_known_type = mark->well_known_type; 1820 1986 is_mark = 1; 1821 1987 if (mark->fill != NULL) 1822 1988 { 1823 1989 if (mark->fill->graphic != NULL) 1824 1990 { 1825 1991 /* external Graphic fill */ 1826 - const char *xlink_href = NULL; 1827 - int recolor = 0; 1828 - unsigned char red; 1829 - unsigned char green; 1830 - unsigned char blue; 1831 - pattern_fill = NULL; 1832 - if (mark->fill->graphic->first != 1833 - NULL) 1834 - { 1835 - if (mark->fill-> 1836 - graphic->first->type == 1837 - RL2_EXTERNAL_GRAPHIC) 1838 - { 1839 - rl2PrivExternalGraphicPtr 1840 - ext = 1841 - (rl2PrivExternalGraphicPtr) 1842 - (mark-> 1843 - fill->graphic-> 1844 - first->item); 1845 - xlink_href = 1846 - ext->xlink_href; 1847 - if (ext->first != 1848 - NULL) 1849 - { 1850 - recolor = 1; 1851 - red = 1852 - ext-> 1853 - first->red; 1854 - green = 1855 - ext-> 1856 - first->green; 1857 - blue = 1858 - ext-> 1859 - first->blue; 1860 - } 1861 - } 1862 - } 1863 - if (xlink_href != NULL) 1864 - pattern_fill = 1865 - rl2_create_pattern_from_external_graphic 1866 - (handle, xlink_href, 1); 1992 + pattern_fill = 1993 + load_external_graphic_from_dbms 1994 + (handle, mark->fill->graphic); 1867 1995 if (pattern_fill != NULL) 1868 1996 { 1869 - if (recolor) 1870 - { 1871 - /* attempting to recolor the External Graphic resource */ 1872 - rl2_graph_pattern_recolor 1873 - (pattern_fill, 1874 - red, green, 1875 - blue); 1876 - } 1877 - if (mark->fill->opacity <= 1878 - 0.0) 1879 - norm_opacity = 0; 1880 - else if (mark-> 1881 - fill->opacity >= 1882 - 1.0) 1883 - norm_opacity = 255; 1884 - else 1885 - { 1886 - opacity = 1887 - 255.0 * 1888 - mark-> 1889 - fill->opacity; 1890 - if (opacity <= 0.0) 1891 - norm_opacity = 0; 1892 - else if (opacity >= 1893 - 255.0) 1894 - norm_opacity = 1895 - 255; 1896 - else 1897 - norm_opacity = 1898 - opacity; 1899 - } 1900 - if (norm_opacity < 1.0) 1901 - rl2_graph_pattern_transparency 1902 - (pattern_fill, 1903 - norm_opacity); 1904 1997 rl2_graph_set_pattern_brush 1905 1998 (ctx, pattern_fill); 1999 + fill = 1; 1906 2000 } 1907 - else 1908 - { 1909 - /* invalid Pattern: defaulting to a Gray brush */ 1910 - rl2_graph_set_brush (ctx, 1911 - 128, 1912 - 128, 1913 - 128, 1914 - 255); 1915 - } 1916 - fill = 1; 1917 2001 } 1918 2002 else 1919 2003 { 1920 2004 /* solid RGB fill */ 1921 2005 if (gr->opacity <= 0.0) 1922 2006 norm_opacity = 0; 1923 2007 else if (gr->opacity >= 1.0) ................................................................................ 1944 2028 fill = 1; 1945 2029 } 1946 2030 } 1947 2031 if (mark->stroke != NULL) 1948 2032 { 1949 2033 if (mark->stroke->graphic != NULL) 1950 2034 { 1951 - const char *xlink_href = NULL; 1952 - int recolor = 0; 1953 - unsigned char red; 1954 - unsigned char green; 1955 - unsigned char blue; 1956 - pattern_stroke = NULL; 1957 - if (mark->stroke-> 1958 - graphic->first != NULL) 2035 + /* external Graphic stroke */ 2036 + pattern_stroke = 2037 + load_external_graphic_from_dbms 2038 + (handle, 2039 + mark->stroke->graphic); 2040 + if (pattern_stroke != NULL) 1959 2041 { 1960 - if (mark->stroke-> 1961 - graphic->first->type == 1962 - RL2_EXTERNAL_GRAPHIC) 2042 + switch (mark-> 2043 + stroke->linecap) 1963 2044 { 1964 - rl2PrivExternalGraphicPtr 1965 - ext = 1966 - (rl2PrivExternalGraphicPtr) 1967 - (mark-> 1968 - stroke->graphic-> 1969 - first->item); 1970 - xlink_href = 1971 - ext->xlink_href; 1972 - if (ext->first != 1973 - NULL) 1974 - { 1975 - recolor = 1; 1976 - red = 1977 - ext-> 1978 - first->red; 1979 - green = 1980 - ext-> 1981 - first->green; 1982 - blue = 1983 - ext-> 1984 - first->blue; 1985 - } 1986 - } 1987 - } 1988 - if (xlink_href != NULL) 1989 - pattern_stroke = 1990 - rl2_create_pattern_from_external_graphic 1991 - (handle, xlink_href, 1); 1992 - if (pattern != NULL) 1993 - { 1994 - if (recolor) 2045 + case RL2_STROKE_LINECAP_ROUND: 2046 + pen_cap = 2047 + RL2_PEN_CAP_ROUND; 2048 + break; 2049 + case RL2_STROKE_LINECAP_SQUARE: 2050 + pen_cap = 2051 + RL2_PEN_CAP_SQUARE; 2052 + break; 2053 + default: 2054 + pen_cap = 2055 + RL2_PEN_CAP_BUTT; 2056 + break; 2057 + }; 2058 + switch (mark-> 2059 + stroke->linejoin) 1995 2060 { 1996 - /* attempting to recolor the External Graphic resource */ 1997 - rl2_graph_pattern_recolor 1998 - (pattern_stroke, 1999 - red, green, 2000 - blue); 2001 - } 2002 - if (mark->stroke->opacity <= 2003 - 0.0) 2004 - norm_opacity = 0; 2005 - else if (mark-> 2006 - stroke->opacity >= 2007 - 1.0) 2008 - norm_opacity = 255; 2061 + case RL2_STROKE_LINEJOIN_BEVEL: 2062 + pen_join = 2063 + RL2_PEN_JOIN_BEVEL; 2064 + break; 2065 + case RL2_STROKE_LINEJOIN_ROUND: 2066 + pen_join = 2067 + RL2_PEN_JOIN_ROUND; 2068 + break; 2069 + default: 2070 + pen_join = 2071 + RL2_PEN_JOIN_MITER; 2072 + break; 2073 + }; 2074 + if (mark-> 2075 + stroke->dash_count > 0 2076 + && mark-> 2077 + stroke->dash_list != 2078 + NULL) 2079 + rl2_graph_set_pattern_dashed_pen 2080 + (ctx, 2081 + pattern_stroke, 2082 + mark-> 2083 + stroke->width, 2084 + pen_cap, pen_join, 2085 + mark-> 2086 + stroke->dash_count, 2087 + mark-> 2088 + stroke->dash_list, 2089 + mark-> 2090 + stroke->dash_offset); 2009 2091 else 2010 - { 2011 - opacity = 2012 - 255.0 * 2013 - mark-> 2014 - stroke->opacity; 2015 - if (opacity <= 0.0) 2016 - norm_opacity = 0; 2017 - else if (opacity >= 2018 - 255.0) 2019 - norm_opacity = 2020 - 255; 2021 - else 2022 - norm_opacity = 2023 - opacity; 2024 - } 2025 - if (norm_opacity < 1.0) 2026 - rl2_graph_pattern_transparency 2027 - (pattern_stroke, 2028 - norm_opacity); 2029 - if (pattern_stroke != NULL) 2030 - { 2031 - switch 2032 - (mark-> 2033 - stroke->linecap) 2034 - { 2035 - case RL2_STROKE_LINECAP_ROUND: 2036 - pen_cap = 2037 - RL2_PEN_CAP_ROUND; 2038 - break; 2039 - case RL2_STROKE_LINECAP_SQUARE: 2040 - pen_cap = 2041 - RL2_PEN_CAP_SQUARE; 2042 - break; 2043 - default: 2044 - pen_cap = 2045 - RL2_PEN_CAP_BUTT; 2046 - break; 2047 - }; 2048 - switch 2049 - (mark-> 2050 - stroke->linejoin) 2051 - { 2052 - case RL2_STROKE_LINEJOIN_BEVEL: 2053 - pen_join = 2054 - RL2_PEN_JOIN_BEVEL; 2055 - break; 2056 - case RL2_STROKE_LINEJOIN_ROUND: 2057 - pen_join = 2058 - RL2_PEN_JOIN_ROUND; 2059 - break; 2060 - default: 2061 - pen_join = 2062 - RL2_PEN_JOIN_MITER; 2063 - break; 2064 - }; 2065 - if (mark-> 2066 - stroke->dash_count 2067 - > 0 2068 - && mark-> 2069 - stroke->dash_list 2070 - != NULL) 2071 - rl2_graph_set_pattern_dashed_pen 2072 - (ctx, 2073 - pattern_stroke, 2074 - mark-> 2075 - stroke->width, 2076 - pen_cap, 2077 - pen_join, 2078 - mark-> 2079 - stroke->dash_count, 2080 - mark-> 2081 - stroke->dash_list, 2082 - mark-> 2083 - stroke->dash_offset); 2084 - else 2085 - rl2_graph_set_pattern_solid_pen 2086 - (ctx, 2087 - pattern_stroke, 2088 - mark-> 2089 - stroke->width, 2090 - pen_cap, 2091 - pen_join); 2092 - stroke = 1; 2093 - } 2092 + rl2_graph_set_pattern_solid_pen 2093 + (ctx, 2094 + pattern_stroke, 2095 + mark-> 2096 + stroke->width, 2097 + pen_cap, pen_join); 2098 + stroke = 1; 2094 2099 } 2095 2100 } 2096 2101 else 2097 2102 { 2098 2103 /* solid RGB stroke */ 2099 2104 if (gr->opacity <= 0.0) 2100 2105 norm_opacity = 0; ................................................................................ 2146 2151 mark->stroke->red, 2147 2152 mark->stroke->green, 2148 2153 mark->stroke->blue, 2149 2154 norm_opacity, 2150 2155 mark->stroke->width, 2151 2156 pen_cap, 2152 2157 pen_join, 2153 - mark-> 2154 - stroke->dash_count, 2155 - mark-> 2156 - stroke->dash_list, 2157 - mark-> 2158 - stroke->dash_offset); 2158 + mark->stroke->dash_count, 2159 + mark->stroke->dash_list, 2160 + mark->stroke->dash_offset); 2159 2161 else 2160 - rl2_graph_set_solid_pen 2161 - (ctx, mark->stroke->red, 2162 - mark->stroke->green, 2163 - mark->stroke->blue, 2164 - norm_opacity, 2165 - mark->stroke->width, 2166 - pen_cap, pen_join); 2162 + rl2_graph_set_solid_pen (ctx, 2163 + mark->stroke->red, 2164 + mark->stroke->green, 2165 + mark->stroke->blue, 2166 + norm_opacity, 2167 + mark->stroke->width, 2168 + pen_cap, 2169 + pen_join); 2167 2170 stroke = 1; 2168 2171 } 2169 2172 } 2170 2173 } 2171 2174 } 2172 2175 if (graphic->type == RL2_EXTERNAL_GRAPHIC) 2173 2176 { 2174 2177 rl2PrivExternalGraphicPtr ext = 2175 2178 (rl2PrivExternalGraphicPtr) (graphic->item); 2176 - const char *xlink_href = NULL; 2177 - int recolor = 0; 2178 - unsigned char red; 2179 - unsigned char green; 2180 - unsigned char blue; 2181 - pattern = NULL; 2182 2179 if (ext != NULL) 2183 2180 { 2184 2181 is_external = 1; 2185 - if (ext->xlink_href != NULL) 2186 - xlink_href = ext->xlink_href; 2187 - if (ext->first != NULL) 2188 - { 2189 - recolor = 1; 2190 - red = ext->first->red; 2191 - green = ext->first->green; 2192 - blue = ext->first->blue; 2193 - } 2194 - if (xlink_href != NULL) 2195 - { 2196 - /* first attempt: Bitmap */ 2197 - pattern = 2198 - rl2_create_pattern_from_external_graphic 2199 - (handle, xlink_href, 1); 2200 - if (pattern == NULL) 2201 - { 2202 - /* second attempt: SVG */ 2203 - pattern = 2204 - rl2_create_pattern_from_external_svg 2205 - (handle, xlink_href, 2206 - point_sym->graphic->size); 2207 - } 2208 - } 2209 - } 2210 - if (pattern != NULL) 2211 - { 2212 - if (recolor) 2213 - { 2214 - /* attempting to recolor the External Graphic resource */ 2215 - rl2_graph_pattern_recolor (pattern, 2216 - red, green, 2217 - blue); 2218 - } 2219 - if (point_sym->graphic->opacity <= 0.0) 2220 - norm_opacity = 0; 2221 - else if (point_sym->graphic->opacity >= 1.0) 2222 - norm_opacity = 255; 2223 - else 2224 - { 2225 - opacity = 2226 - 255.0 * point_sym->graphic->opacity; 2227 - if (opacity <= 0.0) 2228 - norm_opacity = 0; 2229 - else if (opacity >= 255.0) 2230 - norm_opacity = 255; 2231 - else 2232 - norm_opacity = opacity; 2233 - } 2234 - if (norm_opacity < 1.0) 2235 - rl2_graph_pattern_transparency 2236 - (pattern, norm_opacity); 2237 - rl2_graph_set_pattern_brush (ctx, pattern); 2238 - } 2239 - else 2240 - { 2241 - /* invalid Pattern: defaulting to a Gray brush */ 2242 - rl2_graph_set_brush (ctx, 128, 128, 128, 255); 2182 + pattern = 2183 + load_external_bitmap_from_dbms (handle, 2184 + ext->xlink_href); 2243 2185 } 2244 2186 } 2245 2187 2246 2188 /* actual Point rendering */ 2247 2189 point = geom->first_point; 2248 2190 while (point) 2249 2191 { 2250 2192 /* drawing a POINT */ 2251 - if (point_bbox_matches 2252 - (point, minx, miny, maxx, maxy)) 2253 - { 2254 - double x = (point->x - minx) / x_res; 2255 - double y = 2256 - (double) height - 2257 - ((point->y - miny) / y_res); 2258 - double size2 = gr->size / 2.0; 2259 - double size4 = gr->size / 4.0; 2260 - double size6 = gr->size / 6.0; 2261 - double size13 = gr->size / 3.0; 2262 - double size23 = (gr->size / 3.0) * 2.0; 2263 - int i; 2264 - double rads; 2265 - if (size2 <= 0.0) 2266 - size2 = 1.0; 2267 - if (size4 <= 0.0) 2268 - size4 = 1.0; 2269 - if (size6 <= 0.0) 2270 - size6 = 1.0; 2271 - if (size13 <= 0.0) 2272 - size13 = 1.0; 2273 - if (size23 <= 0.0) 2274 - size23 = 1.0; 2275 - if (is_mark) 2193 + double x = (point->x - minx) / x_res; 2194 + double y = 2195 + (double) height - ((point->y - miny) / y_res); 2196 + double size2 = gr->size / 2.0; 2197 + double size4 = gr->size / 4.0; 2198 + double size6 = gr->size / 6.0; 2199 + double size13 = gr->size / 3.0; 2200 + double size23 = (gr->size / 3.0) * 2.0; 2201 + int i; 2202 + double rads; 2203 + if (size2 <= 0.0) 2204 + size2 = 1.0; 2205 + if (size4 <= 0.0) 2206 + size4 = 1.0; 2207 + if (size6 <= 0.0) 2208 + size6 = 1.0; 2209 + if (size13 <= 0.0) 2210 + size13 = 1.0; 2211 + if (size23 <= 0.0) 2212 + size23 = 1.0; 2213 + if (is_mark) 2214 + { 2215 + /* drawing a well-known Mark */ 2216 + switch (well_known_type) 2276 2217 { 2277 - /* drawing a well-known Mark */ 2278 - switch (well_known_type) 2218 + case RL2_GRAPHIC_MARK_CIRCLE: 2219 + rads = 0.0; 2220 + for (i = 0; i < 32; i++) 2221 + { 2222 + double tic = 6.28318530718 / 32.0; 2223 + double cx = 2224 + x + (size2 * sin (rads)); 2225 + double cy = 2226 + y + (size2 * cos (rads)); 2227 + if (i == 0) 2228 + rl2_graph_move_to_point (ctx, 2229 + cx, 2230 + cy); 2231 + else 2232 + rl2_graph_add_line_to_path 2233 + (ctx, cx, cy); 2234 + rads += tic; 2235 + } 2236 + rl2_graph_close_subpath (ctx); 2237 + break; 2238 + case RL2_GRAPHIC_MARK_TRIANGLE: 2239 + rl2_graph_move_to_point (ctx, x, 2240 + y - size23); 2241 + rl2_graph_add_line_to_path (ctx, 2242 + x - size2, 2243 + y + size13); 2244 + rl2_graph_add_line_to_path (ctx, 2245 + x + size2, 2246 + y + size13); 2247 + rl2_graph_close_subpath (ctx); 2248 + break; 2249 + case RL2_GRAPHIC_MARK_STAR: 2250 + rads = 3.14159265359; 2251 + for (i = 0; i < 10; i++) 2279 2252 { 2280 - case RL2_GRAPHIC_MARK_CIRCLE: 2281 - rads = 0.0; 2282 - for (i = 0; i < 32; i++) 2283 - { 2284 - double tic = 2285 - 6.28318530718 / 32.0; 2286 - double cx = 2287 - x + 2288 - (size2 * sin (rads)); 2289 - double cy = 2290 - y + 2291 - (size2 * cos (rads)); 2292 - if (i == 0) 2293 - rl2_graph_move_to_point 2294 - (ctx, cx, cy); 2295 - else 2296 - rl2_graph_add_line_to_path 2297 - (ctx, cx, cy); 2298 - rads += tic; 2299 - } 2300 - rl2_graph_close_subpath (ctx); 2301 - break; 2302 - case RL2_GRAPHIC_MARK_TRIANGLE: 2303 - rl2_graph_move_to_point (ctx, x, 2304 - y - 2305 - size23); 2306 - rl2_graph_add_line_to_path (ctx, 2307 - x - 2308 - size2, 2309 - y + 2310 - size13); 2311 - rl2_graph_add_line_to_path (ctx, 2312 - x + 2313 - size2, 2314 - y + 2315 - size13); 2316 - rl2_graph_close_subpath (ctx); 2317 - break; 2318 - case RL2_GRAPHIC_MARK_STAR: 2319 - rads = 3.14159265359; 2320 - for (i = 0; i < 10; i++) 2321 - { 2322 - double tic = 2323 - (i % 2) ? size6 : size2; 2324 - double cx = 2325 - x + (tic * sin (rads)); 2326 - double cy = 2327 - y + (tic * cos (rads)); 2328 - if (i == 0) 2329 - rl2_graph_move_to_point 2330 - (ctx, cx, cy); 2331 - else 2332 - rl2_graph_add_line_to_path 2333 - (ctx, cx, cy); 2334 - rads += 0.628318530718; 2335 - } 2336 - rl2_graph_close_subpath (ctx); 2337 - break; 2338 - case RL2_GRAPHIC_MARK_CROSS: 2339 - rl2_graph_move_to_point (ctx, 2340 - x - 2341 - size6, 2342 - y - 2343 - size2); 2344 - rl2_graph_add_line_to_path (ctx, 2345 - x + 2346 - size6, 2347 - y - 2348 - size2); 2349 - rl2_graph_add_line_to_path (ctx, 2350 - x + 2351 - size6, 2352 - y - 2353 - size6); 2354 - rl2_graph_add_line_to_path (ctx, 2355 - x + 2356 - size2, 2357 - y - 2358 - size6); 2359 - rl2_graph_add_line_to_path (ctx, 2360 - x + 2361 - size2, 2362 - y + 2363 - size6); 2364 - rl2_graph_add_line_to_path (ctx, 2365 - x + 2366 - size6, 2367 - y + 2368 - size6); 2369 - rl2_graph_add_line_to_path (ctx, 2370 - x + 2371 - size6, 2372 - y + 2373 - size2); 2374 - rl2_graph_add_line_to_path (ctx, 2375 - x - 2376 - size6, 2377 - y + 2378 - size2); 2379 - rl2_graph_add_line_to_path (ctx, 2380 - x - 2381 - size6, 2382 - y + 2383 - size6); 2384 - rl2_graph_add_line_to_path (ctx, 2385 - x - 2386 - size2, 2387 - y + 2388 - size6); 2389 - rl2_graph_add_line_to_path (ctx, 2390 - x - 2391 - size2, 2392 - y - 2393 - size6); 2394 - rl2_graph_add_line_to_path (ctx, 2395 - x - 2396 - size6, 2397 - y - 2398 - size6); 2399 - rl2_graph_close_subpath (ctx); 2400 - break; 2401 - case RL2_GRAPHIC_MARK_X: 2402 - rl2_graph_move_to_point (ctx, 2403 - x - 2404 - size2, 2405 - y - 2406 - size2); 2407 - rl2_graph_add_line_to_path (ctx, 2408 - x - 2409 - size4, 2410 - y - 2411 - size2); 2412 - rl2_graph_add_line_to_path (ctx, 2413 - x, 2414 - y - 2415 - size6); 2416 - rl2_graph_add_line_to_path (ctx, 2417 - x + 2418 - size6, 2419 - y - 2420 - size2); 2421 - rl2_graph_add_line_to_path (ctx, 2422 - x + 2423 - size2, 2424 - y - 2425 - size2); 2426 - rl2_graph_add_line_to_path (ctx, 2427 - x + 2428 - size4, 2429 - y); 2430 - rl2_graph_add_line_to_path (ctx, 2431 - x + 2432 - size2, 2433 - y + 2434 - size2); 2435 - rl2_graph_add_line_to_path (ctx, 2436 - x + 2437 - size4, 2438 - y + 2439 - size2); 2440 - rl2_graph_add_line_to_path (ctx, 2441 - x, 2442 - y + 2443 - size6); 2444 - rl2_graph_add_line_to_path (ctx, 2445 - x - 2446 - size6, 2447 - y + 2448 - size2); 2449 - rl2_graph_add_line_to_path (ctx, 2450 - x - 2451 - size2, 2452 - y + 2453 - size2); 2454 - rl2_graph_add_line_to_path (ctx, 2455 - x - 2456 - size4, 2457 - y); 2458 - rl2_graph_close_subpath (ctx); 2459 - break; 2460 - case RL2_GRAPHIC_MARK_SQUARE: 2461 - default: 2462 - rl2_graph_move_to_point (ctx, 2463 - x - 2464 - size2, 2465 - y - 2466 - size2); 2467 - rl2_graph_add_line_to_path (ctx, 2468 - x - 2469 - size2, 2470 - y + 2471 - size2); 2472 - rl2_graph_add_line_to_path (ctx, 2473 - x + 2474 - size2, 2475 - y + 2476 - size2); 2477 - rl2_graph_add_line_to_path (ctx, 2478 - x + 2479 - size2, 2480 - y - 2481 - size2); 2482 - rl2_graph_close_subpath (ctx); 2483 - break; 2484 - }; 2485 - if (fill) 2486 - { 2487 - if (stroke) 2488 - rl2_graph_fill_path (ctx, 2489 - RL2_PRESERVE_PATH); 2253 + double tic = 2254 + (i % 2) ? size6 : size2; 2255 + double cx = 2256 + x + (tic * sin (rads)); 2257 + double cy = 2258 + y + (tic * cos (rads)); 2259 + if (i == 0) 2260 + rl2_graph_move_to_point (ctx, 2261 + cx, 2262 + cy); 2490 2263 else 2491 - rl2_graph_fill_path (ctx, 2492 - RL2_CLEAR_PATH); 2264 + rl2_graph_add_line_to_path 2265 + (ctx, cx, cy); 2266 + rads += 0.628318530718; 2493 2267 } 2268 + rl2_graph_close_subpath (ctx); 2269 + break; 2270 + case RL2_GRAPHIC_MARK_CROSS: 2271 + rl2_graph_move_to_point (ctx, x - size6, 2272 + y - size2); 2273 + rl2_graph_add_line_to_path (ctx, 2274 + x + size6, 2275 + y - size2); 2276 + rl2_graph_add_line_to_path (ctx, 2277 + x + size6, 2278 + y - size6); 2279 + rl2_graph_add_line_to_path (ctx, 2280 + x + size2, 2281 + y - size6); 2282 + rl2_graph_add_line_to_path (ctx, 2283 + x + size2, 2284 + y + size6); 2285 + rl2_graph_add_line_to_path (ctx, 2286 + x + size6, 2287 + y + size6); 2288 + rl2_graph_add_line_to_path (ctx, 2289 + x + size6, 2290 + y + size2); 2291 + rl2_graph_add_line_to_path (ctx, 2292 + x - size6, 2293 + y + size2); 2294 + rl2_graph_add_line_to_path (ctx, 2295 + x - size6, 2296 + y + size6); 2297 + rl2_graph_add_line_to_path (ctx, 2298 + x - size2, 2299 + y + size6); 2300 + rl2_graph_add_line_to_path (ctx, 2301 + x - size2, 2302 + y - size6); 2303 + rl2_graph_add_line_to_path (ctx, 2304 + x - size6, 2305 + y - size6); 2306 + rl2_graph_close_subpath (ctx); 2307 + break; 2308 + case RL2_GRAPHIC_MARK_X: 2309 + rl2_graph_move_to_point (ctx, x - size2, 2310 + y - size2); 2311 + rl2_graph_add_line_to_path (ctx, 2312 + x - size4, 2313 + y - size2); 2314 + rl2_graph_add_line_to_path (ctx, x, 2315 + y - size6); 2316 + rl2_graph_add_line_to_path (ctx, 2317 + x + size6, 2318 + y - size2); 2319 + rl2_graph_add_line_to_path (ctx, 2320 + x + size2, 2321 + y - size2); 2322 + rl2_graph_add_line_to_path (ctx, 2323 + x + size4, 2324 + y); 2325 + rl2_graph_add_line_to_path (ctx, 2326 + x + size2, 2327 + y + size2); 2328 + rl2_graph_add_line_to_path (ctx, 2329 + x + size4, 2330 + y + size2); 2331 + rl2_graph_add_line_to_path (ctx, x, 2332 + y + size6); 2333 + rl2_graph_add_line_to_path (ctx, 2334 + x - size6, 2335 + y + size2); 2336 + rl2_graph_add_line_to_path (ctx, 2337 + x - size2, 2338 + y + size2); 2339 + rl2_graph_add_line_to_path (ctx, 2340 + x - size4, 2341 + y); 2342 + rl2_graph_close_subpath (ctx); 2343 + break; 2344 + case RL2_GRAPHIC_MARK_SQUARE: 2345 + default: 2346 + rl2_graph_move_to_point (ctx, x - size2, 2347 + y - size2); 2348 + rl2_graph_add_line_to_path (ctx, 2349 + x - size2, 2350 + y + size2); 2351 + rl2_graph_add_line_to_path (ctx, 2352 + x + size2, 2353 + y + size2); 2354 + rl2_graph_add_line_to_path (ctx, 2355 + x + size2, 2356 + y - size2); 2357 + rl2_graph_close_subpath (ctx); 2358 + break; 2359 + }; 2360 + if (fill) 2361 + { 2494 2362 if (stroke) 2495 - rl2_graph_stroke_path (ctx, 2496 - RL2_CLEAR_PATH); 2363 + rl2_graph_fill_path (ctx, 2364 + RL2_PRESERVE_PATH); 2365 + else 2366 + rl2_graph_fill_path (ctx, 2367 + RL2_CLEAR_PATH); 2497 2368 } 2498 - if (is_external && pattern != NULL) 2499 - { 2500 - /* drawing an External Graphic pattern */ 2501 - unsigned int width; 2502 - unsigned int height; 2503 - rl2_graph_get_pattern_size (pattern, 2504 - &width, 2505 - &height); 2506 - double out_width = width; 2507 - double out_height = height; 2508 - rl2_graph_draw_graphic_symbol (ctx, 2509 - pattern, 2510 - out_width, 2511 - out_height, 2512 - x + 2513 - point_sym->graphic->displacement_x, 2514 - y - 2515 - point_sym->graphic->displacement_y, 2516 - point_sym->graphic->rotation, 2517 - point_sym->graphic->anchor_point_x, 2518 - point_sym->graphic->anchor_point_y); 2519 - } 2369 + if (stroke) 2370 + rl2_graph_stroke_path (ctx, 2371 + RL2_CLEAR_PATH); 2372 + } 2373 + if (is_external && pattern != NULL) 2374 + { 2375 + /* drawing an External Graphic bitmap */ 2376 + rl2_graph_draw_bitmap (ctx, pattern, x, y); 2520 2377 } 2521 2378 point = point->next; 2522 2379 } 2523 2380 2524 2381 /* releasing Patterns */ 2525 2382 if (pattern != NULL) 2526 - rl2_graph_destroy_pattern (pattern); 2383 + rl2_graph_destroy_bitmap (pattern); 2527 2384 if (pattern_fill != NULL) 2528 2385 { 2529 2386 rl2_graph_release_pattern_pen (ctx); 2530 2387 rl2_graph_destroy_pattern (pattern_fill); 2531 2388 } 2532 2389 if (pattern_stroke != NULL) 2533 2390 { ................................................................................ 2537 2394 graphic = graphic->next; 2538 2395 } 2539 2396 } 2540 2397 item = item->next; 2541 2398 } 2542 2399 } 2543 2400 2544 -static int 2545 -linestring_bbox_matches (rl2LinestringPtr ring, double minx, double miny, 2546 - double maxx, double maxy) 2547 -{ 2548 -/* checks if the Linestring BBOX is visible */ 2549 - if (minx > ring->maxx) 2550 - return 0; 2551 - if (maxx < ring->minx) 2552 - return 0; 2553 - if (miny > ring->maxy) 2554 - return 0; 2555 - if (maxy < ring->miny) 2556 - return 0; 2557 - return 1; 2558 -} 2559 - 2560 2401 static void 2561 2402 draw_lines (rl2GraphicsContextPtr ctx, sqlite3 * handle, 2562 2403 rl2PrivVectorSymbolizerPtr sym, int height, double minx, 2563 - double miny, double maxx, double maxy, double x_res, double y_res, 2564 - rl2GeometryPtr geom) 2404 + double miny, double x_res, double y_res, rl2GeometryPtr geom) 2565 2405 { 2566 2406 /* drawing Linear-type features */ 2567 2407 rl2PrivVectorSymbolizerItemPtr item; 2568 2408 int pen_cap; 2569 2409 int pen_join; 2570 2410 double opacity; 2571 2411 unsigned char norm_opacity; ................................................................................ 2581 2421 rl2PrivLineSymbolizerPtr line_sym = 2582 2422 (rl2PrivLineSymbolizerPtr) (item->symbolizer); 2583 2423 if (line_sym->stroke != NULL) 2584 2424 { 2585 2425 if (line_sym->stroke->graphic != NULL) 2586 2426 { 2587 2427 /* external Graphic stroke */ 2588 - const char *xlink_href = NULL; 2589 - int recolor = 0; 2590 - unsigned char red; 2591 - unsigned char green; 2592 - unsigned char blue; 2593 - pattern = NULL; 2594 - if (line_sym->stroke->graphic->first != NULL) 2595 - { 2596 - if (line_sym->stroke->graphic->first->type == 2597 - RL2_EXTERNAL_GRAPHIC) 2598 - { 2599 - rl2PrivExternalGraphicPtr ext = 2600 - (rl2PrivExternalGraphicPtr) 2601 - (line_sym->stroke->graphic-> 2602 - first->item); 2603 - xlink_href = ext->xlink_href; 2604 - if (ext->first != NULL) 2605 - { 2606 - recolor = 1; 2607 - red = ext->first->red; 2608 - green = ext->first->green; 2609 - blue = ext->first->blue; 2610 - } 2611 - } 2612 - } 2613 - if (xlink_href != NULL) 2614 - pattern = 2615 - rl2_create_pattern_from_external_graphic 2616 - (handle, xlink_href, 1); 2428 + pattern = load_external_graphic_from_dbms (handle, 2429 + line_sym->stroke->graphic); 2617 2430 if (pattern != NULL) 2618 2431 { 2619 - if (recolor) 2432 + switch (line_sym->stroke->linecap) 2620 2433 { 2621 - /* attempting to recolor the External Graphic resource */ 2622 - rl2_graph_pattern_recolor (pattern, 2623 - red, green, 2624 - blue); 2625 - } 2626 - if (line_sym->stroke->opacity <= 0.0) 2627 - norm_opacity = 0; 2628 - else if (line_sym->stroke->opacity >= 1.0) 2629 - norm_opacity = 255; 2630 - else 2434 + case RL2_STROKE_LINECAP_ROUND: 2435 + pen_cap = RL2_PEN_CAP_ROUND; 2436 + break; 2437 + case RL2_STROKE_LINECAP_SQUARE: 2438 + pen_cap = RL2_PEN_CAP_SQUARE; 2439 + break; 2440 + default: 2441 + pen_cap = RL2_PEN_CAP_BUTT; 2442 + break; 2443 + }; 2444 + switch (line_sym->stroke->linejoin) 2631 2445 { 2632 - opacity = 2633 - 255.0 * line_sym->stroke->opacity; 2634 - if (opacity <= 0.0) 2635 - norm_opacity = 0; 2636 - else if (opacity >= 255.0) 2637 - norm_opacity = 255; 2638 - else 2639 - norm_opacity = opacity; 2640 - } 2641 - if (norm_opacity < 1.0) 2642 - rl2_graph_pattern_transparency 2643 - (pattern, norm_opacity); 2446 + case RL2_STROKE_LINEJOIN_BEVEL: 2447 + pen_join = RL2_PEN_JOIN_BEVEL; 2448 + break; 2449 + case RL2_STROKE_LINEJOIN_ROUND: 2450 + pen_join = RL2_PEN_JOIN_ROUND; 2451 + break; 2452 + default: 2453 + pen_join = RL2_PEN_JOIN_MITER; 2454 + break; 2455 + }; 2644 2456 if (line_sym->stroke->dash_count > 0 2645 2457 && line_sym->stroke->dash_list != NULL) 2646 2458 rl2_add_pattern_to_multi_stroke_dash 2647 2459 (multi_stroke, pattern, 2648 2460 line_sym->stroke->width, pen_cap, 2649 2461 pen_join, 2650 2462 line_sym->stroke->dash_count, ................................................................................ 2652 2464 line_sym->stroke->dash_offset); 2653 2465 else 2654 2466 rl2_add_pattern_to_multi_stroke 2655 2467 (multi_stroke, pattern, 2656 2468 line_sym->stroke->width, pen_cap, 2657 2469 pen_join); 2658 2470 } 2659 - else 2660 - { 2661 - /* invalid Pattern: defaulting to a Gray brush */ 2662 - rl2_graph_set_brush (ctx, 128, 128, 128, 255); 2663 - } 2664 2471 } 2665 2472 else 2666 2473 { 2667 2474 /* solid RGB stroke */ 2668 2475 if (line_sym->stroke->opacity <= 0.0) 2669 2476 norm_opacity = 0; 2670 2477 else if (line_sym->stroke->opacity >= 1.0) ................................................................................ 2740 2547 if (multi_stroke == NULL) 2741 2548 return; 2742 2549 2743 2550 line = geom->first_linestring; 2744 2551 while (line) 2745 2552 { 2746 2553 /* drawing a LINESTRING */ 2747 - if (linestring_bbox_matches (line, minx, miny, maxx, maxy)) 2554 + rl2PrivMultiStrokeItemPtr stroke_item; 2555 + int iv; 2556 + double dx; 2557 + double dy; 2558 + int x; 2559 + int y; 2560 + int lastX = 0; 2561 + int lastY = 0; 2562 + for (iv = 0; iv < line->points; iv++) 2748 2563 { 2749 - rl2PrivMultiStrokeItemPtr stroke_item; 2750 - int iv; 2751 - double dx; 2752 - double dy; 2753 - int x; 2754 - int y; 2755 - int lastX = 0; 2756 - int lastY = 0; 2757 - for (iv = 0; iv < line->points; iv++) 2564 + rl2GetPoint (line->coords, iv, &dx, &dy); 2565 + x = (int) ((dx - minx) / x_res); 2566 + y = height - (int) ((dy - miny) / y_res); 2567 + if (iv == 0) 2568 + { 2569 + rl2_graph_move_to_point (ctx, x, y); 2570 + lastX = x; 2571 + lastY = y; 2572 + } 2573 + else 2758 2574 { 2759 - rl2GetPoint (line->coords, iv, &dx, &dy); 2760 - x = (int) ((dx - minx) / x_res); 2761 - y = height - (int) ((dy - miny) / y_res); 2762 - if (iv == 0) 2575 + if (x == lastX && y == lastY) 2576 + ; 2577 + else 2763 2578 { 2764 - rl2_graph_move_to_point (ctx, x, y); 2579 + rl2_graph_add_line_to_path (ctx, x, y); 2765 2580 lastX = x; 2766 2581 lastY = y; 2767 2582 } 2583 + } 2584 + } 2585 + stroke_item = multi_stroke->first; 2586 + while (stroke_item != NULL) 2587 + { 2588 + /* applying all strokes, one after the other */ 2589 + if (stroke_item->dash_count > 0 2590 + && stroke_item->dash_list != NULL) 2591 + { 2592 + if (stroke_item->pattern != NULL) 2593 + rl2_graph_set_pattern_dashed_pen (ctx, 2594 + stroke_item->pattern, 2595 + stroke_item->width, 2596 + stroke_item->pen_cap, 2597 + stroke_item->pen_join, 2598 + stroke_item->dash_count, 2599 + stroke_item->dash_list, 2600 + stroke_item->dash_offset); 2768 2601 else 2769 - { 2770 - if (x == lastX && y == lastY) 2771 - ; 2772 - else 2773 - { 2774 - rl2_graph_add_line_to_path (ctx, x, y); 2775 - lastX = x; 2776 - lastY = y; 2777 - } 2778 - } 2602 + rl2_graph_set_dashed_pen (ctx, stroke_item->red, 2603 + stroke_item->green, 2604 + stroke_item->blue, 2605 + stroke_item->opacity, 2606 + stroke_item->width, 2607 + stroke_item->pen_cap, 2608 + stroke_item->pen_join, 2609 + stroke_item->dash_count, 2610 + stroke_item->dash_list, 2611 + stroke_item->dash_offset); 2779 2612 } 2780 - stroke_item = multi_stroke->first; 2781 - while (stroke_item != NULL) 2613 + else 2782 2614 { 2783 - /* applying all strokes, one after the other */ 2784 - if (stroke_item->dash_count > 0 2785 - && stroke_item->dash_list != NULL) 2786 - { 2787 - if (stroke_item->pattern != NULL) 2788 - rl2_graph_set_pattern_dashed_pen (ctx, 2789 - stroke_item->pattern, 2790 - stroke_item->width, 2791 - stroke_item->pen_cap, 2792 - stroke_item->pen_join, 2793 - stroke_item->dash_count, 2794 - stroke_item->dash_list, 2795 - stroke_item->dash_offset); 2796 - else 2797 - rl2_graph_set_dashed_pen (ctx, 2798 - stroke_item->red, 2799 - stroke_item->green, 2800 - stroke_item->blue, 2801 - stroke_item->opacity, 2802 - stroke_item->width, 2803 - stroke_item->pen_cap, 2804 - stroke_item->pen_join, 2805 - stroke_item->dash_count, 2806 - stroke_item->dash_list, 2807 - stroke_item->dash_offset); 2808 - } 2615 + if (stroke_item->pattern != NULL) 2616 + rl2_graph_set_pattern_solid_pen (ctx, 2617 + stroke_item->pattern, 2618 + stroke_item->width, 2619 + stroke_item->pen_cap, 2620 + stroke_item->pen_join); 2809 2621 else 2810 - { 2811 - if (stroke_item->pattern != NULL) 2812 - rl2_graph_set_pattern_solid_pen (ctx, 2813 - stroke_item->pattern, 2814 - stroke_item->width, 2815 - stroke_item->pen_cap, 2816 - stroke_item->pen_join); 2817 - else 2818 - rl2_graph_set_solid_pen (ctx, 2819 - stroke_item->red, 2820 - stroke_item->green, 2821 - stroke_item->blue, 2822 - stroke_item->opacity, 2823 - stroke_item->width, 2824 - stroke_item->pen_cap, 2825 - stroke_item->pen_join); 2826 - } 2827 - 2828 - if (stroke_item == multi_stroke->last) 2829 - rl2_graph_stroke_path (ctx, RL2_CLEAR_PATH); 2830 - else 2831 - rl2_graph_stroke_path (ctx, RL2_PRESERVE_PATH); 2832 - 2833 - stroke_item = stroke_item->next; 2834 - if (stroke_item == multi_stroke->last) 2835 - rl2_graph_release_pattern_pen (ctx); 2622 + rl2_graph_set_solid_pen (ctx, stroke_item->red, 2623 + stroke_item->green, 2624 + stroke_item->blue, 2625 + stroke_item->opacity, 2626 + stroke_item->width, 2627 + stroke_item->pen_cap, 2628 + stroke_item->pen_join); 2836 2629 } 2630 + 2631 + if (stroke_item == multi_stroke->last) 2632 + rl2_graph_stroke_path (ctx, RL2_CLEAR_PATH); 2633 + else 2634 + rl2_graph_stroke_path (ctx, RL2_PRESERVE_PATH); 2635 + 2636 + stroke_item = stroke_item->next; 2637 + if (stroke_item == multi_stroke->last) 2638 + rl2_graph_release_pattern_pen (ctx); 2837 2639 } 2838 2640 line = line->next; 2839 2641 } 2840 2642 rl2_destroy_multi_stroke (multi_stroke); 2841 2643 } 2842 2644 2843 -static int 2844 -ring_bbox_matches (rl2RingPtr ring, double minx, double miny, double maxx, 2845 - double maxy) 2846 -{ 2847 -/* checks if the Ring BBOX is visible */ 2848 - if (minx > ring->maxx) 2849 - return 0; 2850 - if (maxx < ring->minx) 2851 - return 0; 2852 - if (miny > ring->maxy) 2853 - return 0; 2854 - if (maxy < ring->miny) 2855 - return 0; 2856 - return 1; 2857 -} 2858 - 2859 2645 static void 2860 2646 draw_polygons (rl2GraphicsContextPtr ctx, sqlite3 * handle, 2861 2647 rl2PrivVectorSymbolizerPtr sym, int height, double minx, 2862 - double miny, double maxx, double maxy, double x_res, 2863 - double y_res, rl2GeometryPtr geom) 2648 + double miny, double x_res, double y_res, rl2GeometryPtr geom) 2864 2649 { 2865 2650 /* drawing Polygonal-type features */ 2866 2651 rl2PrivVectorSymbolizerItemPtr item; 2867 2652 int stroke = 0; 2868 2653 int fill = 0; 2869 2654 int pen_cap; 2870 2655 int pen_join; ................................................................................ 2919 2704 rl2_create_pattern_from_external_graphic 2920 2705 (handle, xlink_href, 1); 2921 2706 if (pattern_fill != NULL) 2922 2707 { 2923 2708 if (recolor) 2924 2709 { 2925 2710 /* attempting to recolor the External Graphic resource */ 2926 - rl2_graph_pattern_recolor 2927 - (pattern_fill, red, green, blue); 2711 + rl2_graph_pattern_recolor (pattern_fill, 2712 + red, green, 2713 + blue); 2928 2714 } 2929 2715 if (polyg_sym->fill->opacity <= 0.0) 2930 2716 norm_opacity = 0; 2931 2717 else if (polyg_sym->fill->opacity >= 1.0) 2932 2718 norm_opacity = 255; 2933 2719 else 2934 2720 { ................................................................................ 2979 2765 } 2980 2766 } 2981 2767 if (polyg_sym->stroke != NULL) 2982 2768 { 2983 2769 if (polyg_sym->stroke->graphic != NULL) 2984 2770 { 2985 2771 /* external Graphic stroke */ 2986 - const char *xlink_href = NULL; 2987 - int recolor = 0; 2988 - unsigned char red; 2989 - unsigned char green; 2990 - unsigned char blue; 2991 - pattern_stroke = NULL; 2992 - if (polyg_sym->stroke->graphic->first != NULL) 2993 - { 2994 - if (polyg_sym->stroke->graphic->first->type == 2995 - RL2_EXTERNAL_GRAPHIC) 2996 - { 2997 - rl2PrivExternalGraphicPtr ext = 2998 - (rl2PrivExternalGraphicPtr) 2999 - (polyg_sym->stroke->graphic-> 3000 - first->item); 3001 - xlink_href = ext->xlink_href; 3002 - if (ext->first != NULL) 3003 - { 3004 - recolor = 1; 3005 - red = ext->first->red; 3006 - green = ext->first->green; 3007 - blue = ext->first->blue; 3008 - } 3009 - } 3010 - } 3011 - if (xlink_href != NULL) 3012 - pattern_stroke = 3013 - rl2_create_pattern_from_external_graphic 3014 - (handle, xlink_href, 1); 2772 + pattern_stroke = 2773 + load_external_graphic_from_dbms (handle, 2774 + polyg_sym->stroke->graphic); 3015 2775 if (pattern_stroke != NULL) 3016 2776 { 3017 - if (recolor) 2777 + switch (polyg_sym->stroke->linecap) 3018 2778 { 3019 - /* attempting to recolor the External Graphic resource */ 3020 - rl2_graph_pattern_recolor 3021 - (pattern_stroke, red, green, blue); 3022 - } 3023 - if (polyg_sym->stroke->opacity <= 0.0) 3024 - norm_opacity = 0; 3025 - else if (polyg_sym->stroke->opacity >= 1.0) 3026 - norm_opacity = 255; 3027 - else 2779 + case RL2_STROKE_LINECAP_ROUND: 2780 + pen_cap = RL2_PEN_CAP_ROUND; 2781 + break; 2782 + case RL2_STROKE_LINECAP_SQUARE: 2783 + pen_cap = RL2_PEN_CAP_SQUARE; 2784 + break; 2785 + default: 2786 + pen_cap = RL2_PEN_CAP_BUTT; 2787 + break; 2788 + }; 2789 + switch (polyg_sym->stroke->linejoin) 3028 2790 { 3029 - opacity = 3030 - 255.0 * polyg_sym->stroke->opacity; 3031 - if (opacity <= 0.0) 3032 - norm_opacity = 0; 3033 - else if (opacity >= 255.0) 3034 - norm_opacity = 255; 3035 - else 3036 - norm_opacity = opacity; 3037 - } 3038 - if (norm_opacity < 1.0) 3039 - rl2_graph_pattern_transparency 3040 - (pattern_stroke, norm_opacity); 3041 - rl2_graph_set_pattern_brush (ctx, 3042 - pattern_stroke); 3043 - } 3044 - else 3045 - { 3046 - /* invalid Pattern: defaulting to a Gray brush */ 3047 - rl2_graph_set_brush (ctx, 128, 128, 128, 255); 3048 - } 3049 - stroke = 1; 2791 + case RL2_STROKE_LINEJOIN_BEVEL: 2792 + pen_join = RL2_PEN_JOIN_BEVEL; 2793 + break; 2794 + case RL2_STROKE_LINEJOIN_ROUND: 2795 + pen_join = RL2_PEN_JOIN_ROUND; 2796 + break; 2797 + default: 2798 + pen_join = RL2_PEN_JOIN_MITER; 2799 + break; 2800 + }; 2801 + if (polyg_sym->stroke->dash_count > 0 2802 + && polyg_sym->stroke->dash_list != NULL) 2803 + rl2_graph_set_pattern_dashed_pen (ctx, 2804 + pattern_stroke, 2805 + polyg_sym-> 2806 + stroke->width, 2807 + pen_cap, 2808 + pen_join, 2809 + polyg_sym->stroke->dash_count, 2810 + polyg_sym->stroke->dash_list, 2811 + polyg_sym->stroke->dash_offset); 2812 + else 2813 + rl2_graph_set_pattern_solid_pen (ctx, 2814 + pattern_stroke, 2815 + polyg_sym-> 2816 + stroke->width, 2817 + pen_cap, 2818 + pen_join); 2819 + stroke = 1; 2820 + } 3050 2821 } 3051 2822 else 3052 2823 { 3053 2824 /* solid RGB stroke */ 3054 2825 if (polyg_sym->stroke->opacity <= 0.0) 3055 2826 norm_opacity = 0; 3056 2827 else if (polyg_sym->stroke->opacity >= 1.0) ................................................................................ 3139 2910 int x; 3140 2911 int y; 3141 2912 int lastX = 0; 3142 2913 int lastY = 0; 3143 2914 int ib; 3144 2915 rl2RingPtr ring = polyg->exterior; 3145 2916 /* exterior border */ 3146 - if (ring_bbox_matches (ring, minx, miny, maxx, maxy)) 2917 + for (iv = 0; iv < ring->points; iv++) 2918 + { 2919 + rl2GetPoint (ring->coords, iv, &dx, &dy); 2920 + x = (int) ((dx - minx) / x_res); 2921 + y = height - (int) ((dy - miny) / y_res); 2922 + if (iv == 0) 2923 + { 2924 + rl2_graph_move_to_point (ctx, x, y); 2925 + lastX = x; 2926 + lastY = y; 2927 + } 2928 + else 2929 + { 2930 + if (x == lastX && y == lastY) 2931 + ; 2932 + else 2933 + { 2934 + rl2_graph_add_line_to_path (ctx, x, y); 2935 + lastX = x; 2936 + lastY = y; 2937 + } 2938 + } 2939 + } 2940 + rl2_graph_close_subpath (ctx); 2941 + for (ib = 0; ib < polyg->num_interiors; ib++) 3147 2942 { 2943 + /* interior borders */ 2944 + ring = polyg->interiors + ib; 3148 2945 for (iv = 0; iv < ring->points; iv++) 3149 2946 { 3150 2947 rl2GetPoint (ring->coords, iv, &dx, &dy); 3151 2948 x = (int) ((dx - minx) / x_res); 3152 2949 y = height - (int) ((dy - miny) / y_res); 3153 2950 if (iv == 0) 3154 2951 { ................................................................................ 3165 2962 rl2_graph_add_line_to_path (ctx, x, y); 3166 2963 lastX = x; 3167 2964 lastY = y; 3168 2965 } 3169 2966 } 3170 2967 } 3171 2968 rl2_graph_close_subpath (ctx); 3172 - } 3173 - else 3174 - { 3175 - /* if the exterior ring is invisible we'll ignore all internal rings */ 3176 - polyg = polyg->next; 3177 - continue; 3178 - } 3179 - for (ib = 0; ib < polyg->num_interiors; ib++) 3180 - { 3181 - /* interior borders */ 3182 - ring = polyg->interiors + ib; 3183 - if (ring_bbox_matches (ring, minx, miny, maxx, maxy)) 3184 - { 3185 - for (iv = 0; iv < ring->points; iv++) 3186 - { 3187 - rl2GetPoint (ring->coords, iv, &dx, &dy); 3188 - x = (int) ((dx - minx) / x_res); 3189 - y = height - (int) ((dy - miny) / y_res); 3190 - if (iv == 0) 3191 - { 3192 - rl2_graph_move_to_point (ctx, x, y); 3193 - lastX = x; 3194 - lastY = y; 3195 - } 3196 - else 3197 - { 3198 - if (x == lastX && y == lastY) 3199 - ; 3200 - else 3201 - { 3202 - rl2_graph_add_line_to_path (ctx, 3203 - x, y); 3204 - lastX = x; 3205 - lastY = y; 3206 - } 3207 - } 3208 - } 3209 - rl2_graph_close_subpath (ctx); 3210 - } 3211 2969 } 3212 2970 if (fill) 3213 2971 { 3214 2972 if (stroke) 3215 2973 rl2_graph_fill_path (ctx, RL2_PRESERVE_PATH); 3216 2974 else 3217 2975 rl2_graph_fill_path (ctx, RL2_CLEAR_PATH); ................................................................................ 3231 2989 rl2_graph_destroy_pattern (pattern_stroke); 3232 2990 } 3233 2991 item = item->next; 3234 2992 } 3235 2993 } 3236 2994 3237 2995 static int 3238 -label_get_xy (sqlite3 * handle, const unsigned char *blob, int size, 3239 - double *x, double *y) 2996 +label_get_xy (sqlite3 * handle, const unsigned char *blob, int size, double *x, 2997 + double *y) 3240 2998 { 3241 2999 /* resolving Point XY coords */ 3242 3000 const char *sql; 3243 3001 int ret; 3244 3002 sqlite3_stmt *stmt = NULL; 3245 3003 int ok = 0; 3246 3004 ................................................................................ 3303 3061 if (ret == SQLITE_DONE) 3304 3062 break; /* end of result set */ 3305 3063 if (ret == SQLITE_ROW) 3306 3064 { 3307 3065 if (sqlite3_column_type (stmt, 0) == SQLITE_BLOB) 3308 3066 { 3309 3067 const unsigned char *g_blob = 3310 - (const unsigned char *) sqlite3_column_blob (stmt, 3311 - 0); 3068 + (const unsigned char *) sqlite3_column_blob (stmt, 0); 3312 3069 int g_size = sqlite3_column_bytes (stmt, 0); 3313 3070 if (label_get_xy (handle, g_blob, g_size, x, y)) 3314 3071 ok = 1; 3315 3072 } 3316 3073 } 3317 3074 } 3318 3075 sqlite3_finalize (stmt); ................................................................................ 3351 3108 if (ret == SQLITE_DONE) 3352 3109 break; /* end of result set */ 3353 3110 if (ret == SQLITE_ROW) 3354 3111 { 3355 3112 if (sqlite3_column_type (stmt, 0) == SQLITE_BLOB) 3356 3113 { 3357 3114 const unsigned char *g_blob = 3358 - (const unsigned char *) sqlite3_column_blob (stmt, 3359 - 0); 3115 + (const unsigned char *) sqlite3_column_blob (stmt, 0); 3360 3116 int g_size = sqlite3_column_bytes (stmt, 0); 3361 3117 if (label_get_xy (handle, g_blob, g_size, x, y)) 3362 3118 ok = 1; 3363 3119 } 3364 3120 } 3365 3121 } 3366 3122 sqlite3_finalize (stmt); 3367 3123 return ok; 3368 3124 } 3369 3125 3370 -static int 3371 -label_get_ring_midpoint (sqlite3 * handle, rl2RingPtr ring, double *x, 3372 - double *y) 3373 -{ 3374 -/* computing a Ring MidPoint */ 3375 - unsigned char *blob; 3376 - int blob_sz; 3377 - const char *sql; 3378 - int ret; 3379 - sqlite3_stmt *stmt = NULL; 3380 - int ok = 0; 3381 - 3382 - if (ring == NULL) 3383 - return 0; 3384 - if (!rl2_serialize_ring_as_linestring (ring, &blob, &blob_sz)) 3385 - return 0; 3386 - 3387 - sql = "SELECT ST_Line_Interpolate_Point(?, 0.5)"; 3388 - ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); 3389 - if (ret != SQLITE_OK) 3390 - return 0; 3391 - 3392 - sqlite3_reset (stmt); 3393 - sqlite3_clear_bindings (stmt); 3394 - sqlite3_bind_blob (stmt, 1, blob, blob_sz, free); 3395 - while (1) 3396 - { 3397 - /* scrolling the result set rows */ 3398 - ret = sqlite3_step (stmt); 3399 - if (ret == SQLITE_DONE) 3400 - break; /* end of result set */ 3401 - if (ret == SQLITE_ROW) 3402 - { 3403 - if (sqlite3_column_type (stmt, 0) == SQLITE_BLOB) 3404 - { 3405 - const unsigned char *g_blob = 3406 - (const unsigned char *) sqlite3_column_blob (stmt, 3407 - 0); 3408 - int g_size = sqlite3_column_bytes (stmt, 0); 3409 - if (label_get_xy (handle, g_blob, g_size, x, y)) 3410 - ok = 1; 3411 - } 3412 - } 3413 - } 3414 - sqlite3_finalize (stmt); 3415 - return ok; 3416 -} 3417 - 3418 -static rl2GeometryPtr 3419 -do_generalize_linestring (sqlite3 * handle, rl2LinestringPtr line, 3420 - double generalize_factor) 3421 -{ 3422 -/* simplifying a Linestring */ 3423 - rl2GeometryPtr geom = NULL; 3424 - unsigned char *blob; 3425 - int blob_sz; 3426 - const char *sql; 3427 - int ret; 3428 - sqlite3_stmt *stmt = NULL; 3429 - 3430 - if (line == NULL) 3431 - return NULL; 3432 - if (line->points < 2) 3433 - return NULL; 3434 - if (!rl2_serialize_linestring (line, &blob, &blob_sz)) 3435 - return NULL; 3436 - 3437 - sql = "SELECT ST_Simplify(?, ?)"; 3438 - ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); 3439 - if (ret != SQLITE_OK) 3440 - return NULL; 3441 - 3442 - sqlite3_reset (stmt); 3443 - sqlite3_clear_bindings (stmt); 3444 - sqlite3_bind_blob (stmt, 1, blob, blob_sz, free); 3445 - sqlite3_bind_double (stmt, 2, generalize_factor); 3446 - while (1) 3447 - { 3448 - /* scrolling the result set rows */ 3449 - ret = sqlite3_step (stmt); 3450 - if (ret == SQLITE_DONE) 3451 - break; /* end of result set */ 3452 - if (ret == SQLITE_ROW) 3453 - { 3454 - if (sqlite3_column_type (stmt, 0) == SQLITE_BLOB) 3455 - { 3456 - const unsigned char *g_blob = 3457 - (const unsigned char *) sqlite3_column_blob (stmt, 3458 - 0); 3459 - int g_blob_sz = sqlite3_column_bytes (stmt, 0); 3460 - geom = rl2_geometry_from_blob (g_blob, g_blob_sz); 3461 - } 3462 - } 3463 - } 3464 - sqlite3_finalize (stmt); 3465 - return geom; 3466 -} 3467 - 3468 -static rl2GeometryPtr 3469 -do_generalize_ring (sqlite3 * handle, rl2RingPtr ring, double generalize_factor) 3470 -{ 3471 -/* simplifying a Ring */ 3472 - rl2GeometryPtr geom = NULL; 3473 - unsigned char *blob; 3474 - int blob_sz; 3475 - const char *sql; 3476 - int ret; 3477 - sqlite3_stmt *stmt = NULL; 3478 - 3479 - if (ring == NULL) 3480 - return NULL; 3481 - if (ring->points < 2) 3482 - return NULL; 3483 - if (!rl2_serialize_ring (ring, &blob, &blob_sz)) 3484 - return NULL; 3485 - 3486 - sql = "SELECT ST_SimplifyPreserveTopology(?, ?)"; 3487 - ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); 3488 - if (ret != SQLITE_OK) 3489 - return NULL; 3490 - 3491 - sqlite3_reset (stmt); 3492 - sqlite3_clear_bindings (stmt); 3493 - sqlite3_bind_blob (stmt, 1, blob, blob_sz, free); 3494 - sqlite3_bind_double (stmt, 2, generalize_factor); 3495 - while (1) 3496 - { 3497 - /* scrolling the result set rows */ 3498 - ret = sqlite3_step (stmt); 3499 - if (ret == SQLITE_DONE) 3500 - break; /* end of result set */ 3501 - if (ret == SQLITE_ROW) 3502 - { 3503 - if (sqlite3_column_type (stmt, 0) == SQLITE_BLOB) 3504 - { 3505 - const unsigned char *g_blob = 3506 - (const unsigned char *) sqlite3_column_blob (stmt, 3507 - 0); 3508 - int g_blob_sz = sqlite3_column_bytes (stmt, 0); 3509 - geom = rl2_geometry_from_blob (g_blob, g_blob_sz); 3510 - } 3511 - } 3512 - } 3513 - sqlite3_finalize (stmt); 3514 - return geom; 3515 -} 3516 - 3517 -static int 3518 -check_valid_line (rl2LinestringPtr line) 3519 -{ 3520 -/* testing for a valid linestring */ 3521 - int iv; 3522 - int pts = 0; 3523 - double x; 3524 - double y; 3525 - double x0; 3526 - double y0; 3527 - 3528 - if (line == NULL) 3529 - return 0; 3530 - if (line->points < 2) 3531 - return 0; 3532 - rl2GetPoint (line->coords, 0, &x0, &y0); 3533 - for (iv = 1; iv < line->points; iv++) 3534 - { 3535 - rl2GetPoint (line->coords, iv, &x, &y); 3536 - if (x != x0 || y != y0) 3537 - { 3538 - pts++; 3539 - break; 3540 - } 3541 - } 3542 - if (pts == 0) 3543 - return 0; 3544 - return 1; 3545 -} 3546 - 3547 -static rl2GeometryPtr 3548 -do_offset_linestring (sqlite3 * handle, rl2LinestringPtr line, 3549 - double perpendicular_offset) 3550 -{ 3551 -/* Offest Curve (from Linestring) */ 3552 - rl2GeometryPtr geom = NULL; 3553 - unsigned char *blob; 3554 - int blob_sz; 3555 - const char *sql; 3556 - int ret; 3557 - sqlite3_stmt *stmt = NULL; 3558 - 3559 - if (!check_valid_line (line)) 3560 - return NULL; 3561 - if (!rl2_serialize_linestring (line, &blob, &blob_sz)) 3562 - return NULL; 3563 - 3564 - sql = "SELECT ST_OffsetCurve(?, ?)"; 3565 - ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); 3566 - if (ret != SQLITE_OK) 3567 - return NULL; 3568 - 3569 - sqlite3_reset (stmt); 3570 - sqlite3_clear_bindings (stmt); 3571 - sqlite3_bind_blob (stmt, 1, blob, blob_sz, free); 3572 - sqlite3_bind_double (stmt, 2, perpendicular_offset); 3573 - while (1) 3574 - { 3575 - /* scrolling the result set rows */ 3576 - ret = sqlite3_step (stmt); 3577 - if (ret == SQLITE_DONE) 3578 - break; /* end of result set */ 3579 - if (ret == SQLITE_ROW) 3580 - { 3581 - if (sqlite3_column_type (stmt, 0) == SQLITE_BLOB) 3582 - { 3583 - const unsigned char *g_blob = 3584 - (const unsigned char *) sqlite3_column_blob (stmt, 3585 - 0); 3586 - int g_blob_sz = sqlite3_column_bytes (stmt, 0); 3587 - geom = rl2_geometry_from_blob (g_blob, g_blob_sz); 3588 - } 3589 - } 3590 - } 3591 - sqlite3_finalize (stmt); 3592 - return geom; 3593 -} 3594 - 3595 -static int 3596 -check_valid_ring (rl2RingPtr ring) 3597 -{ 3598 -/* testing for a valid ring */ 3599 - int iv; 3600 - int pts = 0; 3601 - int last; 3602 - double x; 3603 - double y; 3604 - double x0; 3605 - double y0; 3606 - double x1; 3607 - double y1; 3608 - 3609 - if (ring == NULL) 3610 - return 0; 3611 - if (ring->points < 4) 3612 - return 0; 3613 - rl2GetPoint (ring->coords, 0, &x0, &y0); 3614 - for (iv = 1; iv < ring->points; iv++) 3615 - { 3616 - rl2GetPoint (ring->coords, iv, &x, &y); 3617 - if (pts == 0) 3618 - { 3619 - if (x != x0 || y != y0) 3620 - { 3621 - pts++; 3622 - x1 = x; 3623 - y1 = y; 3624 - } 3625 - } 3626 - else 3627 - { 3628 - if ((x != x0 || y != y0) && (x != x1 || y != y1)) 3629 - { 3630 - pts++; 3631 - break; 3632 - } 3633 - } 3634 - } 3635 - last = ring->points - 1; 3636 - rl2GetPoint (ring->coords, last, &x1, &y1); 3637 - if (pts == 2 && x0 == x1 && y0 == y1) 3638 - return 1; 3639 - return 0; 3640 -} 3641 - 3642 -static rl2GeometryPtr 3643 -do_buffered_ring (sqlite3 * handle, rl2RingPtr ring, 3644 - double perpendicular_offset) 3645 -{ 3646 -/* Buffer (from Ring) */ 3647 - rl2GeometryPtr geom = NULL; 3648 - unsigned char *blob; 3649 - int blob_sz; 3650 - const char *sql; 3651 - int ret; 3652 - sqlite3_stmt *stmt = NULL; 3653 - 3654 - if (!check_valid_ring (ring)) 3655 - return NULL; 3656 - if (!rl2_serialize_ring (ring, &blob, &blob_sz)) 3657 - return NULL; 3658 - 3659 - sql = "SELECT ST_Buffer(?, ?)"; 3660 - ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); 3661 - if (ret != SQLITE_OK) 3662 - return NULL; 3663 - 3664 - sqlite3_reset (stmt); 3665 - sqlite3_clear_bindings (stmt); 3666 - sqlite3_bind_blob (stmt, 1, blob, blob_sz, free); 3667 - sqlite3_bind_double (stmt, 2, perpendicular_offset); 3668 - while (1) 3669 - { 3670 - /* scrolling the result set rows */ 3671 - ret = sqlite3_step (stmt); 3672 - if (ret == SQLITE_DONE) 3673 - break; /* end of result set */ 3674 - if (ret == SQLITE_ROW) 3675 - { 3676 - if (sqlite3_column_type (stmt, 0) == SQLITE_BLOB) 3677 - { 3678 - const unsigned char *g_blob = 3679 - (const unsigned char *) sqlite3_column_blob (stmt, 3680 - 0); 3681 - int g_blob_sz = sqlite3_column_bytes (stmt, 0); 3682 - geom = rl2_geometry_from_blob (g_blob, g_blob_sz); 3683 - } 3684 - } 3685 - } 3686 - sqlite3_finalize (stmt); 3687 - return geom; 3688 -} 3689 - 3690 -static void 3691 -create_line_array_from_linestring (sqlite3 * handle, rl2LinestringPtr line, 3692 - double perpendicular_offset, int *points, 3693 - double **x_array, double **y_array, 3694 - int generalize_line, 3695 - double generalize_factor, int height, 3696 - double minx, double miny, double x_res, 3697 - double y_res) 3698 -{ 3699 -/* creating the X and Y arrays required by rl2_graph_draw_warped_text() */ 3700 - rl2GeometryPtr geom = NULL; 3701 - rl2GeometryPtr geom2 = NULL; 3702 - rl2LinestringPtr aux_line; 3703 - rl2LinestringPtr in_line; 3704 - double *xx = NULL; 3705 - double *yy = NULL; 3706 - int iv; 3707 - double x; 3708 - double y; 3709 - 3710 - *points = 0; 3711 - *x_array = NULL; 3712 - *y_array = NULL; 3713 - if (line == NULL) 3714 - goto error; 3715 - 3716 - aux_line = rl2_linestring_to_image (line, height, minx, miny, x_res, y_res); 3717 - if (aux_line == NULL) 3718 - goto error; 3719 - in_line = aux_line; 3720 - if (generalize_line) 3721 - { 3722 - geom = do_generalize_linestring (handle, in_line, generalize_factor); 3723 - if (geom == NULL) 3724 - goto error; 3725 - in_line = geom->first_linestring; 3726 - if (in_line == NULL) 3727 - goto error; 3728 - } 3729 - if (perpendicular_offset != 0.0) 3730 - { 3731 - geom2 = do_offset_linestring (handle, in_line, perpendicular_offset); 3732 - if (geom2 == NULL) 3733 - goto error; 3734 - in_line = geom2->first_linestring; 3735 - if (in_line == NULL) 3736 - goto error; 3737 - } 3738 - 3739 -/* allocating the X and Y arrays */ 3740 - if (in_line->points < 2) 3741 - goto error; 3742 - xx = malloc (sizeof (double) * in_line->points); 3743 - yy = malloc (sizeof (double) * in_line->points); 3744 - if (xx == NULL || yy == NULL) 3745 - { 3746 - if (xx != NULL) 3747 - free (xx); 3748 - if (yy != NULL) 3749 - free (yy); 3750 - goto error; 3751 - } 3752 - for (iv = 0; iv < in_line->points; iv++) 3753 - { 3754 - /* populating the X and Y arrays */ 3755 - rl2GetPoint (in_line->coords, iv, &x, &y); 3756 - *(xx + iv) = x; 3757 - *(yy + iv) = y; 3758 - } 3759 - *points = in_line->points; 3760 - *x_array = xx; 3761 - *y_array = yy; 3762 - 3763 - error: 3764 - if (aux_line) 3765 - rl2DestroyLinestring (aux_line); 3766 - if (geom) 3767 - rl2_destroy_geometry (geom); 3768 - if (geom2) 3769 - rl2_destroy_geometry (geom2); 3770 -} 3771 - 3772 -static void 3773 -create_line_array_from_ring (sqlite3 * handle, rl2RingPtr ring, 3774 - double perpendicular_offset, int *points, 3775 - double **x_array, double **y_array, 3776 - int generalize_line, double generalize_factor, 3777 - int height, double minx, double miny, double x_res, 3778 - double y_res) 3779 -{ 3780 -/* creating the X and Y arrays required by rl2_graph_draw_warped_text() */ 3781 - rl2GeometryPtr geom = NULL; 3782 - rl2GeometryPtr geom2 = NULL; 3783 - rl2PolygonPtr pg; 3784 - rl2RingPtr aux_ring; 3785 - rl2RingPtr in_ring; 3786 - double *xx = NULL; 3787 - double *yy = NULL; 3788 - int iv; 3789 - double x; 3790 - double y; 3791 - 3792 - *points = 0; 3793 - *x_array = NULL; 3794 - *y_array = NULL; 3795 - if (ring == NULL) 3796 - goto error; 3797 - 3798 - aux_ring = rl2_ring_to_image (ring, height, minx, miny, x_res, y_res); 3799 - if (aux_ring == NULL) 3800 - goto error; 3801 - in_ring = aux_ring; 3802 - if (generalize_line) 3803 - { 3804 - geom = do_generalize_ring (handle, in_ring, generalize_factor); 3805 - if (geom == NULL) 3806 - goto error; 3807 - pg = geom->first_polygon; 3808 - if (pg == NULL) 3809 - goto error; 3810 - in_ring = pg->exterior; 3811 - if (in_ring == NULL) 3812 - goto error; 3813 - } 3814 - if (perpendicular_offset != 0.0) 3815 - { 3816 - geom2 = do_buffered_ring (handle, in_ring, perpendicular_offset); 3817 - if (geom2 == NULL) 3818 - goto error; 3819 - pg = geom2->first_polygon; 3820 - if (pg == NULL) 3821 - goto error; 3822 - in_ring = pg->exterior; 3823 - if (in_ring == NULL) 3824 - goto error; 3825 - } 3826 - 3827 -/* allocating the X and Y arrays */ 3828 - if (in_ring->points < 2) 3829 - goto error; 3830 - xx = malloc (sizeof (double) * in_ring->points); 3831 - yy = malloc (sizeof (double) * in_ring->points); 3832 - if (xx == NULL || yy == NULL) 3833 - { 3834 - if (xx != NULL) 3835 - free (xx); 3836 - if (yy != NULL) 3837 - free (yy); 3838 - goto error; 3839 - } 3840 - for (iv = 0; iv < in_ring->points; iv++) 3841 - { 3842 - /* populating the X and Y arrays */ 3843 - rl2GetPoint (in_ring->coords, iv, &x, &y); 3844 - *(xx + iv) = x; 3845 - *(yy + iv) = y; 3846 - } 3847 - *points = in_ring->points; 3848 - *x_array = xx; 3849 - *y_array = yy; 3850 - 3851 - error: 3852 - if (aux_ring) 3853 - rl2DestroyRing (aux_ring); 3854 - if (geom) 3855 - rl2_destroy_geometry (geom); 3856 - if (geom2) 3857 - rl2_destroy_geometry (geom2); 3858 -} 3859 - 3860 3126 static void 3861 3127 draw_labels (rl2GraphicsContextPtr ctx, sqlite3 * handle, 3862 - const void *priv_data, rl2PrivTextSymbolizerPtr sym, int height, 3863 - double minx, double miny, double maxx, double maxy, double x_res, 3864 - double y_res, rl2GeometryPtr geom, rl2PrivVariantValuePtr value) 3128 + rl2PrivTextSymbolizerPtr sym, int height, double minx, double miny, 3129 + double x_res, double y_res, rl2GeometryPtr geom, 3130 + rl2PrivVariantValuePtr value) 3865 3131 { 3866 3132 /* drawing TextLabels */ 3867 3133 rl2GraphicsFontPtr font = NULL; 3868 3134 char *dummy = NULL; 3869 3135 const char *label = NULL; 3870 3136 int font_style; 3871 3137 int font_weight; 3872 3138 double opacity; 3873 3139 unsigned char norm_opacity; 3874 3140 rl2PointPtr point; 3875 3141 rl2LinestringPtr line; 3876 3142 rl2PolygonPtr polyg; 3877 - double rotation = 0.0; 3878 - double anchor_point_x = 0.0; 3879 - double anchor_point_y = 0.0; 3880 - double displacement_x = 0.0; 3881 - double displacement_y = 0.0; 3882 - double perpendicular_offset = 0.0; 3883 - int is_repeated = 0; 3884 - double initial_gap = 0.0; 3885 - double gap = 0.0; 3886 - int is_aligned = 0; 3887 - int generalize_line = 0; 3888 - int i; 3889 3143 3890 3144 /* preparing the Text */ 3891 3145 if (value->sqlite3_type == SQLITE_INTEGER) 3892 3146 { 3893 3147 dummy = sqlite3_malloc (1024); 3894 3148 #if defined(_WIN32) && !defined(__MINGW32__) 3895 3149 sprintf (dummy, "%I64d", value->int_value); ................................................................................ 3928 3182 font_weight = RL2_FONTWEIGHT_BOLD; 3929 3183 break; 3930 3184 case RL2_FONT_WEIGHT_NORMAL: 3931 3185 default: 3932 3186 font_weight = RL2_FONTWEIGHT_NORMAL; 3933 3187 break; 3934 3188 }; 3935 - for (i = 0; i < RL2_MAX_FONT_FAMILIES; i++) 3936 - { 3937 - const char *facename = sym->font_families[i]; 3938 - if (facename != NULL) 3939 - font = 3940 - rl2_search_TrueType_font (handle, priv_data, facename, 3941 - sym->font_size); 3942 - if (font != NULL) 3943 - break; 3944 - } 3945 - if (font == NULL) 3946 - { 3947 - /* defaulting to a toy font */ 3948 - fprintf (stderr, "default toy font\n"); 3949 - font = 3950 - rl2_graph_create_toy_font (NULL, sym->font_size, font_style, 3951 - font_weight); 3952 - } 3189 + font = 3190 + rl2_graph_create_toy_font (NULL, sym->font_size, font_style, 3191 + font_weight); 3953 3192 if (font == NULL) 3954 3193 goto stop; 3955 3194 if (sym->fill != NULL) 3956 3195 { 3957 3196 if (sym->fill->opacity <= 0.0) 3958 3197 norm_opacity = 0; 3959 3198 else if (sym->fill->opacity >= 1.0) ................................................................................ 3984 3223 norm_opacity = 0; 3985 3224 else if (opacity >= 255.0) 3986 3225 norm_opacity = 255; 3987 3226 else 3988 3227 norm_opacity = opacity; 3989 3228 } 3990 3229 rl2_graph_font_set_halo (font, sym->halo->radius, 3991 - sym->halo->fill->red, 3992 - sym->halo->fill->green, 3230 + sym->halo->fill->red, sym->halo->fill->green, 3993 3231 sym->halo->fill->blue, norm_opacity); 3994 3232 } 3995 3233 rl2_graph_set_font (ctx, font); 3996 3234 3997 - if (sym->label_placement_type == RL2_LABEL_PLACEMENT_POINT) 3998 - { 3999 - /* retrieving eventual Point Placement arguments */ 4000 - rl2PrivPointPlacementPtr ptpl = 4001 - (rl2PrivPointPlacementPtr) (sym->label_placement); 4002 - if (ptpl != NULL) 4003 - { 4004 - anchor_point_x = ptpl->anchor_point_x; 4005 - anchor_point_y = ptpl->anchor_point_y; 4006 - displacement_x = ptpl->displacement_x; 4007 - displacement_y = ptpl->displacement_y; 4008 - rotation = ptpl->rotation; 4009 - } 4010 - } 4011 - else if (sym->label_placement_type == RL2_LABEL_PLACEMENT_LINE) 3235 + polyg = geom->first_polygon; 3236 + while (polyg) 4012 3237 { 4013 - /* retrieving eventual Lineo Placement arguments */ 4014 - rl2PrivLinePlacementPtr lnpl = 4015 - (rl2PrivLinePlacementPtr) (sym->label_placement); 4016 - if (lnpl != NULL) 4017 - { 4018 - perpendicular_offset = lnpl->perpendicular_offset; 4019 - is_repeated = lnpl->is_repeated; 4020 - initial_gap = lnpl->initial_gap; 4021 - gap = lnpl->gap; 4022 - is_aligned = lnpl->is_aligned; 4023 - generalize_line = lnpl->generalize_line; 4024 - } 4025 - } 4026 - 4027 - if (sym->label_placement_type == RL2_LABEL_PLACEMENT_POINT) 4028 - { 4029 - /* POINT PLACEMENT */ 4030 - rl2Point pt; 3238 + /* drawing a POLYGON-based text label */ 3239 + double pre_x; 3240 + double pre_y; 3241 + double lbl_width = 0.0; 3242 + double lbl_height = 0.0; 3243 + double post_x; 3244 + double post_y; 3245 + double shift_x; 3246 + double shift_y; 4031 3247 double cx; 4032 3248 double cy; 4033 3249 double x; 4034 3250 double y; 4035 - 4036 - polyg = geom->first_polygon; 4037 - while (polyg) 3251 + if (!label_get_centroid (handle, polyg, &cx, &cy)) 4038 3252 { 4039 - /* drawing a POLYGON-based text label */ 4040 - if (!label_get_centroid (handle, polyg, &cx, &cy)) 4041 - { 4042 - polyg = polyg->next; 4043 - continue; 4044 - } 4045 - pt.x = cx; 4046 - pt.y = cy; 4047 - if (point_bbox_matches (&pt, minx, miny, maxx, maxy)) 4048 - { 4049 - x = (cx - minx) / x_res; 4050 - y = (double) height - ((cy - miny) / y_res); 4051 - rl2_graph_draw_text (ctx, label, x + displacement_x, 4052 - y - displacement_y, rotation, 4053 - anchor_point_x, anchor_point_y); 4054 - } 4055 3253 polyg = polyg->next; 3254 + continue; 4056 3255 } 3256 + x = (cx - minx) / x_res; 3257 + y = (double) height - ((cy - miny) / y_res); 3258 + rl2_graph_get_text_extent (ctx, label, &pre_x, &pre_y, &lbl_width, 3259 + &lbl_height, &post_x, &post_y); 3260 + shift_x = 0.0 - (lbl_width / 2.0); 3261 + shift_y = 0.0 + (lbl_height / 2.0); 3262 + rl2_graph_draw_text (ctx, label, x + shift_x, y + shift_y, 0.0, 0.0, 3263 + 0.0); 3264 + polyg = polyg->next; 3265 + } 4057 3266 4058 - line = geom->first_linestring; 4059 - while (line) 4060 - { 4061 - /* drawing a LINESTRING-based text label */ 4062 - label_get_midpoint (handle, line, &cx, &cy); 4063 - pt.x = cx; 4064 - pt.y = cy; 4065 - if (point_bbox_matches (&pt, minx, miny, maxx, maxy)) 4066 - { 4067 - x = (cx - minx) / x_res; 4068 - y = (double) height - ((cy - miny) / y_res); 4069 - rl2_graph_draw_text (ctx, label, x + displacement_x, 4070 - y - displacement_y, rotation, 4071 - anchor_point_x, anchor_point_y); 4072 - } 4073 - line = line->next; 4074 - } 4075 - 4076 - point = geom->first_point; 4077 - while (point) 4078 - { 4079 - /* drawing a POINT-based text label */ 4080 - if (point_bbox_matches (point, minx, miny, maxx, maxy)) 4081 - { 4082 - double x = (point->x - minx) / x_res; 4083 - double y = (double) height - ((point->y - miny) / y_res); 4084 - rl2_graph_draw_text (ctx, label, x + displacement_x, 4085 - y - displacement_y, rotation, 4086 - anchor_point_x, anchor_point_y); 4087 - } 4088 - point = point->next; 4089 - } 4090 - 4091 - } 4092 - else if (sym->label_placement_type == RL2_LABEL_PLACEMENT_LINE) 3267 + line = geom->first_linestring; 3268 + while (line) 4093 3269 { 4094 - /* LINE PLACEMENT */ 4095 - rl2Point pt; 4096 - int ib; 3270 + /* drawing a LINESTRING-based text label */ 3271 + double pre_x; 3272 + double pre_y; 3273 + double lbl_width = 0.0; 3274 + double lbl_height = 0.0; 3275 + double post_x; 3276 + double post_y; 3277 + double shift_x; 3278 + double shift_y; 4097 3279 double cx; 4098 3280 double cy; 4099 3281 double x; 4100 3282 double y; 4101 - double generalize_factor = 8.0; 4102 - 4103 - line = geom->first_linestring; 4104 - while (line) 3283 + label_get_midpoint (handle, line, &cx, &cy); 3284 + if (!rl2_graph_get_text_extent 3285 + (ctx, label, &pre_x, &pre_y, &lbl_width, &lbl_height, &post_x, 3286 + &post_y)) 4105 3287 { 4106 - /* drawing a LINESTRING-based text label */ 4107 - if (!is_aligned) 4108 - { 4109 - /* horizontal label aligned to center point */ 4110 - label_get_midpoint (handle, line, &cx, &cy); 4111 - pt.x = cx; 4112 - pt.y = cy; 4113 - if (point_bbox_matches (&pt, minx, miny, maxx, maxy)) 4114 - { 4115 - x = (cx - minx) / x_res; 4116 - y = (double) height - ((cy - miny) / y_res); 4117 - rl2_graph_draw_text (ctx, label, x, y, 0.0, 0.5, 4118 - 0.5); 4119 - } 4120 - } 4121 - else 4122 - { 4123 - /* label is warped along the line */ 4124 - double *x_array = NULL; 4125 - double *y_array = NULL; 4126 - int points; 4127 - if (linestring_bbox_matches 4128 - (line, minx, miny, maxx, maxy)) 4129 - { 4130 - create_line_array_from_linestring (handle, line, 4131 - perpendicular_offset, 4132 - &points, 4133 - &x_array, 4134 - &y_array, 4135 - generalize_line, 4136 - generalize_factor, 4137 - height, minx, 4138 - miny, x_res, 4139 - y_res); 4140 - if (x_array != NULL && y_array != NULL) 4141 - rl2_graph_draw_warped_text (handle, ctx, label, 4142 - points, x_array, 4143 - y_array, 4144 - initial_gap, gap, 4145 - is_repeated); 4146 - if (x_array) 4147 - free (x_array); 4148 - if (y_array) 4149 - free (y_array); 4150 - } 4151 - } 4152 3288 line = line->next; 3289 + continue; 4153 3290 } 3291 + x = (cx - minx) / x_res; 3292 + y = (double) height - ((cy - miny) / y_res); 3293 + shift_x = 0.0 - (lbl_width / 2.0); 3294 + shift_y = 0.0 + (lbl_height / 2.0); 3295 + rl2_graph_draw_text (ctx, label, x + shift_x, y + shift_y, 0.0, 0.0, 3296 + 0.0); 3297 + line = line->next; 3298 + } 4154 3299 4155 - polyg = geom->first_polygon; 4156 - while (polyg) 4157 - { 4158 - /* drawing a POLYGON-based text label */ 4159 - rl2RingPtr ring = polyg->exterior; 4160 - /* exterior border */ 4161 - if (ring_bbox_matches (ring, minx, miny, maxx, maxy)) 4162 - { 4163 - if (!is_aligned) 4164 - { 4165 - /* horizontal label aligned to Ring's center point */ 4166 - label_get_ring_midpoint (handle, ring, &cx, &cy); 4167 - pt.x = cx; 4168 - pt.y = cy; 4169 - if (point_bbox_matches 4170 - (&pt, minx, miny, maxx, maxy)) 4171 - { 4172 - x = (cx - minx) / x_res; 4173 - y = (double) height - ((cy - miny) / y_res); 4174 - rl2_graph_draw_text (ctx, label, x, y, 0.0, 4175 - 0.5, 0.5); 4176 - } 4177 - } 4178 - else 4179 - { 4180 - /* label is warped along the Ring */ 4181 - double *x_array = NULL; 4182 - double *y_array = NULL; 4183 - int points; 4184 - if (ring_bbox_matches 4185 - (ring, minx, miny, maxx, maxy)) 4186 - { 4187 - create_line_array_from_ring (handle, ring, 4188 - perpendicular_offset, 4189 - &points, 4190 - &x_array, 4191 - &y_array, 4192 - generalize_line, 4193 - generalize_factor, 4194 - height, minx, 4195 - miny, x_res, 4196 - y_res); 4197 - if (x_array != NULL && y_array != NULL) 4198 - { 4199 - rl2_graph_draw_warped_text (handle, ctx, 4200 - label, 4201 - points, 4202 - x_array, 4203 - y_array, 4204 - initial_gap, 4205 - gap, 4206 - is_repeated); 4207 - } 4208 - if (x_array) 4209 - free (x_array); 4210 - if (y_array) 4211 - free (y_array); 4212 - } 4213 - } 4214 - } 4215 - else 4216 - { 4217 - /* if the exterior ring is invisible we'll ignore all internal rings */ 4218 - polyg = polyg->next; 4219 - continue; 4220 - } 4221 - for (ib = 0; ib < polyg->num_interiors; ib++) 4222 - { 4223 - /* interior borders */ 4224 - ring = polyg->interiors + ib; 4225 - if (ring_bbox_matches (ring, minx, miny, maxx, maxy)) 4226 - { 4227 - if (!is_aligned) 4228 - { 4229 - /* horizontal label aligned to Ring's center point */ 4230 - label_get_ring_midpoint (handle, ring, &cx, 4231 - &cy); 4232 - pt.x = cx; 4233 - pt.y = cy; 4234 - if (point_bbox_matches 4235 - (&pt, minx, miny, maxx, maxy)) 4236 - { 4237 - x = (cx - minx) / x_res; 4238 - y = (double) height - 4239 - ((cy - miny) / y_res); 4240 - rl2_graph_draw_text (ctx, label, x, y, 4241 - 0.0, 0.5, 0.5); 4242 - } 4243 - } 4244 - else 4245 - { 4246 - /* label is warped along the Ring */ 4247 - double *x_array = NULL; 4248 - double *y_array = NULL; 4249 - int points; 4250 - if (ring_bbox_matches 4251 - (ring, minx, miny, maxx, maxy)) 4252 - { 4253 - create_line_array_from_ring (handle, 4254 - ring, 4255 - perpendicular_offset, 4256 - &points, 4257 - &x_array, 4258 - &y_array, 4259 - generalize_line, 4260 - generalize_factor, 4261 - height, 4262 - minx, miny, 4263 - x_res, 4264 - y_res); 4265 - if (x_array != NULL && y_array != NULL) 4266 - rl2_graph_draw_warped_text (handle, 4267 - ctx, 4268 - label, 4269 - points, 4270 - x_array, 4271 - y_array, 4272 - initial_gap, 4273 - gap, 4274 - is_repeated); 4275 - if (x_array) 4276 - free (x_array); 4277 - if (y_array) 4278 - free (y_array); 4279 - } 4280 - } 4281 - } 4282 - } 4283 - polyg = polyg->next; 4284 - } 3300 + point = geom->first_point; 3301 + while (point) 3302 + { 3303 + /* drawing a POINT-based text label */ 3304 + double pre_x; 3305 + double pre_y; 3306 + double lbl_width = 0.0; 3307 + double lbl_height = 0.0; 3308 + double post_x; 3309 + double post_y; 3310 + double shift_x; 3311 + double shift_y; 3312 + double x = (point->x - minx) / x_res; 3313 + double y = (double) height - ((point->y - miny) / y_res); 3314 + rl2_graph_get_text_extent (ctx, label, &pre_x, &pre_y, &lbl_width, 3315 + &lbl_height, &post_x, &post_y); 3316 + shift_x = 0.0 - (lbl_width / 2.0); 3317 + shift_y = 0.0 + (lbl_height / 2.0); 3318 + rl2_graph_draw_text (ctx, label, x + shift_x, y + shift_y, 0.0, 0.0, 3319 + 0.0); 3320 + point = point->next; 4285 3321 } 4286 3322 4287 3323 /* final cleanup - relasing resources */ 4288 3324 stop: 4289 3325 if (dummy != NULL) 4290 3326 sqlite3_free (dummy); 4291 3327 if (font != NULL) 4292 3328 rl2_graph_destroy_font (font); 4293 3329 } 4294 3330 4295 3331 RL2_PRIVATE void 4296 -rl2_draw_vector_feature (void *p_ctx, sqlite3 * handle, const void *priv_data, 3332 +rl2_draw_vector_feature (void *p_ctx, sqlite3 * handle, 4297 3333 rl2VectorSymbolizerPtr symbolizer, int height, 4298 - double minx, double miny, double maxx, double maxy, 4299 - double x_res, double y_res, rl2GeometryPtr geom, 4300 - rl2VariantArrayPtr variant) 3334 + double minx, double miny, double x_res, double y_res, 3335 + rl2GeometryPtr geom, rl2VariantArrayPtr variant) 4301 3336 { 4302 3337 /* drawing a vector feature on the current canvass */ 4303 3338 rl2PrivVectorSymbolizerItemPtr item; 4304 3339 rl2GraphicsContextPtr ctx = (rl2GraphicsContextPtr) p_ctx; 4305 3340 rl2PrivVectorSymbolizerPtr sym = (rl2PrivVectorSymbolizerPtr) symbolizer; 4306 3341 rl2PrivVectorSymbolizerPtr default_symbolizer = NULL; 4307 3342 ................................................................................ 4384 3419 default_symbolizer->last->next = item; 4385 3420 default_symbolizer->last = item; 4386 3421 sym = default_symbolizer; 4387 3422 } 4388 3423 4389 3424 /* we'll render all geometries first */ 4390 3425 if (geom->first_polygon != NULL) 4391 - draw_polygons (ctx, handle, sym, height, minx, miny, maxx, maxy, 4392 - x_res, y_res, geom); 3426 + draw_polygons (ctx, handle, sym, height, minx, miny, x_res, y_res, 3427 + geom); 4393 3428 if (geom->first_linestring != NULL) 4394 - draw_lines (ctx, handle, sym, height, minx, miny, maxx, maxy, x_res, 4395 - y_res, geom); 3429 + draw_lines (ctx, handle, sym, height, minx, miny, x_res, y_res, geom); 4396 3430 if (geom->first_point != NULL) 4397 - draw_points (ctx, handle, sym, height, minx, miny, maxx, maxy, x_res, 4398 - y_res, geom); 3431 + draw_points (ctx, handle, sym, height, minx, miny, x_res, y_res, geom); 4399 3432 4400 3433 if (sym != NULL) 4401 3434 { 4402 3435 /* then we'll render any eventual TextSymbolizer */ 4403 3436 item = sym->first; 4404 3437 while (item != NULL) 4405 3438 { ................................................................................ 4409 3442 rl2PrivTextSymbolizerPtr text = 4410 3443 (rl2PrivTextSymbolizerPtr) (item->symbolizer); 4411 3444 if (text->label != NULL) 4412 3445 { 4413 3446 int v; 4414 3447 rl2PrivVariantArrayPtr var = 4415 3448 (rl2PrivVariantArrayPtr) variant; 4416 - if (var != NULL) 3449 + for (v = 0; v < var->count; v++) 4417 3450 { 4418 - for (v = 0; v < var->count; v++) 4419 - { 4420 - rl2PrivVariantValuePtr val = 4421 - *(var->array + v); 4422 - if (val == NULL) 4423 - continue; 4424 - if (val->column_name == NULL) 4425 - continue; 4426 - if (strcasecmp 4427 - (text->label, 4428 - val->column_name) != 0) 4429 - continue; 4430 - draw_labels (ctx, handle, priv_data, 4431 - text, height, minx, miny, 4432 - maxx, maxy, x_res, y_res, 4433 - geom, val); 4434 - } 3451 + rl2PrivVariantValuePtr val = 3452 + *(var->array + v); 3453 + if (val == NULL) 3454 + continue; 3455 + if (val->column_name == NULL) 3456 + continue; 3457 + if (strcasecmp (text->label, val->column_name) 3458 + != 0) 3459 + continue; 3460 + draw_labels (ctx, handle, text, height, minx, 3461 + miny, x_res, y_res, geom, val); 4435 3462 } 4436 3463 } 4437 3464 } 4438 3465 item = item->next; 4439 3466 } 4440 3467 } 4441 3468 4442 3469 if (default_symbolizer != NULL) 4443 3470 rl2_destroy_vector_symbolizer (default_symbolizer); 4444 3471 } 4445 - 4446 -RL2_PRIVATE int 4447 -rl2_aux_default_image (unsigned int width, unsigned int height, 4448 - unsigned char red, unsigned char green, 4449 - unsigned char blue, int format, int transparent, 4450 - int quality, unsigned char **ximage, int *ximage_sz) 4451 -{ 4452 -/* creating a default image */ 4453 - unsigned int x; 4454 - unsigned int y; 4455 - unsigned char *pixels = malloc (width * height * 3); 4456 - unsigned char *po = pixels; 4457 - unsigned char *mask = NULL; 4458 - unsigned char *pm; 4459 - 4460 - *ximage = NULL; 4461 - *ximage_sz = 0; 4462 - if (pixels == NULL) 4463 - return 0; 4464 - 4465 - mask = malloc (width * height); 4466 - if (mask == NULL) 4467 - goto error; 4468 - pm = mask; 4469 - 4470 -/* priming the image buffer to background color */ 4471 - for (y = 0; y < height; y++) 4472 - { 4473 - for (x = 0; x < width; x++) 4474 - { 4475 - *po++ = red; 4476 - *po++ = green; 4477 - *po++ = blue; 4478 - if (mask != NULL) 4479 - *pm++ = 0; 4480 - } 4481 - } 4482 - 4483 - if (format == RL2_OUTPUT_FORMAT_PNG) 4484 - { 4485 - if (transparent) 4486 - { 4487 - if (rl2_rgb_alpha_to_png 4488 - (width, height, pixels, mask, ximage, ximage_sz, 4489 - 1.0) != RL2_OK) 4490 - goto error; 4491 - } 4492 - else 4493 - { 4494 - if (rl2_rgb_to_png (width, height, pixels, ximage, ximage_sz) 4495 - != RL2_OK) 4496 - goto error; 4497 - } 4498 - } 4499 - else if (format == RL2_OUTPUT_FORMAT_JPEG) 4500 - { 4501 - if (rl2_rgb_to_jpeg 4502 - (width, height, pixels, quality, ximage, ximage_sz) != RL2_OK) 4503 - goto error; 4504 - } 4505 - else if (format == RL2_OUTPUT_FORMAT_TIFF) 4506 - { 4507 - if (rl2_rgb_to_tiff (width, height, pixels, ximage, ximage_sz) != 4508 - RL2_OK) 4509 - goto error; 4510 - } 4511 - else 4512 - goto error; 4513 - free (pixels); 4514 - if (mask != NULL) 4515 - free (mask); 4516 - return 1; 4517 - 4518 - error: 4519 - if (pixels != NULL) 4520 - free (pixels); 4521 - if (mask != NULL) 4522 - free (mask); 4523 - return 0; 4524 -}
Changes to src/rl2charls.c.
52 52 #endif 53 53 54 54 #include "rasterlite2/rasterlite2.h" 55 55 #include "rasterlite2_private.h" 56 56 57 57 #ifndef OMIT_CHARLS /* only if CharLS is enabled */ 58 58 59 -#ifdef __ANDROID__ /* Android specific */ 60 -#include <interface.h> 61 -#else 62 59 #include <CharLS/interface.h> 63 -#endif 64 60 65 61 static int 66 62 endianness () 67 63 { 68 64 /* checking if target CPU is a little-endian one */ 69 65 union cvt 70 66 { ................................................................................ 282 278 p_out += num_bands; 283 279 } 284 280 } 285 281 } 286 282 } 287 283 288 284 static void 289 -from_ilv_buffer_8 (unsigned char *out, unsigned char *in, int width, 290 - int height, int num_bands) 285 +from_ilv_buffer_8 (unsigned char *out, unsigned char *in, int width, int height, 286 + int num_bands) 291 287 { 292 288 /* rearranging pixels from separate LINE components - UINT 8 */ 293 289 int x; 294 290 int y; 295 291 int ib; 296 292 unsigned char *p_in = in; 297 293 ................................................................................ 453 449 { 454 450 if (*sample_type == RL2_SAMPLE_UINT16) 455 451 from_ilv_buffer_16 ((unsigned short *) (*pixels), 456 452 (unsigned short *) out_buffer, *width, 457 453 *height, *num_bands); 458 454 else 459 455 from_ilv_buffer_8 ((unsigned char *) (*pixels), 460 - (unsigned char *) out_buffer, *width, 461 - *height, *num_bands); 456 + (unsigned char *) out_buffer, *width, *height, 457 + *num_bands); 462 458 } 463 459 free (out_buffer); 464 460 return RL2_OK; 465 461 466 462 error: 467 463 if (out_buffer != NULL) 468 464 free (out_buffer); 469 465 return RL2_ERROR; 470 466 } 471 467 472 468 #endif /* end CharLS conditional */
Changes to src/rl2codec.c.
2018 2018 *pixels_even = pix_even; 2019 2019 *size_odd = o_size; 2020 2020 *size_even = e_size; 2021 2021 return 1; 2022 2022 } 2023 2023 2024 2024 RL2_DECLARE int 2025 -rl2_raster_encode (rl2RasterPtr rst, int compression, 2026 - unsigned char **blob_odd, int *blob_odd_sz, 2027 - unsigned char **blob_even, int *blob_even_sz, int quality, 2028 - int little_endian) 2025 +rl2_raster_encode (rl2RasterPtr rst, int compression, unsigned char **blob_odd, 2026 + int *blob_odd_sz, unsigned char **blob_even, 2027 + int *blob_even_sz, int quality, int little_endian) 2029 2028 { 2030 2029 /* encoding a Raster into the internal RL2 binary format */ 2031 2030 rl2PrivRasterPtr raster = (rl2PrivRasterPtr) rst; 2032 2031 int odd_rows; 2033 2032 unsigned char *pixels_odd = NULL; 2034 2033 int size_odd; 2035 2034 int even_rows = 0; ................................................................................ 2123 2122 || compression == RL2_COMPRESSION_LZMA_NO) 2124 2123 { 2125 2124 /* preparing the pixels buffers */ 2126 2125 if (raster->sampleType == RL2_SAMPLE_1_BIT) 2127 2126 { 2128 2127 /* packing 1-BIT data */ 2129 2128 if (!pack_1bit_rows 2130 - (raster, raster->rasterBuffer, &row_stride_odd, 2131 - &pixels_odd, &size_odd)) 2129 + (raster, raster->rasterBuffer, &row_stride_odd, &pixels_odd, 2130 + &size_odd)) 2132 2131 return RL2_ERROR; 2133 2132 odd_rows = raster->height; 2134 2133 } 2135 2134 else if (raster->sampleType == RL2_SAMPLE_2_BIT) 2136 2135 { 2137 2136 /* packing 2-BIT data */ 2138 2137 if (!pack_2bit_rows ................................................................................ 2148 2147 return RL2_ERROR; 2149 2148 odd_rows = raster->height; 2150 2149 } 2151 2150 else 2152 2151 { 2153 2152 /* Odd/Even raster */ 2154 2153 if (!odd_even_rows 2155 - (raster, &odd_rows, &row_stride_odd, &pixels_odd, 2156 - &size_odd, &even_rows, &row_stride_even, &pixels_even, 2157 - &size_even, little_endian)) 2154 + (raster, &odd_rows, &row_stride_odd, &pixels_odd, &size_odd, 2155 + &even_rows, &row_stride_even, &pixels_even, &size_even, 2156 + little_endian)) 2158 2157 return RL2_ERROR; 2159 2158 } 2160 2159 } 2161 2160 else if (compression == RL2_COMPRESSION_PNG) 2162 2161 { 2163 2162 if (raster->sampleType == RL2_SAMPLE_1_BIT 2164 2163 || raster->sampleType == RL2_SAMPLE_2_BIT ................................................................................ 2166 2165 { 2167 2166 /* no special action is required */ 2168 2167 } 2169 2168 else 2170 2169 { 2171 2170 /* Odd/Even raster */ 2172 2171 if (!odd_even_rows 2173 - (raster, &odd_rows, &row_stride_odd, &pixels_odd, 2174 - &size_odd, &even_rows, &row_stride_even, &pixels_even, 2175 - &size_even, little_endian)) 2172 + (raster, &odd_rows, &row_stride_odd, &pixels_odd, &size_odd, 2173 + &even_rows, &row_stride_even, &pixels_even, &size_even, 2174 + little_endian)) 2176 2175 return RL2_ERROR; 2177 2176 } 2178 2177 } 2179 2178 else if (compression == RL2_COMPRESSION_CHARLS) 2180 2179 { 2181 2180 /* Odd/Even raster */ 2182 2181 if (!odd_even_rows ................................................................................ 2468 2467 goto error; 2469 2468 #endif /* end WebP conditional */ 2470 2469 } 2471 2470 else if (compression == RL2_COMPRESSION_LOSSY_WEBP) 2472 2471 { 2473 2472 #ifndef OMIT_WEBP /* only if WebP is enabled */ 2474 2473 /* compressing as lossy WEBP */ 2475 - if (rl2_raster_to_lossy_webp 2476 - (rst, &compr_data, &compressed, quality) == RL2_OK) 2474 + if (rl2_raster_to_lossy_webp (rst, &compr_data, &compressed, quality) 2475 + == RL2_OK) 2477 2476 { 2478 2477 /* ok, lossy WEBP compression was successful */ 2479 2478 uncompressed = raster->width * raster->height * raster->nBands; 2480 2479 to_clean1 = compr_data; 2481 2480 } 2482 2481 else 2483 2482 goto error; ................................................................................ 2588 2587 else 2589 2588 goto error; 2590 2589 } 2591 2590 else if (compression == RL2_COMPRESSION_LOSSLESS_JP2) 2592 2591 { 2593 2592 #ifndef OMIT_OPENJPEG /* only if OpenJpeg is enabled */ 2594 2593 /* compressing as lossless Jpeg2000 */ 2595 - if (rl2_raster_to_lossless_jpeg2000 (rst, &compr_data, &compressed) 2596 - == RL2_OK) 2594 + if (rl2_raster_to_lossless_jpeg2000 (rst, &compr_data, &compressed) == 2595 + RL2_OK) 2597 2596 { 2598 2597 /* ok, lossless Jpeg2000 compression was successful */ 2599 2598 uncompressed = raster->width * raster->height * raster->nBands; 2600 2599 to_clean1 = compr_data; 2601 2600 } 2602 2601 else 2603 2602 goto error; ................................................................................ 2720 2719 compressed = (int) zLen; 2721 2720 compr_data = zip_buf; 2722 2721 to_clean2 = zip_buf; 2723 2722 } 2724 2723 else if (ret == Z_BUF_ERROR) 2725 2724 { 2726 2725 /* ZIP compression actually causes inflation: saving uncompressed data */ 2727 - if (rl2_delta_decode 2728 - (pixels_even, size_even, delta_dist) != RL2_OK) 2726 + if (rl2_delta_decode (pixels_even, size_even, delta_dist) 2727 + != RL2_OK) 2729 2728 goto error; 2730 2729 uncompressed = size_even; 2731 2730 compressed = size_even; 2732 2731 compr_data = pixels_even; 2733 2732 free (zip_buf); 2734 2733 zip_buf = NULL; 2735 2734 } ................................................................................ 3130 3129 *xnum_bands = num_bands; 3131 3130 *xcompression = compression; 3132 3131 *xcrc = crc; 3133 3132 return 1; 3134 3133 } 3135 3134 3136 3135 static int 3137 -check_blob_even (const unsigned char *blob, int blob_sz, 3138 - unsigned short xwidth, unsigned short xheight, 3139 - unsigned char xsample_type, unsigned char xpixel_type, 3140 - unsigned char xnum_bands, unsigned char xcompression, 3141 - uLong xcrc) 3136 +check_blob_even (const unsigned char *blob, int blob_sz, unsigned short xwidth, 3137 + unsigned short xheight, unsigned char xsample_type, 3138 + unsigned char xpixel_type, unsigned char xnum_bands, 3139 + unsigned char xcompression, uLong xcrc) 3142 3140 { 3143 3141 /* checking the EvenBlock for validity */ 3144 3142 const unsigned char *ptr; 3145 3143 unsigned short width; 3146 3144 unsigned short height; 3147 3145 unsigned char sample_type; 3148 3146 unsigned char pixel_type; ................................................................................ 3216 3214 check_scale (int scale, unsigned char sample_type, unsigned char compression, 3217 3215 const unsigned char *blob_even) 3218 3216 { 3219 3217 /* checking if the encoded raster could be decoded at given scale */ 3220 3218 switch (scale) 3221 3219 { 3222 3220 case RL2_SCALE_1: 3223 - if (sample_type == RL2_SAMPLE_1_BIT 3224 - || sample_type == RL2_SAMPLE_2_BIT 3221 + if (sample_type == RL2_SAMPLE_1_BIT || sample_type == RL2_SAMPLE_2_BIT 3225 3222 || sample_type == RL2_SAMPLE_4_BIT) 3226 3223 ; 3227 3224 else if (compression == RL2_COMPRESSION_JPEG 3228 3225 || compression == RL2_COMPRESSION_LOSSY_WEBP 3229 3226 || compression == RL2_COMPRESSION_LOSSLESS_WEBP 3230 3227 || compression == RL2_COMPRESSION_CCITTFAX4 3231 3228 || compression == RL2_COMPRESSION_LOSSY_JP2 ................................................................................ 4193 4190 else 4194 4191 *p_out++ = *p_even++; 4195 4192 } 4196 4193 } 4197 4194 } 4198 4195 4199 4196 static void 4200 -do_copy_uint32 (int swap, const unsigned int *p_odd, 4201 - const unsigned int *p_even, unsigned int *buf, 4202 - unsigned short width, unsigned short odd_rows, 4203 - unsigned short even_rows) 4197 +do_copy_uint32 (int swap, const unsigned int *p_odd, const unsigned int *p_even, 4198 + unsigned int *buf, unsigned short width, 4199 + unsigned short odd_rows, unsigned short even_rows) 4204 4200 { 4205 4201 /* reassembling an UINT32 raster - scale 1:1 */ 4206 4202 int row; 4207 4203 int col; 4208 4204 unsigned int *p_out; 4209 4205 4210 4206 p_out = buf; ................................................................................ 4882 4878 return 1; 4883 4879 } 4884 4880 4885 4881 RL2_DECLARE int 4886 4882 rl2_is_valid_dbms_raster_tile (unsigned short level, unsigned int tile_width, 4887 4883 unsigned int tile_height, 4888 4884 const unsigned char *blob_odd, int blob_odd_sz, 4889 - const unsigned char *blob_even, 4890 - int blob_even_sz, unsigned char sample_type, 4885 + const unsigned char *blob_even, int blob_even_sz, 4886 + unsigned char sample_type, 4891 4887 unsigned char pixel_type, 4892 4888 unsigned char num_bands, 4893 4889 unsigned char compression) 4894 4890 { 4895 4891 /* testing a serialized Raster Tile object for validity */ 4896 4892 unsigned int width; 4897 4893 unsigned int height; ................................................................................ 4941 4937 { 4942 4938 /* small-PALETTE: expecting an RGB/PNG Pyramid tile */ 4943 4939 if (xsample_type == RL2_SAMPLE_UINT8 4944 4940 && xpixel_type == RL2_PIXEL_RGB && xnum_bands == 3 4945 4941 && xcompression == RL2_COMPRESSION_PNG) 4946 4942 return RL2_OK; 4947 4943 } 4948 - if (sample_type == RL2_SAMPLE_UINT8 4949 - && pixel_type == RL2_PIXEL_PALETTE && num_bands == 1) 4944 + if (sample_type == RL2_SAMPLE_UINT8 && pixel_type == RL2_PIXEL_PALETTE 4945 + && num_bands == 1) 4950 4946 { 4951 4947 /* PALETTE 8bits: expecting an RGB/PNG Pyramid tile */ 4952 4948 if (xsample_type == RL2_SAMPLE_UINT8 4953 4949 && xpixel_type == RL2_PIXEL_RGB && xnum_bands == 3 4954 4950 && xcompression == RL2_COMPRESSION_PNG) 4955 4951 return RL2_OK; 4956 4952 } ................................................................................ 5014 5010 if (!check_blob_odd 5015 5011 (blob_odd, blob_odd_sz, &width, &height, &sample_type, &pixel_type, 5016 5012 &num_bands, &compression, &crc)) 5017 5013 return NULL; 5018 5014 if (blob_even != NULL) 5019 5015 { 5020 5016 if (!check_blob_even 5021 - (blob_even, blob_even_sz, width, height, sample_type, 5022 - pixel_type, num_bands, compression, crc)) 5017 + (blob_even, blob_even_sz, width, height, sample_type, pixel_type, 5018 + num_bands, compression, crc)) 5023 5019 return NULL; 5024 5020 } 5025 5021 if (!check_scale (scale, sample_type, compression, blob_even)) 5026 5022 return NULL; 5027 5023 5028 5024 switch (pixel_type) 5029 5025 { ................................................................................ 5150 5146 const Bytef *in = pixels_even; 5151 5147 even_data = malloc (uncompressed_even); 5152 5148 if (even_data == NULL) 5153 5149 goto error; 5154 5150 if (uncompress (even_data, &refLen, in, compressed_even) != 5155 5151 Z_OK) 5156 5152 goto error; 5157 - if (rl2_delta_decode 5158 - (even_data, uncompressed_even, delta_dist) != RL2_OK) 5153 + if (rl2_delta_decode (even_data, uncompressed_even, delta_dist) 5154 + != RL2_OK) 5159 5155 goto error; 5160 5156 pixels_even = even_data; 5161 5157 } 5162 5158 } 5163 5159 if (compression == RL2_COMPRESSION_DEFLATE_NO 5164 5160 && uncompressed_odd != compressed_odd) 5165 5161 { ................................................................................ 5308 5304 int ret = RL2_ERROR; 5309 5305 unsigned char pix_typ; 5310 5306 switch (scale) 5311 5307 { 5312 5308 case RL2_SCALE_1: 5313 5309 ret = 5314 5310 rl2_decode_jpeg_scaled (1, pixels_odd, compressed_odd, 5315 - &width, &height, &pix_typ, 5316 - &pixels, &pixels_sz); 5311 + &width, &height, &pix_typ, &pixels, 5312 + &pixels_sz); 5317 5313 break; 5318 5314 case RL2_SCALE_2: 5319 5315 ret = 5320 5316 rl2_decode_jpeg_scaled (2, pixels_odd, compressed_odd, 5321 - &width, &height, &pix_typ, 5322 - &pixels, &pixels_sz); 5317 + &width, &height, &pix_typ, &pixels, 5318 + &pixels_sz); 5323 5319 break; 5324 5320 case RL2_SCALE_4: 5325 5321 ret = 5326 5322 rl2_decode_jpeg_scaled (4, pixels_odd, compressed_odd, 5327 - &width, &height, &pix_typ, 5328 - &pixels, &pixels_sz); 5323 + &width, &height, &pix_typ, &pixels, 5324 + &pixels_sz); 5329 5325 break; 5330 5326 case RL2_SCALE_8: 5331 5327 ret = 5332 5328 rl2_decode_jpeg_scaled (8, pixels_odd, compressed_odd, 5333 - &width, &height, &pix_typ, 5334 - &pixels, &pixels_sz); 5329 + &width, &height, &pix_typ, &pixels, 5330 + &pixels_sz); 5335 5331 break; 5336 5332 }; 5337 5333 if (ret != RL2_OK) 5338 5334 goto error; 5339 5335 goto done; 5340 5336 } 5341 5337 if (compression == RL2_COMPRESSION_LOSSY_WEBP ................................................................................ 5384 5380 goto error; 5385 5381 #endif /* end WebP conditional */ 5386 5382 } 5387 5383 if (compression == RL2_COMPRESSION_PNG) 5388 5384 { 5389 5385 /* decompressing from PNG */ 5390 5386 int ret; 5391 - if (sample_type == RL2_SAMPLE_1_BIT 5392 - || sample_type == RL2_SAMPLE_2_BIT 5387 + if (sample_type == RL2_SAMPLE_1_BIT || sample_type == RL2_SAMPLE_2_BIT 5393 5388 || sample_type == RL2_SAMPLE_4_BIT) 5394 5389 { 5395 5390 /* Palette or Grayscale - 1,2 or 4 bit isn't scalable */ 5396 5391 if (scale != RL2_SCALE_1) 5397 5392 goto error; 5398 5393 ret = 5399 5394 rl2_decode_png (pixels_odd, compressed_odd, 5400 - &width, &height, &sample_type, 5401 - &pixel_type, &num_bands, &pixels, 5402 - &pixels_sz, &mask, &mask_sz, &palette, 0); 5395 + &width, &height, &sample_type, &pixel_type, 5396 + &num_bands, &pixels, &pixels_sz, &mask, 5397 + &mask_sz, &palette, 0); 5403 5398 if (ret != RL2_OK) 5404 5399 goto error; 5405 5400 goto done; 5406 5401 } 5407 5402 else 5408 5403 { 5409 5404 ret = rl2_decode_png (pixels_odd, compressed_odd, ................................................................................ 5414 5409 if (ret != RL2_OK) 5415 5410 goto error; 5416 5411 pixels_odd = odd_data; 5417 5412 if (scale == RL2_SCALE_1) 5418 5413 { 5419 5414 ret = rl2_decode_png (pixels_even, compressed_even, 5420 5415 &width, &even_rows, &sample_type, 5421 - &pixel_type, &num_bands, 5422 - &even_data, &pixels_sz, 5423 - &even_mask, &even_mask_sz, 5424 - &palette2, 0); 5416 + &pixel_type, &num_bands, &even_data, 5417 + &pixels_sz, &even_mask, 5418 + &even_mask_sz, &palette2, 0); 5425 5419 if (ret != RL2_OK) 5426 5420 goto error; 5427 5421 rl2_destroy_palette (palette2); 5428 5422 } 5429 5423 pixels_even = even_data; 5430 5424 if (odd_mask != NULL) 5431 5425 free (odd_mask); ................................................................................ 5488 5482 int ret = RL2_ERROR; 5489 5483 switch (scale) 5490 5484 { 5491 5485 case RL2_SCALE_1: 5492 5486 ret = 5493 5487 rl2_decode_jpeg2000_scaled (1, pixels_odd, compressed_odd, 5494 5488 &width, &height, sample_type, 5495 - pixel_type, num_bands, 5496 - &pixels, &pixels_sz); 5489 + pixel_type, num_bands, &pixels, 5490 + &pixels_sz); 5497 5491 break; 5498 5492 case RL2_SCALE_2: 5499 5493 ret = 5500 5494 rl2_decode_jpeg2000_scaled (2, pixels_odd, compressed_odd, 5501 5495 &width, &height, sample_type, 5502 - pixel_type, num_bands, 5503 - &pixels, &pixels_sz); 5496 + pixel_type, num_bands, &pixels, 5497 + &pixels_sz); 5504 5498 break; 5505 5499 case RL2_SCALE_4: 5506 5500 ret = 5507 5501 rl2_decode_jpeg2000_scaled (4, pixels_odd, compressed_odd, 5508 5502 &width, &height, sample_type, 5509 - pixel_type, num_bands, 5510 - &pixels, &pixels_sz); 5503 + pixel_type, num_bands, &pixels, 5504 + &pixels_sz); 5511 5505 break; 5512 5506 case RL2_SCALE_8: 5513 5507 ret = 5514 5508 rl2_decode_jpeg2000_scaled (8, pixels_odd, compressed_odd, 5515 5509 &width, &height, sample_type, 5516 - pixel_type, num_bands, 5517 - &pixels, &pixels_sz); 5510 + pixel_type, num_bands, &pixels, 5511 + &pixels_sz); 5518 5512 break; 5519 5513 }; 5520 5514 if (ret != RL2_OK) 5521 5515 goto error; 5522 5516 goto done; 5523 5517 #else /* OpenJpeg is disabled */ 5524 5518 fprintf (stderr, ................................................................................ 5564 5558 { 5565 5559 /* unpacking the mask */ 5566 5560 unsigned char *mask_pix; 5567 5561 int mask_pix_sz; 5568 5562 if (uncompressed_mask != (mask_width * mask_height)) 5569 5563 goto error; 5570 5564 if (!unpack_rle 5571 - (mask_width, mask_height, pixels_mask, compressed_mask, 5572 - &mask_pix, &mask_pix_sz)) 5565 + (mask_width, mask_height, pixels_mask, compressed_mask, &mask_pix, 5566 + &mask_pix_sz)) 5573 5567 goto error; 5574 5568 if (!rescale_mask 5575 5569 (scale, &mask_width, &mask_height, mask_pix, &mask, &mask_sz)) 5576 5570 { 5577 5571 free (mask_pix); 5578 5572 goto error; 5579 5573 } ................................................................................ 5889 5883 { 5890 5884 ignore_no_data = 0; 5891 5885 if (rl2_get_pixel_type (no_data, &sample_type, &pixel_type, &nbands) 5892 5886 != RL2_OK) 5893 5887 ignore_no_data = 1; 5894 5888 if (nbands != num_bands) 5895 5889 ignore_no_data = 1; 5896 - if (sample_type == RL2_SAMPLE_1_BIT 5897 - || sample_type == RL2_SAMPLE_2_BIT 5890 + if (sample_type == RL2_SAMPLE_1_BIT || sample_type == RL2_SAMPLE_2_BIT 5898 5891 || sample_type == RL2_SAMPLE_4_BIT 5899 5892 || sample_type == RL2_SAMPLE_UINT8) 5900 5893 ; 5901 5894 else 5902 5895 ignore_no_data = 1; 5903 5896 } 5904 5897 ................................................................................ 6500 6493 } 6501 6494 } 6502 6495 compute_int32_histogram (width, height, pixels, mask, st, no_data); 6503 6496 } 6504 6497 6505 6498 static void 6506 6499 compute_uint32_histogram (unsigned short width, unsigned short height, 6507 - const unsigned int *pixels, 6508 - const unsigned char *mask, 6500 + const unsigned int *pixels, const unsigned char *mask, 6509 6501 rl2PrivRasterStatisticsPtr st, rl2PixelPtr no_data) 6510 6502 { 6511 6503 /* computing INT16 tile histogram */ 6512 6504 int x; 6513 6505 int y; 6514 6506 const unsigned int *p_in = pixels; 6515 6507 const unsigned char *p_msk = mask;
Changes to src/rl2dbms.c.
75 75 unsigned char sample, unsigned char pixel, 76 76 unsigned char num_bands, 77 77 unsigned char compression, int quality, 78 78 unsigned int tile_width, 79 79 unsigned int tile_height, int srid, 80 80 double x_res, double y_res, 81 81 unsigned char *blob, int blob_sz, 82 - unsigned char *blob_no_data, 83 - int blob_no_data_sz, int strict_resolution, 84 - int mixed_resolutions, int section_paths, 85 - int section_md5, int section_summary) 82 + unsigned char *blob_no_data, int blob_no_data_sz, 83 + int strict_resolution, int mixed_resolutions, 84 + int section_paths, int section_md5, 85 + int section_summary) 86 86 { 87 87 /* inserting into "raster_coverages" */ 88 88 int ret; 89 89 char *sql; 90 90 sqlite3_stmt *stmt; 91 91 const char *xsample = "UNKNOWN"; 92 92 const char *xpixel = "UNKNOWN"; ................................................................................ 276 276 "\ty_resolution_1_4 DOUBLE,\n" 277 277 "\tx_resolution_1_8 DOUBLE,\n" 278 278 "\ty_resolution_1_8 DOUBLE)\n", xxcoverage); 279 279 ret = sqlite3_exec (handle, sql, NULL, NULL, &sql_err); 280 280 sqlite3_free (sql); 281 281 if (ret != SQLITE_OK) 282 282 { 283 - fprintf (stderr, "CREATE TABLE \"%s_levels\" error: %s\n", 284 - xxcoverage, sql_err); 283 + fprintf (stderr, "CREATE TABLE \"%s_levels\" error: %s\n", xxcoverage, 284 + sql_err); 285 285 sqlite3_free (sql_err); 286 286 free (xxcoverage); 287 287 return 0; 288 288 } 289 289 free (xxcoverage); 290 290 return 1; 291 291 } ................................................................................ 336 336 ret = sqlite3_exec (handle, sql, NULL, NULL, &sql_err); 337 337 sqlite3_free (sql); 338 338 free (xpk_name); 339 339 free (xfk_name); 340 340 free (xmother); 341 341 if (ret != SQLITE_OK) 342 342 { 343 - fprintf (stderr, "CREATE TABLE \"%s_levels\" error: %s\n", 344 - xxcoverage, sql_err); 343 + fprintf (stderr, "CREATE TABLE \"%s_levels\" error: %s\n", xxcoverage, 344 + sql_err); 345 345 sqlite3_free (sql_err); 346 346 free (xxcoverage); 347 347 return 0; 348 348 } 349 349 free (xxcoverage); 350 350 return 1; 351 351 } ................................................................................ 1244 1244 if (stmt != NULL) 1245 1245 sqlite3_finalize (stmt); 1246 1246 return RL2_ERROR; 1247 1247 } 1248 1248 1249 1249 RL2_DECLARE int 1250 1250 rl2_resolve_base_resolution_from_dbms (sqlite3 * handle, const char *coverage, 1251 - int by_section, 1252 - sqlite3_int64 section_id, 1251 + int by_section, sqlite3_int64 section_id, 1253 1252 double *x_res, double *y_res) 1254 1253 { 1255 1254 /* resolving the Base Resolution */ 1256 1255 int ret; 1257 1256 char *sql; 1258 1257 double xres; 1259 1258 double yres; ................................................................................ 1440 1439 sqlite3_stmt *stmt = NULL; 1441 1440 1442 1441 *duplicate = 0; 1443 1442 table = sqlite3_mprintf ("%s_sections", coverage); 1444 1443 xtable = rl2_double_quoted_sql (table); 1445 1444 sqlite3_free (table); 1446 1445 sql = 1447 - sqlite3_mprintf 1448 - ("SELECT section_id FROM \"%s\" WHERE section_name = ?", xtable); 1446 + sqlite3_mprintf ("SELECT section_id FROM \"%s\" WHERE section_name = ?", 1447 + xtable); 1449 1448 free (xtable); 1450 1449 ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); 1451 1450 sqlite3_free (sql); 1452 1451 if (ret != SQLITE_OK) 1453 1452 { 1454 1453 printf ("SELECT section_id SQL error: %s\n", sqlite3_errmsg (handle)); 1455 1454 goto error; ................................................................................ 2387 2386 } 2388 2387 if (sqlite3_column_type (stmt, 15) == SQLITE_INTEGER) 2389 2388 { 2390 2389 section_summary = sqlite3_column_int (stmt, 15); 2391 2390 ok_summary = 1; 2392 2391 } 2393 2392 if (ok_sample && ok_pixel && ok_num_bands && ok_compression 2394 - && ok_quality && ok_tile_width && ok_tile_height 2395 - && ok_x_res && ok_y_res && ok_srid && ok_nodata 2396 - && ok_strict && ok_mixed && ok_paths && ok_md5 2397 - && ok_summary) 2393 + && ok_quality && ok_tile_width && ok_tile_height && ok_x_res 2394 + && ok_y_res && ok_srid && ok_nodata && ok_strict && ok_mixed 2395 + && ok_paths && ok_md5 && ok_summary) 2398 2396 ok = 1; 2399 2397 } 2400 2398 } 2401 2399 sqlite3_finalize (stmt); 2402 2400 2403 2401 if (!ok) 2404 2402 { ................................................................................ 2422 2420 fprintf (stderr, 2423 2421 "ERROR: unable to Georeference a Coverage Object supporting \"%s\"\n", 2424 2422 coverage); 2425 2423 rl2_destroy_coverage (cvg); 2426 2424 return NULL; 2427 2425 } 2428 2426 if (rl2_set_coverage_policies 2429 - (cvg, strict_resolution, mixed_resolutions, section_paths, 2430 - section_md5, section_summary) != RL2_OK) 2427 + (cvg, strict_resolution, mixed_resolutions, section_paths, section_md5, 2428 + section_summary) != RL2_OK) 2431 2429 { 2432 2430 fprintf (stderr, 2433 2431 "ERROR: unable to set the Policies on the Coverage Object supporting \"%s\"\n", 2434 2432 coverage); 2435 2433 rl2_destroy_coverage (cvg); 2436 2434 return NULL; 2437 2435 } ................................................................................ 2535 2533 free (f_table_name); 2536 2534 if (f_geometry_column != NULL) 2537 2535 free (f_geometry_column); 2538 2536 return NULL; 2539 2537 } 2540 2538 2541 2539 vector = 2542 - rl2_create_vector_layer (f_table_name, f_geometry_column, 2543 - geometry_type, srid, spatial_index); 2540 + rl2_create_vector_layer (f_table_name, f_geometry_column, geometry_type, 2541 + srid, spatial_index); 2544 2542 free (f_table_name); 2545 2543 free (f_geometry_column); 2546 2544 if (vector == NULL) 2547 2545 { 2548 2546 fprintf (stderr, 2549 2547 "ERROR: unable to create a Vector Layer Object supporting \"%s\"\n", 2550 2548 coverage); ................................................................................ 2890 2888 } 2891 2889 2892 2890 static void 2893 2891 do_decode_tile (rl2AuxDecoderPtr decoder) 2894 2892 { 2895 2893 /* servicing an AuxDecoder Tile request */ 2896 2894 decoder->raster = 2897 - (rl2PrivRasterPtr) rl2_raster_decode (decoder->scale, 2898 - decoder->blob_odd, 2895 + (rl2PrivRasterPtr) rl2_raster_decode (decoder->scale, decoder->blob_odd, 2899 2896 decoder->blob_odd_sz, 2900 2897 decoder->blob_even, 2901 2898 decoder->blob_even_sz, 2902 2899 (rl2PalettePtr) 2903 2900 (decoder->palette)); 2904 2901 if (decoder->blob_odd != NULL) 2905 2902 free (decoder->blob_odd); ................................................................................ 3076 3073 3077 3074 error: 3078 3075 return 0; 3079 3076 } 3080 3077 3081 3078 static int 3082 3079 rl2_load_dbms_tiles_common (sqlite3 * handle, int max_threads, 3083 - sqlite3_stmt * stmt_tiles, 3084 - sqlite3_stmt * stmt_data, unsigned char *outbuf, 3085 - unsigned int width, unsigned int height, 3086 - unsigned char sample_type, 3080 + sqlite3_stmt * stmt_tiles, sqlite3_stmt * stmt_data, 3081 + unsigned char *outbuf, unsigned int width, 3082 + unsigned int height, unsigned char sample_type, 3087 3083 unsigned char num_bands, unsigned char auto_ndvi, 3088 3084 unsigned char red_band_index, 3089 3085 unsigned char nir_band_index, double x_res, 3090 3086 double y_res, double minx, double maxy, int scale, 3091 3087 rl2PalettePtr palette, rl2PixelPtr no_data, 3092 3088 rl2RasterSymbolizerPtr style, 3093 3089 rl2RasterStatisticsPtr stats) ................................................................................ 3708 3704 { 3709 3705 fprintf (stderr, 3710 3706 "SELECT tiles data; sqlite3_step() error: %s\n", 3711 3707 sqlite3_errmsg (handle)); 3712 3708 goto error; 3713 3709 } 3714 3710 raster = 3715 - rl2_raster_decode (scale, blob_odd, blob_odd_sz, 3716 - blob_even, blob_even_sz, NULL); 3711 + rl2_raster_decode (scale, blob_odd, blob_odd_sz, blob_even, 3712 + blob_even_sz, NULL); 3717 3713 if (raster == NULL) 3718 3714 { 3719 3715 fprintf (stderr, ERR_FRMT64, tile_id); 3720 3716 goto error; 3721 3717 } 3722 3718 if (!copy_triple_band_raw_pixels 3723 3719 (raster, outbuf, width, height, red_band, green_band, 3724 - blue_band, x_res, y_res, minx, maxy, tile_minx, 3725 - tile_maxy, no_data)) 3720 + blue_band, x_res, y_res, minx, maxy, tile_minx, tile_maxy, 3721 + no_data)) 3726 3722 goto error; 3727 3723 rl2_destroy_raster (raster); 3728 3724 raster = NULL; 3729 3725 } 3730 3726 else 3731 3727 { 3732 3728 fprintf (stderr, ................................................................................ 3870 3866 3871 3867 return 1; 3872 3868 } 3873 3869 3874 3870 static int 3875 3871 copy_mono_band_raw_pixels (rl2RasterPtr raster, unsigned char *outbuf, 3876 3872 unsigned int width, unsigned int height, 3877 - unsigned char mono_band, double x_res, 3878 - double y_res, double minx, double maxy, 3879 - double tile_minx, double tile_maxy, 3880 - rl2PixelPtr no_data) 3873 + unsigned char mono_band, double x_res, double y_res, 3874 + double minx, double maxy, double tile_minx, 3875 + double tile_maxy, rl2PixelPtr no_data) 3881 3876 { 3882 3877 /* copying raw pixels into the output buffer */ 3883 3878 unsigned int tile_width; 3884 3879 unsigned int tile_height; 3885 3880 unsigned int x; 3886 3881 unsigned int y; 3887 3882 int out_x; ................................................................................ 4004 3999 return 1; 4005 4000 } 4006 4001 4007 4002 static int 4008 4003 load_mono_band_dbms_tiles (sqlite3 * handle, sqlite3_stmt * stmt_tiles, 4009 4004 sqlite3_stmt * stmt_data, unsigned char *outbuf, 4010 4005 unsigned int width, unsigned int height, 4011 - unsigned char mono_band, double x_res, 4012 - double y_res, double minx, double miny, 4013 - double maxx, double maxy, int level, int scale, 4014 - rl2PixelPtr no_data) 4006 + unsigned char mono_band, double x_res, double y_res, 4007 + double minx, double miny, double maxx, double maxy, 4008 + int level, int scale, rl2PixelPtr no_data) 4015 4009 { 4016 4010 /* retrieving a full image from DBMS tiles */ 4017 4011 rl2RasterPtr raster = NULL; 4018 4012 int ret; 4019 4013 4020 4014 /* binding the query args */ 4021 4015 sqlite3_reset (stmt_tiles); ................................................................................ 4066 4060 { 4067 4061 fprintf (stderr, 4068 4062 "SELECT tiles data; sqlite3_step() error: %s\n", 4069 4063 sqlite3_errmsg (handle)); 4070 4064 goto error; 4071 4065 } 4072 4066 raster = 4073 - rl2_raster_decode (scale, blob_odd, blob_odd_sz, 4074 - blob_even, blob_even_sz, NULL); 4067 + rl2_raster_decode (scale, blob_odd, blob_odd_sz, blob_even, 4068 + blob_even_sz, NULL); 4075 4069 if (raster == NULL) 4076 4070 { 4077 4071 fprintf (stderr, ERR_FRMT64, tile_id); 4078 4072 goto error; 4079 4073 } 4080 4074 if (!copy_mono_band_raw_pixels 4081 4075 (raster, outbuf, width, height, mono_band, x_res, y_res, ................................................................................ 4103 4097 4104 4098 RL2_PRIVATE int 4105 4099 rl2_load_dbms_tiles (sqlite3 * handle, int max_threads, 4106 4100 sqlite3_stmt * stmt_tiles, sqlite3_stmt * stmt_data, 4107 4101 unsigned char *outbuf, unsigned int width, 4108 4102 unsigned int height, unsigned char sample_type, 4109 4103 unsigned char num_bands, unsigned char auto_ndvi, 4110 - unsigned char red_band_index, 4111 - unsigned char nir_band_index, double x_res, double y_res, 4112 - double minx, double miny, double maxx, double maxy, 4113 - int level, int scale, rl2PalettePtr palette, 4114 - rl2PixelPtr no_data, rl2RasterSymbolizerPtr style, 4115 - rl2RasterStatisticsPtr stats) 4104 + unsigned char red_band_index, unsigned char nir_band_index, 4105 + double x_res, double y_res, double minx, double miny, 4106 + double maxx, double maxy, int level, int scale, 4107 + rl2PalettePtr palette, rl2PixelPtr no_data, 4108 + rl2RasterSymbolizerPtr style, rl2RasterStatisticsPtr stats) 4116 4109 { 4117 4110 /* binding the query args */ 4118 4111 sqlite3_reset (stmt_tiles); 4119 4112 sqlite3_clear_bindings (stmt_tiles); 4120 4113 sqlite3_bind_int (stmt_tiles, 1, level); 4121 4114 sqlite3_bind_double (stmt_tiles, 2, minx); 4122 4115 sqlite3_bind_double (stmt_tiles, 3, miny); ................................................................................ 4133 4126 4134 4127 RL2_PRIVATE int 4135 4128 rl2_load_dbms_tiles_section (sqlite3 * handle, int max_threads, 4136 4129 sqlite3_int64 section_id, 4137 4130 sqlite3_stmt * stmt_tiles, 4138 4131 sqlite3_stmt * stmt_data, unsigned char *outbuf, 4139 4132 unsigned int width, unsigned int height, 4140 - unsigned char sample_type, 4141 - unsigned char num_bands, unsigned char auto_ndvi, 4133 + unsigned char sample_type, unsigned char num_bands, 4134 + unsigned char auto_ndvi, 4142 4135 unsigned char red_band_index, 4143 4136 unsigned char nir_band_index, double x_res, 4144 - double y_res, double minx, double maxy, 4145 - int scale, rl2PalettePtr palette, 4146 - rl2PixelPtr no_data) 4137 + double y_res, double minx, double maxy, int scale, 4138 + rl2PalettePtr palette, rl2PixelPtr no_data) 4147 4139 { 4148 4140 /* binding the query args */ 4149 4141 sqlite3_reset (stmt_tiles); 4150 4142 sqlite3_clear_bindings (stmt_tiles); 4151 4143 sqlite3_bind_int (stmt_tiles, 1, section_id); 4152 4144 4153 4145 if (!rl2_load_dbms_tiles_common ................................................................................ 4591 4583 free (blue); 4592 4584 } 4593 4585 if (!ok) 4594 4586 { 4595 4587 /* default: white */ 4596 4588 rl2_set_pixel_sample_uint8 (no_data, RL2_RED_BAND, 4597 4589 255); 4598 - rl2_set_pixel_sample_uint8 (no_data, 4599 - RL2_GREEN_BAND, 255); 4600 - rl2_set_pixel_sample_uint8 (no_data, 4601 - RL2_BLUE_BAND, 255); 4590 + rl2_set_pixel_sample_uint8 (no_data, RL2_GREEN_BAND, 4591 + 255); 4592 + rl2_set_pixel_sample_uint8 (no_data, RL2_BLUE_BAND, 4593 + 255); 4602 4594 } 4603 4595 } 4604 4596 } 4605 4597 if (plt != NULL) 4606 4598 rl2_destroy_palette (plt); 4607 4599 plt = NULL; 4608 4600 sample_type = RL2_SAMPLE_UINT8; ................................................................................ 4819 4811 bgcolor); 4820 4812 else 4821 4813 void_raw_buffer (bufpix, width, height, sample_type, num_bands, 4822 4814 no_data); 4823 4815 } 4824 4816 if (!rl2_load_dbms_tiles 4825 4817 (handle, max_threads, stmt_tiles, stmt_data, bufpix, width, height, 4826 - sample_type, num_bands, auto_ndvi, red_band, nir_band, xx_res, 4827 - yy_res, minx, miny, maxx, maxy, level, scale, plt, no_data, style, 4828 - stats)) 4818 + sample_type, num_bands, auto_ndvi, red_band, nir_band, xx_res, yy_res, 4819 + minx, miny, maxx, maxy, level, scale, plt, no_data, style, stats)) 4829 4820 goto error; 4830 4821 if (kill_no_data != NULL) 4831 4822 rl2_destroy_pixel (kill_no_data); 4832 4823 sqlite3_finalize (stmt_tiles); 4833 4824 sqlite3_finalize (stmt_data); 4834 4825 if (shaded_relief != NULL) 4835 4826 { ................................................................................ 4877 4868 rl2_destroy_pixel (kill_no_data); 4878 4869 if (shaded_relief != NULL) 4879 4870 free (shaded_relief); 4880 4871 return RL2_ERROR; 4881 4872 } 4882 4873 4883 4874 RL2_DECLARE int 4884 -rl2_get_raw_raster_data (sqlite3 * handle, int max_threads, 4885 - rl2CoveragePtr cvg, unsigned int width, 4886 - unsigned int height, double minx, double miny, 4887 - double maxx, double maxy, double x_res, double y_res, 4888 - unsigned char **buffer, int *buf_size, 4889 - rl2PalettePtr * palette, unsigned char out_pixel) 4875 +rl2_get_raw_raster_data (sqlite3 * handle, int max_threads, rl2CoveragePtr cvg, 4876 + unsigned int width, unsigned int height, 4877 + double minx, double miny, double maxx, double maxy, 4878 + double x_res, double y_res, unsigned char **buffer, 4879 + int *buf_size, rl2PalettePtr * palette, 4880 + unsigned char out_pixel) 4890 4881 { 4891 4882 /* attempting to return a buffer containing raw pixels from the DBMS Coverage */ 4892 4883 return rl2_get_raw_raster_data_common (handle, max_threads, cvg, 0, 0, 4893 4884 width, height, minx, miny, maxx, 4894 - maxy, x_res, y_res, buffer, 4895 - buf_size, palette, out_pixel, NULL, 4896 - NULL, NULL); 4885 + maxy, x_res, y_res, buffer, buf_size, 4886 + palette, out_pixel, NULL, NULL, 4887 + NULL); 4897 4888 } 4898 4889 4899 4890 RL2_DECLARE int 4900 4891 rl2_get_section_raw_raster_data (sqlite3 * handle, int max_threads, 4901 4892 rl2CoveragePtr cvg, sqlite3_int64 section_id, 4902 4893 unsigned int width, unsigned int height, 4903 4894 double minx, double miny, double maxx, ................................................................................ 4906 4897 rl2PalettePtr * palette, 4907 4898 unsigned char out_pixel) 4908 4899 { 4909 4900 /* attempting to return a buffer containing raw pixels from the DBMS Coverage/Section */ 4910 4901 return rl2_get_raw_raster_data_common (handle, max_threads, cvg, 1, 4911 4902 section_id, width, height, minx, 4912 4903 miny, maxx, maxy, x_res, y_res, 4913 - buffer, buf_size, palette, 4914 - out_pixel, NULL, NULL, NULL); 4904 + buffer, buf_size, palette, out_pixel, 4905 + NULL, NULL, NULL); 4915 4906 } 4916 4907 4917 4908 static int 4918 4909 get_triple_band_raw_raster_data_common (int by_section, sqlite3 * handle, 4919 4910 rl2CoveragePtr cvg, 4920 4911 sqlite3_int64 section_id, 4921 - unsigned int width, 4922 - unsigned int height, double minx, 4923 - double miny, double maxx, double maxy, 4924 - double x_res, double y_res, 4912 + unsigned int width, unsigned int height, 4913 + double minx, double miny, double maxx, 4914 + double maxy, double x_res, double y_res, 4925 4915 unsigned char red_band, 4926 4916 unsigned char green_band, 4927 4917 unsigned char blue_band, 4928 4918 unsigned char **buffer, int *buf_size, 4929 4919 rl2PixelPtr bgcolor) 4930 4920 { 4931 4921 /* attempting to return a buffer containing raw pixels from the DBMS Coverage */ ................................................................................ 5082 5072 unsigned char blue_band, 5083 5073 unsigned char **buffer, int *buf_size, 5084 5074 rl2PixelPtr bgcolor) 5085 5075 { 5086 5076 /* attempting to return a buffer containing raw pixels from the DBMS Coverage */ 5087 5077 return get_triple_band_raw_raster_data_common (0, handle, cvg, 0, width, 5088 5078 height, minx, miny, maxx, 5089 - maxy, x_res, y_res, 5090 - red_band, green_band, 5091 - blue_band, buffer, 5092 - buf_size, bgcolor); 5079 + maxy, x_res, y_res, red_band, 5080 + green_band, blue_band, 5081 + buffer, buf_size, bgcolor); 5093 5082 } 5094 5083 5095 5084 RL2_DECLARE int 5096 5085 rl2_get_section_triple_band_raw_raster_data (sqlite3 * handle, 5097 5086 rl2CoveragePtr cvg, 5098 5087 sqlite3_int64 section_id, 5099 5088 unsigned int width, ................................................................................ 5108 5097 int *buf_size, rl2PixelPtr bgcolor) 5109 5098 { 5110 5099 /* attempting to return a buffer containing raw pixels - Section */ 5111 5100 return get_triple_band_raw_raster_data_common (1, handle, cvg, section_id, 5112 5101 width, height, minx, miny, 5113 5102 maxx, maxy, x_res, y_res, 5114 5103 red_band, green_band, 5115 - blue_band, buffer, 5116 - buf_size, bgcolor); 5104 + blue_band, buffer, buf_size, 5105 + bgcolor); 5117 5106 } 5118 5107 5119 5108 static int 5120 5109 get_mono_band_raw_raster_data_common (int by_section, sqlite3 * handle, 5121 5110 rl2CoveragePtr cvg, 5122 5111 sqlite3_int64 section_id, 5123 5112 unsigned int width, unsigned int height, ................................................................................ 5274 5263 double x_res, double y_res, 5275 5264 unsigned char mono_band, 5276 5265 unsigned char **buffer, int *buf_size, 5277 5266 rl2PixelPtr no_data) 5278 5267 { 5279 5268 /* attempting to return a buffer containing raw pixels from the DBMS Coverage */ 5280 5269 return get_mono_band_raw_raster_data_common (0, handle, cvg, 0, width, 5281 - height, minx, miny, maxx, 5282 - maxy, x_res, y_res, buffer, 5283 - buf_size, mono_band, no_data); 5270 + height, minx, miny, maxx, maxy, 5271 + x_res, y_res, buffer, buf_size, 5272 + mono_band, no_data); 5284 5273 } 5285 5274 5286 5275 RL2_DECLARE int 5287 -rl2_get_section_mono_band_raw_raster_data (sqlite3 * handle, 5288 - rl2CoveragePtr cvg, 5276 +rl2_get_section_mono_band_raw_raster_data (sqlite3 * handle, rl2CoveragePtr cvg, 5289 5277 sqlite3_int64 section_id, 5290 5278 unsigned int width, 5291 5279 unsigned int height, double minx, 5292 5280 double miny, double maxx, 5293 5281 double maxy, double x_res, 5294 5282 double y_res, 5295 5283 unsigned char mono_band, ................................................................................ 5303 5291 buffer, buf_size, mono_band, 5304 5292 no_data); 5305 5293 } 5306 5294 5307 5295 RL2_DECLARE int 5308 5296 rl2_get_raw_raster_data_bgcolor (sqlite3 * handle, int max_threads, 5309 5297 rl2CoveragePtr cvg, unsigned int width, 5310 - unsigned int height, double minx, 5311 - double miny, double maxx, double maxy, 5312 - double x_res, double y_res, 5313 - unsigned char **buffer, int *buf_size, 5314 - rl2PalettePtr * palette, 5315 - unsigned char *out_pixel, 5316 - unsigned char bg_red, unsigned char bg_green, 5317 - unsigned char bg_blue, 5298 + unsigned int height, double minx, double miny, 5299 + double maxx, double maxy, double x_res, 5300 + double y_res, unsigned char **buffer, 5301 + int *buf_size, rl2PalettePtr * palette, 5302 + unsigned char *out_pixel, unsigned char bg_red, 5303 + unsigned char bg_green, unsigned char bg_blue, 5318 5304 rl2RasterSymbolizerPtr style, 5319 5305 rl2RasterStatisticsPtr stats) 5320 5306 { 5321 5307 /* attempting to return a buffer containing raw pixels from the DBMS Coverage + bgcolor */ 5322 5308 int ret; 5323 5309 rl2PixelPtr no_data = NULL; 5324 5310 const char *coverage; ................................................................................ 5394 5380 if (index < 0) 5395 5381 { 5396 5382 /* palette color found */ 5397 5383 switch (sample_type) 5398 5384 { 5399 5385 case RL2_SAMPLE_1_BIT: 5400 5386 no_data = 5401 - rl2_create_pixel (RL2_SAMPLE_1_BIT, 5402 - RL2_PIXEL_PALETTE, 1); 5387 + rl2_create_pixel (RL2_SAMPLE_1_BIT, RL2_PIXEL_PALETTE, 5388 + 1); 5403 5389 rl2_set_pixel_sample_1bit (no_data, 5404 5390 (unsigned char) index); 5405 5391 break; 5406 5392 case RL2_SAMPLE_2_BIT: 5407 5393 no_data = 5408 - rl2_create_pixel (RL2_SAMPLE_2_BIT, 5409 - RL2_PIXEL_PALETTE, 1); 5394 + rl2_create_pixel (RL2_SAMPLE_2_BIT, RL2_PIXEL_PALETTE, 5395 + 1); 5410 5396 rl2_set_pixel_sample_2bit (no_data, 5411 5397 (unsigned char) index); 5412 5398 break; 5413 5399 case RL2_SAMPLE_4_BIT: 5414 5400 no_data = 5415 - rl2_create_pixel (RL2_SAMPLE_4_BIT, 5416 - RL2_PIXEL_PALETTE, 1); 5401 + rl2_create_pixel (RL2_SAMPLE_4_BIT, RL2_PIXEL_PALETTE, 5402 + 1); 5417 5403 rl2_set_pixel_sample_4bit (no_data, 5418 5404 (unsigned char) index); 5419 5405 break; 5420 5406 case RL2_SAMPLE_UINT8: 5421 5407 no_data = 5422 - rl2_create_pixel (RL2_SAMPLE_UINT8, 5423 - RL2_PIXEL_PALETTE, 1); 5408 + rl2_create_pixel (RL2_SAMPLE_UINT8, RL2_PIXEL_PALETTE, 5409 + 1); 5424 5410 rl2_set_pixel_sample_uint8 (no_data, RL2_PALETTE_BAND, 5425 5411 (unsigned char) index); 5426 5412 break; 5427 5413 5428 5414 }; 5429 5415 } 5430 5416 } ................................................................................ 5717 5703 sqlite3_stmt *stmt = NULL; 5718 5704 char *sql; 5719 5705 int ret; 5720 5706 if (handle == NULL || coverage == NULL || palette == NULL) 5721 5707 return RL2_ERROR; 5722 5708 5723 5709 sql = 5724 - sqlite3_mprintf 5725 - ("SELECT sample_type, pixel_type FROM raster_coverages " 5726 - "WHERE Lower(coverage_name) = Lower(%Q)", coverage); 5710 + sqlite3_mprintf ("SELECT sample_type, pixel_type FROM raster_coverages " 5711 + "WHERE Lower(coverage_name) = Lower(%Q)", coverage); 5727 5712 ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); 5728 5713 sqlite3_free (sql); 5729 5714 if (ret != SQLITE_OK) 5730 5715 { 5731 5716 fprintf (stderr, "SQL error: %s\n%s\n", sql, sqlite3_errmsg (handle)); 5732 5717 goto error; 5733 5718 } ................................................................................ 6246 6231 sqlite3_finalize (stmt); 6247 6232 if (stl != NULL) 6248 6233 rl2_destroy_coverage_style (stl); 6249 6234 return NULL; 6250 6235 } 6251 6236 6252 6237 RL2_DECLARE rl2FeatureTypeStylePtr 6253 -rl2_create_feature_type_style_from_dbms (sqlite3 * handle, 6254 - const char *coverage, 6238 +rl2_create_feature_type_style_from_dbms (sqlite3 * handle, const char *coverage, 6255 6239 const char *style) 6256 6240 { 6257 6241 /* attempting to load and parse a Feature Type Style */ 6258 6242 const char *sql; 6259 6243 int ret; 6260 6244 sqlite3_stmt *stmt = NULL; 6261 6245 rl2FeatureTypeStylePtr stl = NULL; ................................................................................ 6391 6375 char **results; 6392 6376 int rows; 6393 6377 int columns; 6394 6378 int i; 6395 6379 int ok = 0; 6396 6380 /* testing if the Layer Style exists */ 6397 6381 char *sql = 6398 - sqlite3_mprintf 6399 - ("SELECT style_name FROM SE_raster_styled_layers AS r " 6400 - "JOIN SE_raster_styles AS s ON (r.style_id = s.style_id) " 6401 - "WHERE Lower(r.coverage_name) = Lower(%Q) AND " 6402 - "Lower(s.style_name) = Lower(%Q)", namedLayer, 6403 - namedStyle); 6382 + sqlite3_mprintf ("SELECT style_name FROM SE_raster_styled_layers AS r " 6383 + "JOIN SE_raster_styles AS s ON (r.style_id = s.style_id) " 6384 + "WHERE Lower(r.coverage_name) = Lower(%Q) AND " 6385 + "Lower(s.style_name) = Lower(%Q)", namedLayer, 6386 + namedStyle); 6404 6387 ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, NULL); 6405 6388 sqlite3_free (sql); 6406 6389 if (ret != SQLITE_OK) 6407 6390 return 0; 6408 6391 for (i = 1; i <= rows; i++) 6409 6392 ok = 1; 6410 6393 sqlite3_free_table (results); ................................................................................ 7018 7001 int section_summary = 0; 7019 7002 rl2PixelPtr no_data = NULL; 7020 7003 rl2PalettePtr palette = NULL; 7021 7004 char *title = NULL; 7022 7005 char *abstract = NULL; 7023 7006 unsigned char *statistics = NULL; 7024 7007 int statistics_sz; 7025 - int ok_geo = 0; 7026 7008 int ok_bbox = 0; 7027 7009 double geo_minx; 7028 7010 double geo_miny; 7029 7011 double geo_maxx; 7030 7012 double geo_maxy; 7031 7013 double ext_minx; 7032 7014 double ext_miny; ................................................................................ 7417 7399 strcpy (abstract, value); 7418 7400 } 7419 7401 if (sqlite3_column_type (stmt, 18) == SQLITE_BLOB) 7420 7402 { 7421 7403 statistics_sz = sqlite3_column_bytes (stmt, 18); 7422 7404 statistics = malloc (statistics_sz); 7423 7405 memcpy (statistics, 7424 - (const unsigned char *) 7425 - sqlite3_column_blob (stmt, 18), statistics_sz); 7406 + (const unsigned char *) sqlite3_column_blob (stmt, 7407 + 18), 7408 + statistics_sz); 7426 7409 } 7427 7410 if (sqlite3_column_type (stmt, 19) == SQLITE_FLOAT) 7428 7411 { 7429 7412 geo_minx = sqlite3_column_double (stmt, 19); 7430 - ok_geo++; 7413 + ok_bbox++; 7431 7414 } 7432 7415 if (sqlite3_column_type (stmt, 20) == SQLITE_FLOAT) 7433 7416 { 7434 7417 geo_miny = sqlite3_column_double (stmt, 20); 7435 - ok_geo++; 7418 + ok_bbox++; 7436 7419 } 7437 7420 if (sqlite3_column_type (stmt, 21) == SQLITE_FLOAT) 7438 7421 { 7439 7422 geo_maxx = sqlite3_column_double (stmt, 21); 7440 - ok_geo++; 7423 + ok_bbox++; 7441 7424 } 7442 7425 if (sqlite3_column_type (stmt, 22) == SQLITE_FLOAT) 7443 7426 { 7444 7427 geo_maxy = sqlite3_column_double (stmt, 22); 7445 - ok_geo++; 7428 + ok_bbox++; 7446 7429 } 7447 7430 if (sqlite3_column_type (stmt, 23) == SQLITE_FLOAT) 7448 7431 { 7449 7432 ext_minx = sqlite3_column_double (stmt, 23); 7450 7433 ok_bbox++; 7451 7434 } 7452 7435 if (sqlite3_column_type (stmt, 24) == SQLITE_FLOAT) ................................................................................ 7498 7481 { 7499 7482 const unsigned char *blob = 7500 7483 sqlite3_column_blob (stmt, 33); 7501 7484 int blob_sz = sqlite3_column_bytes (stmt, 33); 7502 7485 palette = rl2_deserialize_dbms_palette (blob, blob_sz); 7503 7486 } 7504 7487 if (ok_sample && ok_pixel && ok_num_bands && ok_compression 7505 - && ok_quality && ok_tile_width && ok_tile_height 7506 - && ok_x_res && ok_y_res && ok_srid && ok_nodata 7507 - && ok_strict && ok_mixed && ok_paths && ok_md5 7508 - && ok_summary) 7488 + && ok_quality && ok_tile_width && ok_tile_height && ok_x_res 7489 + && ok_y_res && ok_srid && ok_nodata && ok_strict && ok_mixed 7490 + && ok_paths && ok_md5 && ok_summary) 7509 7491 ok = 1; 7510 - if (ok_geo != 4) 7511 - ok_geo = 0; 7512 - if (ok_bbox != 4) 7492 + if (ok_bbox != 8) 7513 7493 ok_bbox = 0; 7514 7494 } 7515 7495 } 7516 7496 sqlite3_finalize (stmt); 7517 7497 stmt = NULL; 7518 7498 if (!ok) 7519 7499 goto error; ................................................................................ 7524 7504 compr, quality, 7525 7505 (unsigned short) tile_width, 7526 7506 (unsigned short) tile_height, srid, 7527 7507 horz_res, vert_res, no_data, palette, 7528 7508 strict_resolution, mixed_resolutions, 7529 7509 section_paths, section_md5, 7530 7510 section_summary); 7531 - if (no_data != NULL) 7532 - rl2_destroy_pixel (no_data); 7533 - if (palette != NULL) 7534 - rl2_destroy_palette (palette); 7511 + if (no_data != NULL) 7512 + rl2_destroy_pixel(no_data); 7513 + if (palette != NULL) 7514 + rl2_destroy_palette(palette); 7535 7515 if (ret != RL2_OK) 7536 7516 goto error; 7537 7517 7538 7518 /* completing the destination coverage */ 7539 7519 sql = "UPDATE main.raster_coverages SET title = ?, " 7540 7520 "abstract = ?, statistics = ?, geo_minx = ?, geo_miny = ?, geo_maxx = ?, " 7541 7521 "geo_maxy = ?, extent_minx = ?, extent_miny = ?, extent_maxx = ?, " ................................................................................ 7558 7538 sqlite3_bind_null (stmt, 2); 7559 7539 else 7560 7540 sqlite3_bind_text (stmt, 2, abstract, strlen (abstract), free); 7561 7541 if (statistics == NULL) 7562 7542 sqlite3_bind_null (stmt, 3); 7563 7543 else 7564 7544 sqlite3_bind_blob (stmt, 3, statistics, statistics_sz, free); 7565 - if (ok_geo) 7545 + if (ok_bbox) 7566 7546 { 7567 7547 sqlite3_bind_double (stmt, 4, geo_minx); 7568 7548 sqlite3_bind_double (stmt, 5, geo_miny); 7569 7549 sqlite3_bind_double (stmt, 6, geo_maxx); 7570 7550 sqlite3_bind_double (stmt, 7, geo_maxy); 7551 + sqlite3_bind_double (stmt, 8, ext_minx); 7552 + sqlite3_bind_double (stmt, 9, ext_miny); 7553 + sqlite3_bind_double (stmt, 10, ext_maxx); 7554 + sqlite3_bind_double (stmt, 11, ext_maxy); 7571 7555 } 7572 7556 else 7573 7557 { 7574 7558 sqlite3_bind_null (stmt, 4); 7575 7559 sqlite3_bind_null (stmt, 5); 7576 7560 sqlite3_bind_null (stmt, 6); 7577 7561 sqlite3_bind_null (stmt, 7); 7578 - } 7579 - if (ok_bbox) 7580 - { 7581 - sqlite3_bind_double (stmt, 8, ext_minx); 7582 - sqlite3_bind_double (stmt, 9, ext_miny); 7583 - sqlite3_bind_double (stmt, 10, ext_maxx); 7584 - sqlite3_bind_double (stmt, 11, ext_maxy); 7585 - } 7586 - else 7587 - { 7588 7562 sqlite3_bind_null (stmt, 8); 7589 7563 sqlite3_bind_null (stmt, 9); 7590 7564 sqlite3_bind_null (stmt, 10); 7591 7565 sqlite3_bind_null (stmt, 11); 7592 7566 } 7593 7567 if (!ok_is_queryable) 7594 7568 sqlite3_bind_null (stmt, 12); ................................................................................ 7613 7587 if (!ok_enable_auto_ndvi) 7614 7588 sqlite3_bind_null (stmt, 17); 7615 7589 else 7616 7590 sqlite3_bind_int (stmt, 17, enable_auto_ndvi); 7617 7591 sqlite3_bind_text (stmt, 18, coverage_name, strlen (coverage_name), 7618 7592 SQLITE_STATIC); 7619 7593 ret = sqlite3_step (stmt); 7620 - sqlite3_finalize (stmt); 7621 - stmt = NULL; 7594 + sqlite3_finalize(stmt); 7622 7595 if (ret == SQLITE_DONE || ret == SQLITE_ROW) 7623 7596 goto ok_continue; 7624 7597 fprintf (stderr, 7625 7598 "sqlite3_step() error: UPDATE raster_coverages \"%s\"\n", 7626 7599 sqlite3_errmsg (sqlite)); 7627 7600 goto error; 7628 7601 ................................................................................ 7636 7609 "x_resolution_1_4, y_resolution_1_4, x_resolution_1_8, y_resolution_1_8) " 7637 7610 "SELECT pyramid_level, x_resolution_1_1, y_resolution_1_1, x_resolution_1_2, " 7638 7611 "y_resolution_1_2, x_resolution_1_4, y_resolution_1_4, x_resolution_1_8, " 7639 7612 "y_resolution_1_8 FROM \"%s\".\"%s\"", xxcoverage, 7640 7613 xdb, xxcoverage); 7641 7614 free (xxcoverage); 7642 7615 ret = sqlite3_exec (sqlite, sql, NULL, NULL, NULL); 7643 - sqlite3_free (sql); 7616 + sqlite3_free(sql); 7644 7617 if (ret != SQLITE_OK) 7645 7618 goto error; 7646 7619 7647 7620 /* copying coverage-SECTIONS */ 7648 7621 xcoverage = sqlite3_mprintf ("%s_sections", coverage_name); 7649 7622 xxcoverage = rl2_double_quoted_sql (xcoverage); 7650 7623 sqlite3_free (xcoverage); 7651 - sql = 7652 - sqlite3_mprintf ("INSERT INTO main.\"%s\" (section_id, section_name, " 7653 - "width, height, file_path, md5_checksum, summary, statistics, geometry) " 7654 - "SELECT section_id, section_name, width, height, file_path, md5_checksum, " 7655 - "summary, statistics, geometry FROM \"%s\".\"%s\"", 7656 - xxcoverage, xdb, xxcoverage); 7624 + sql = sqlite3_mprintf ("INSERT INTO main.\"%s\" (section_id, section_name, " 7625 + "width, height, file_path, md5_checksum, summary, statistics, geometry) " 7626 + "SELECT section_id, section_name, width, height, file_path, md5_checksum, " 7627 + "summary, statistics, geometry FROM \"%s\".\"%s\"", 7628 + xxcoverage, xdb, xxcoverage); 7657 7629 free (xxcoverage); 7658 7630 ret = sqlite3_exec (sqlite, sql, NULL, NULL, NULL); 7659 - sqlite3_free (sql); 7631 + sqlite3_free(sql); 7660 7632 if (ret != SQLITE_OK) 7661 7633 goto error; 7662 7634 7663 7635 /* copying coverage-TILES */ 7664 7636 xcoverage = sqlite3_mprintf ("%s_tiles", coverage_name); 7665 7637 xxcoverage = rl2_double_quoted_sql (xcoverage); 7666 7638 sqlite3_free (xcoverage); 7667 7639 sql = sqlite3_mprintf ("INSERT INTO main.\"%s\" (tile_id, pyramid_level, " 7668 7640 "section_id, geometry) SELECT tile_id, pyramid_level, section_id, geometry " 7669 7641 "FROM \"%s\".\"%s\"", xxcoverage, xdb, xxcoverage); 7670 7642 free (xxcoverage); 7671 7643 ret = sqlite3_exec (sqlite, sql, NULL, NULL, NULL); 7672 - sqlite3_free (sql); 7644 + sqlite3_free(sql); 7673 7645 if (ret != SQLITE_OK) 7674 7646 goto error; 7675 7647 7676 7648 /* copying coverage-TILE_DATA */ 7677 7649 xcoverage = sqlite3_mprintf ("%s_tile_data", coverage_name); 7678 7650 xxcoverage = rl2_double_quoted_sql (xcoverage); 7679 7651 sqlite3_free (xcoverage); 7680 7652 sql = sqlite3_mprintf ("INSERT INTO main.\"%s\" (tile_id, tile_data_odd, " 7681 7653 "tile_data_even) SELECT tile_id, tile_data_odd, tile_data_even " 7682 7654 "FROM \"%s\".\"%s\"", xxcoverage, xdb, xxcoverage); 7683 7655 free (xxcoverage); 7684 7656 ret = sqlite3_exec (sqlite, sql, NULL, NULL, NULL); 7685 - sqlite3_free (sql); 7657 + sqlite3_free(sql); 7686 7658 if (ret != SQLITE_OK) 7687 7659 goto error; 7688 7660 7689 7661 /* copying KEYWORDS */ 7690 7662 sql = sqlite3_mprintf ("INSERT INTO main.raster_coverages_keyword " 7691 7663 "(coverage_name, keyword) SELECT coverage_name, keyword " 7692 7664 "FROM \"%s\".raster_coverages_keyword", xdb); 7693 7665 ret = sqlite3_exec (sqlite, sql, NULL, NULL, NULL); 7694 - sqlite3_free (sql); 7666 + sqlite3_free(sql); 7695 7667 if (ret != SQLITE_OK) 7696 7668 goto error; 7697 7669 7698 7670 /* copying SRID */ 7699 7671 sql = sqlite3_mprintf ("INSERT INTO main.raster_coverages_srid " 7700 7672 "(coverage_name, srid, extent_minx, extent_miny, extent_maxx, extent_maxx) " 7701 7673 "SELECT coverage_name, srid, extent_minx, extent_miny, extent_maxx, extent_maxx " 7702 7674 "FROM \"%s\".raster_coverages_srid", xdb); 7703 7675 ret = sqlite3_exec (sqlite, sql, NULL, NULL, NULL); 7704 - sqlite3_free (sql); 7676 + sqlite3_free(sql); 7705 7677 if (ret != SQLITE_OK) 7706 7678 goto error; 7707 7679 7708 7680 free (xdb); 7709 7681 return RL2_OK; 7710 7682 7711 7683 error: 7712 7684 if (xdb != NULL) 7713 7685 free (xdb); 7714 7686 if (stmt != NULL) 7715 7687 sqlite3_finalize (stmt); 7716 7688 return RL2_ERROR; 7717 7689 }
Changes to src/rl2gif.c.
602 602 rl2_destroy_palette (palette); 603 603 return NULL; 604 604 } 605 605 606 606 RL2_PRIVATE int 607 607 rl2_decode_gif (const unsigned char *gif, int gif_size, unsigned int *xwidth, 608 608 unsigned int *xheight, unsigned char *xsample_type, 609 - unsigned char *xpixel_type, unsigned char **blob, 610 - int *blob_sz, rl2PalettePtr * palette) 609 + unsigned char *xpixel_type, unsigned char **blob, int *blob_sz, 610 + rl2PalettePtr * palette) 611 611 { 612 612 /* attempting to create a raster from a GIF image - raw block */ 613 613 struct gif_memory_buffer membuf; 614 614 #ifdef GIFLIB_MAJOR 615 615 int ErrorCode; 616 616 #endif 617 617 GifFileType *GifFile = NULL;
Changes to src/rl2import.c.
100 100 tile->blob_odd = NULL; 101 101 tile->blob_even = NULL; 102 102 rl2_destroy_raster (tile->raster); 103 103 tile->raster = NULL; 104 104 } 105 105 106 106 static void 107 -addTile2AuxImporter (rl2AuxImporterPtr aux, unsigned int row, 108 - unsigned int col, double minx, double maxy) 107 +addTile2AuxImporter (rl2AuxImporterPtr aux, unsigned int row, unsigned int col, 108 + double minx, double maxy) 109 109 { 110 110 /* adding a Tile to some AuxImporter container */ 111 111 rl2AuxImporterTilePtr tile; 112 112 if (aux == NULL) 113 113 return; 114 114 115 115 tile = malloc (sizeof (rl2AuxImporterTile)); ................................................................................ 346 346 switch (aux->origin_type) 347 347 { 348 348 case RL2_ORIGIN_ASCII_GRID: 349 349 ascii_grid_origin = (rl2AsciiGridOriginPtr) (aux->origin); 350 350 tile->raster = 351 351 rl2_get_tile_from_ascii_grid_origin ((rl2CoveragePtr) 352 352 (aux->coverage), 353 - ascii_grid_origin, 354 - tile->row, tile->col, 355 - aux->verbose); 353 + ascii_grid_origin, tile->row, 354 + tile->col, aux->verbose); 356 355 break; 357 356 case RL2_ORIGIN_JPEG: 358 357 raster_origin = (rl2RasterPtr) (aux->origin); 359 358 tile->raster = 360 359 rl2_get_tile_from_jpeg_origin ((rl2CoveragePtr) (aux->coverage), 361 360 raster_origin, tile->row, 362 - tile->col, 363 - aux->forced_conversion, 361 + tile->col, aux->forced_conversion, 364 362 aux->verbose); 365 363 break; 366 364 case RL2_ORIGIN_JPEG2000: 367 365 raster_origin = (rl2RasterPtr) (aux->origin); 368 366 tile->raster = 369 367 rl2_get_tile_from_jpeg2000_origin ((rl2CoveragePtr) 370 - (aux->coverage), 371 - raster_origin, tile->row, 372 - tile->col, 368 + (aux->coverage), raster_origin, 369 + tile->row, tile->col, 373 370 aux->forced_conversion, 374 371 aux->verbose); 375 372 break; 376 373 case RL2_ORIGIN_TIFF: 377 374 tiff_origin = (rl2TiffOriginPtr) (aux->origin); 378 375 tile->raster = 379 376 rl2_get_tile_from_tiff_origin ((rl2CoveragePtr) (aux->coverage), 380 - tiff_origin, tile->row, 381 - tile->col, aux->srid, 382 - aux->verbose); 377 + tiff_origin, tile->row, tile->col, 378 + aux->srid, aux->verbose); 383 379 break; 384 380 case RL2_ORIGIN_RAW: 385 381 raster_origin = (rl2RasterPtr) (aux->origin); 386 382 tile->raster = 387 383 rl2_get_tile_from_raw_pixels ((rl2CoveragePtr) (aux->coverage), 388 384 raster_origin, tile->row, 389 385 tile->col); ................................................................................ 641 637 fprintf (stderr, "Coverage/ASCII mismatch\n"); 642 638 goto error; 643 639 } 644 640 no_data = rl2_get_coverage_no_data (cvg); 645 641 646 642 /* INSERTing the section */ 647 643 if (!rl2_do_insert_section 648 - (handle, src_path, section, srid, width, height, minx, miny, maxx, 649 - maxy, xml_summary, coverage->sectionPaths, coverage->sectionMD5, 644 + (handle, src_path, section, srid, width, height, minx, miny, maxx, maxy, 645 + xml_summary, coverage->sectionPaths, coverage->sectionMD5, 650 646 coverage->sectionSummary, stmt_sect, §ion_id)) 651 647 goto error; 652 648 section_stats = rl2_create_raster_statistics (sample_type, 1); 653 649 if (section_stats == NULL) 654 650 goto error; 655 651 /* INSERTing the base-levels */ 656 652 if (coverage->mixedResolutions) ................................................................................ 667 663 (handle, base_res_x, base_res_y, 1.0, sample_type, stmt_levl)) 668 664 goto error; 669 665 } 670 666 671 667 /* preparing all Tile Requests */ 672 668 aux = 673 669 createAuxImporter (coverage, srid, maxx, miny, tile_w, tile_h, res_x, 674 - res_y, RL2_ORIGIN_ASCII_GRID, origin, 675 - RL2_CONVERT_NO, verbose, compression, 100); 670 + res_y, RL2_ORIGIN_ASCII_GRID, origin, RL2_CONVERT_NO, 671 + verbose, compression, 100); 676 672 tile_maxy = maxy; 677 673 for (row = 0; row < height; row += tile_h) 678 674 { 679 675 tile_minx = minx; 680 676 for (col = 0; col < width; col += tile_w) 681 677 { 682 678 /* adding a Tile request */ ................................................................................ 912 908 } 913 909 914 910 #ifndef OMIT_OPENJPEG /* only if OpenJpeg is enabled */ 915 911 916 912 static int 917 913 check_jpeg2000_origin_compatibility (rl2RasterPtr raster, 918 914 rl2CoveragePtr coverage, 919 - unsigned int *width, 920 - unsigned int *height, 915 + unsigned int *width, unsigned int *height, 921 916 unsigned char *forced_conversion) 922 917 { 923 918 /* checking if the Jpeg2000 and the Coverage are mutually compatible */ 924 919 rl2PrivRasterPtr rst = (rl2PrivRasterPtr) raster; 925 920 rl2PrivCoveragePtr cvg = (rl2PrivCoveragePtr) coverage; 926 921 if (rst == NULL || cvg == NULL) 927 922 return 0; ................................................................................ 999 994 { 1000 995 *width = rst->width; 1001 996 *height = rst->height; 1002 997 *forced_conversion = RL2_CONVERT_NO; 1003 998 return 1; 1004 999 } 1005 1000 } 1006 - if (rst->sampleType == RL2_SAMPLE_UINT16 1007 - && rst->pixelType == RL2_PIXEL_RGB && rst->nBands == 3) 1001 + if (rst->sampleType == RL2_SAMPLE_UINT16 && rst->pixelType == RL2_PIXEL_RGB 1002 + && rst->nBands == 3) 1008 1003 { 1009 1004 if (cvg->sampleType == RL2_SAMPLE_UINT16 1010 1005 && cvg->pixelType == RL2_PIXEL_RGB && cvg->nBands == 3) 1011 1006 { 1012 1007 *width = rst->width; 1013 1008 *height = rst->height; 1014 1009 *forced_conversion = RL2_CONVERT_NO; ................................................................................ 1234 1229 maxy = height - 1.0; 1235 1230 res_x = 1.0; 1236 1231 res_y = 1.0; 1237 1232 } 1238 1233 raster_in = (rl2PrivRasterPtr) rst_in; 1239 1234 xml_summary = 1240 1235 rl2_build_jpeg_xml_summary (width, height, raster_in->pixelType, 1241 - is_georeferenced, res_x, res_y, minx, 1242 - miny, maxx, maxy); 1236 + is_georeferenced, res_x, res_y, minx, miny, 1237 + maxx, maxy); 1243 1238 1244 1239 printf ("------------------\n"); 1245 1240 if (total > 1) 1246 1241 printf ("%d/%d) Importing: %s\n", current, total, src_path); 1247 1242 else 1248 1243 printf ("Importing: %s\n", src_path); 1249 1244 printf (" Image Size (pixels): %d x %d\n", width, height); ................................................................................ 1314 1309 } 1315 1310 } 1316 1311 1317 1312 no_data = rl2_get_coverage_no_data (cvg); 1318 1313 1319 1314 /* INSERTing the section */ 1320 1315 if (!rl2_do_insert_section 1321 - (handle, src_path, section, srid, width, height, minx, miny, maxx, 1322 - maxy, xml_summary, coverage->sectionPaths, coverage->sectionMD5, 1316 + (handle, src_path, section, srid, width, height, minx, miny, maxx, maxy, 1317 + xml_summary, coverage->sectionPaths, coverage->sectionMD5, 1323 1318 coverage->sectionSummary, stmt_sect, §ion_id)) 1324 1319 goto error; 1325 1320 section_stats = rl2_create_raster_statistics (sample_type, num_bands); 1326 1321 if (section_stats == NULL) 1327 1322 goto error; 1328 1323 /* INSERTing the base-levels */ 1329 1324 if (coverage->mixedResolutions) ................................................................................ 1682 1677 maxy = height - 1.0; 1683 1678 res_x = 1.0; 1684 1679 res_y = 1.0; 1685 1680 } 1686 1681 raster_in = (rl2PrivRasterPtr) rst_in; 1687 1682 xml_summary = 1688 1683 rl2_build_jpeg2000_xml_summary (width, height, raster_in->sampleType, 1689 - raster_in->pixelType, 1690 - raster_in->nBands, is_georeferenced, 1691 - res_x, res_y, minx, miny, maxx, maxy, 1692 - tile_width, tile_height); 1684 + raster_in->pixelType, raster_in->nBands, 1685 + is_georeferenced, res_x, res_y, minx, 1686 + miny, maxx, maxy, tile_width, 1687 + tile_height); 1693 1688 1694 1689 printf ("------------------\n"); 1695 1690 if (total > 1) 1696 1691 printf ("%d/%d) Importing: %s\n", current, total, src_path); 1697 1692 else 1698 1693 printf ("Importing: %s\n", src_path); 1699 1694 printf (" Image Size (pixels): %d x %d\n", width, height); ................................................................................ 1764 1759 } 1765 1760 } 1766 1761 1767 1762 no_data = rl2_get_coverage_no_data (cvg); 1768 1763 1769 1764 /* INSERTing the section */ 1770 1765 if (!rl2_do_insert_section 1771 - (handle, src_path, section, srid, width, height, minx, miny, maxx, 1772 - maxy, xml_summary, coverage->sectionPaths, coverage->sectionMD5, 1766 + (handle, src_path, section, srid, width, height, minx, miny, maxx, maxy, 1767 + xml_summary, coverage->sectionPaths, coverage->sectionMD5, 1773 1768 coverage->sectionSummary, stmt_sect, §ion_id)) 1774 1769 goto error; 1775 1770 section_stats = rl2_create_raster_statistics (sample_type, num_bands); 1776 1771 if (section_stats == NULL) 1777 1772 goto error; 1778 1773 /* INSERTing the base-levels */ 1779 1774 if (coverage->mixedResolutions) ................................................................................ 2075 2070 rl2AuxImporterTilePtr *thread_slots = NULL; 2076 2071 int thread_count; 2077 2072 2078 2073 if (is_ascii_grid (src_path)) 2079 2074 return do_import_ascii_grid (handle, max_threads, src_path, cvg, 2080 2075 section, force_srid, tile_w, tile_h, 2081 2076 pyramidize, sample_type, compression, 2082 - stmt_data, stmt_tils, stmt_sect, 2083 - stmt_levl, stmt_upd_sect, verbose, 2084 - current, total); 2077 + stmt_data, stmt_tils, stmt_sect, stmt_levl, 2078 + stmt_upd_sect, verbose, current, total); 2085 2079 2086 2080 if (is_jpeg_image (src_path)) 2087 2081 return do_import_jpeg_image (handle, max_threads, src_path, cvg, 2088 2082 section, force_srid, tile_w, tile_h, 2089 2083 pyramidize, sample_type, num_bands, 2090 - compression, quality, stmt_data, 2091 - stmt_tils, stmt_sect, stmt_levl, 2092 - stmt_upd_sect, verbose, current, total); 2084 + compression, quality, stmt_data, stmt_tils, 2085 + stmt_sect, stmt_levl, stmt_upd_sect, 2086 + verbose, current, total); 2093 2087 2094 2088 #ifndef OMIT_OPENJPEG /* only if OpenJpeg is enabled */ 2095 2089 if (is_jpeg2000_image (src_path)) 2096 2090 return do_import_jpeg2000_image (handle, max_threads, src_path, cvg, 2097 2091 section, force_srid, tile_w, tile_h, 2098 2092 pyramidize, sample_type, num_bands, 2099 2093 compression, quality, stmt_data, ................................................................................ 2225 2219 if (rl2_check_dbms_palette (handle, cvg, origin) != RL2_OK) 2226 2220 { 2227 2221 fprintf (stderr, "Mismatching Palette !!!\n"); 2228 2222 goto error; 2229 2223 } 2230 2224 } 2231 2225 2232 - if (rl2_eval_tiff_origin_compatibility (cvg, origin, force_srid, verbose) 2233 - != RL2_TRUE) 2226 + if (rl2_eval_tiff_origin_compatibility (cvg, origin, force_srid, verbose) != 2227 + RL2_TRUE) 2234 2228 { 2235 2229 fprintf (stderr, "Coverage/TIFF mismatch\n"); 2236 2230 goto error; 2237 2231 } 2238 2232 no_data = rl2_get_coverage_no_data (cvg); 2239 2233 2240 2234 /* INSERTing the section */ 2241 2235 if (!rl2_do_insert_section 2242 - (handle, src_path, section, srid, width, height, minx, miny, maxx, 2243 - maxy, xml_summary, coverage->sectionPaths, coverage->sectionMD5, 2236 + (handle, src_path, section, srid, width, height, minx, miny, maxx, maxy, 2237 + xml_summary, coverage->sectionPaths, coverage->sectionMD5, 2244 2238 coverage->sectionSummary, stmt_sect, §ion_id)) 2245 2239 goto error; 2246 2240 section_stats = rl2_create_raster_statistics (sample_type, num_bands); 2247 2241 if (section_stats == NULL) 2248 2242 goto error; 2249 2243 /* INSERTing the base-levels */ 2250 2244 if (coverage->mixedResolutions) ................................................................................ 2540 2534 if ((c_file.attrib & _A_RDONLY) == _A_RDONLY 2541 2535 || (c_file.attrib & _A_NORMAL) == _A_NORMAL) 2542 2536 { 2543 2537 path = 2544 2538 sqlite3_mprintf ("%s/%s", dir_path, 2545 2539 c_file.name); 2546 2540 ret = 2547 - do_import_file (handle, max_threads, path, 2548 - cvg, section, worldfile, 2549 - force_srid, pyramidize, 2550 - sample_type, pixel_type, 2551 - num_bands, tile_w, tile_h, 2552 - compression, quality, 2553 - stmt_data, stmt_tils, 2554 - stmt_sect, stmt_levl, 2555 - stmt_upd_sect, verbose, 2556 - cnt + 1, total); 2541 + do_import_file (handle, max_threads, path, cvg, 2542 + section, worldfile, force_srid, 2543 + pyramidize, sample_type, 2544 + pixel_type, num_bands, tile_w, 2545 + tile_h, compression, quality, 2546 + stmt_data, stmt_tils, stmt_sect, 2547 + stmt_levl, stmt_upd_sect, 2548 + verbose, cnt + 1, total); 2557 2549 sqlite3_free (path); 2558 2550 if (!ret) 2559 2551 goto error; 2560 2552 cnt++; 2561 2553 } 2562 2554 if (_findnext (hFile, &c_file) != 0) 2563 2555 break; ................................................................................ 2780 2772 stmt_sect, stmt_levl, stmt_upd_sect, verbose, -1, -1)) 2781 2773 goto error; 2782 2774 } 2783 2775 else 2784 2776 { 2785 2777 /* importing all Image files from a whole directory */ 2786 2778 if (!do_import_dir 2787 - (handle, max_threads, dir_path, file_ext, cvg, section, 2788 - worldfile, force_srid, pyramidize, sample_type, pixel_type, 2789 - num_bands, tile_w, tile_h, compression, quality, stmt_data, 2790 - stmt_tils, stmt_sect, stmt_levl, stmt_upd_sect, verbose)) 2779 + (handle, max_threads, dir_path, file_ext, cvg, section, worldfile, 2780 + force_srid, pyramidize, sample_type, pixel_type, num_bands, 2781 + tile_w, tile_h, compression, quality, stmt_data, stmt_tils, 2782 + stmt_sect, stmt_levl, stmt_upd_sect, verbose)) 2791 2783 goto error; 2792 2784 } 2793 2785 2794 2786 sqlite3_finalize (stmt_upd_sect); 2795 2787 sqlite3_finalize (stmt_sect); 2796 2788 sqlite3_finalize (stmt_levl); 2797 2789 sqlite3_finalize (stmt_tils); ................................................................................ 2969 2961 } 2970 2962 *p_out++ = *p_in++; 2971 2963 } 2972 2964 } 2973 2965 } 2974 2966 2975 2967 static void 2976 -copy_uint16_outbuf_to_tile (const unsigned short *outbuf, 2977 - unsigned short *tile, unsigned char num_bands, 2978 - unsigned int width, unsigned int height, 2979 - unsigned int tile_width, unsigned int tile_height, 2980 - unsigned int base_y, unsigned int base_x) 2968 +copy_uint16_outbuf_to_tile (const unsigned short *outbuf, unsigned short *tile, 2969 + unsigned char num_bands, unsigned int width, 2970 + unsigned int height, 2971 + unsigned int tile_width, 2972 + unsigned int tile_height, unsigned int base_y, 2973 + unsigned int base_x) 2981 2974 { 2982 2975 /* copying UINT16 pixels from the output buffer into the tile */ 2983 2976 unsigned int x; 2984 2977 unsigned int y; 2985 2978 int b; 2986 2979 const unsigned short *p_in; 2987 2980 unsigned short *p_out = tile; ................................................................................ 3147 3140 case RL2_SAMPLE_INT8: 3148 3141 copy_int8_outbuf_to_tile ((char *) outbuf, 3149 3142 (char *) tile, width, height, tile_width, 3150 3143 tile_height, base_y, base_x); 3151 3144 break; 3152 3145 case RL2_SAMPLE_INT16: 3153 3146 copy_int16_outbuf_to_tile ((short *) outbuf, 3154 - (short *) tile, width, height, 3155 - tile_width, tile_height, base_y, base_x); 3147 + (short *) tile, width, height, tile_width, 3148 + tile_height, base_y, base_x); 3156 3149 break; 3157 3150 case RL2_SAMPLE_UINT16: 3158 3151 copy_uint16_outbuf_to_tile ((unsigned short *) outbuf, 3159 3152 (unsigned short *) tile, num_bands, 3160 3153 width, height, tile_width, tile_height, 3161 3154 base_y, base_x); 3162 3155 break; ................................................................................ 3168 3161 case RL2_SAMPLE_UINT32: 3169 3162 copy_uint32_outbuf_to_tile ((unsigned int *) outbuf, 3170 3163 (unsigned int *) tile, width, height, 3171 3164 tile_width, tile_height, base_y, base_x); 3172 3165 break; 3173 3166 case RL2_SAMPLE_FLOAT: 3174 3167 copy_float_outbuf_to_tile ((float *) outbuf, 3175 - (float *) tile, width, height, 3176 - tile_width, tile_height, base_y, base_x); 3168 + (float *) tile, width, height, tile_width, 3169 + tile_height, base_y, base_x); 3177 3170 break; 3178 3171 case RL2_SAMPLE_DOUBLE: 3179 3172 copy_double_outbuf_to_tile ((double *) outbuf, 3180 3173 (double *) tile, width, height, 3181 3174 tile_width, tile_height, base_y, base_x); 3182 3175 break; 3183 3176 default: ................................................................................ 3186 3179 height, tile_width, tile_height, base_y, 3187 3180 base_x); 3188 3181 break; 3189 3182 }; 3190 3183 } 3191 3184 3192 3185 static int 3193 -export_geotiff_common (sqlite3 * handle, int max_threads, 3194 - const char *dst_path, rl2CoveragePtr cvg, 3195 - int by_section, sqlite3_int64 section_id, double x_res, 3196 - double y_res, double minx, double miny, double maxx, 3197 - double maxy, unsigned int width, unsigned int height, 3186 +export_geotiff_common (sqlite3 * handle, int max_threads, const char *dst_path, 3187 + rl2CoveragePtr cvg, int by_section, 3188 + sqlite3_int64 section_id, double x_res, double y_res, 3189 + double minx, double miny, double maxx, double maxy, 3190 + unsigned int width, unsigned int height, 3198 3191 unsigned char compression, unsigned int tile_sz, 3199 3192 int with_worldfile) 3200 3193 { 3201 3194 /* exporting a GeoTIFF common implementation */ 3202 3195 rl2RasterPtr raster = NULL; 3203 3196 rl2PalettePtr palette = NULL; 3204 3197 rl2PalettePtr plt2 = NULL; ................................................................................ 3261 3254 } 3262 3255 } 3263 3256 3264 3257 if (by_section) 3265 3258 { 3266 3259 /* just a single Section */ 3267 3260 if (rl2_get_section_raw_raster_data 3268 - (handle, max_threads, cvg, section_id, width, height, minx, 3269 - miny, maxx, maxy, xx_res, yy_res, &outbuf, &outbuf_size, 3270 - &palette, pixel_type) != RL2_OK) 3261 + (handle, max_threads, cvg, section_id, width, height, minx, miny, 3262 + maxx, maxy, xx_res, yy_res, &outbuf, &outbuf_size, &palette, 3263 + pixel_type) != RL2_OK) 3271 3264 goto error; 3272 3265 } 3273 3266 else 3274 3267 { 3275 3268 /* whole Coverage */ 3276 3269 if (rl2_get_raw_raster_data 3277 - (handle, max_threads, cvg, width, height, minx, miny, maxx, 3278 - maxy, xx_res, yy_res, &outbuf, &outbuf_size, &palette, 3270 + (handle, max_threads, cvg, width, height, minx, miny, maxx, maxy, 3271 + xx_res, yy_res, &outbuf, &outbuf_size, &palette, 3279 3272 pixel_type) != RL2_OK) 3280 3273 goto error; 3281 3274 } 3282 3275 3283 3276 /* computing the sample size */ 3284 3277 switch (sample_type) 3285 3278 { ................................................................................ 3318 3311 "rl2tool Export: Insufficient Memory !!!\n"); 3319 3312 goto error; 3320 3313 } 3321 3314 if (pixel_type == RL2_PIXEL_PALETTE && palette != NULL) 3322 3315 rl2_prime_void_tile_palette (bufpix, tile_sz, tile_sz, 3323 3316 no_data); 3324 3317 else 3325 - rl2_prime_void_tile (bufpix, tile_sz, tile_sz, 3326 - sample_type, num_bands, no_data); 3318 + rl2_prime_void_tile (bufpix, tile_sz, tile_sz, sample_type, 3319 + num_bands, no_data); 3327 3320 copy_from_outbuf_to_tile (outbuf, bufpix, sample_type, 3328 3321 num_bands, width, height, tile_sz, 3329 3322 tile_sz, base_y, base_x); 3330 3323 plt2 = rl2_clone_palette (palette); 3331 3324 raster = 3332 3325 rl2_create_raster (tile_sz, tile_sz, sample_type, 3333 3326 pixel_type, num_bands, bufpix, ................................................................................ 3383 3376 return export_geotiff_common (handle, max_threads, dst_path, cvg, 0, 0, 3384 3377 x_res, y_res, minx, miny, maxx, maxy, width, 3385 3378 height, compression, tile_sz, with_worldfile); 3386 3379 } 3387 3380 3388 3381 RL2_DECLARE int 3389 3382 rl2_export_section_geotiff_from_dbms (sqlite3 * handle, int max_threads, 3390 - const char *dst_path, 3391 - rl2CoveragePtr cvg, 3383 + const char *dst_path, rl2CoveragePtr cvg, 3392 3384 sqlite3_int64 section_id, double x_res, 3393 3385 double y_res, double minx, double miny, 3394 3386 double maxx, double maxy, 3395 3387 unsigned int width, unsigned int height, 3396 3388 unsigned char compression, 3397 3389 unsigned int tile_sz, int with_worldfile) 3398 3390 { ................................................................................ 3475 3467 } 3476 3468 } 3477 3469 3478 3470 if (by_section) 3479 3471 { 3480 3472 /* just a single select Section */ 3481 3473 if (rl2_get_section_raw_raster_data 3482 - (handle, max_threads, cvg, section_id, width, height, minx, 3483 - miny, maxx, maxy, xx_res, yy_res, &outbuf, &outbuf_size, 3484 - &palette, pixel_type) != RL2_OK) 3474 + (handle, max_threads, cvg, section_id, width, height, minx, miny, 3475 + maxx, maxy, xx_res, yy_res, &outbuf, &outbuf_size, &palette, 3476 + pixel_type) != RL2_OK) 3485 3477 goto error; 3486 3478 } 3487 3479 else 3488 3480 { 3489 3481 /* whole Coverage */ 3490 3482 if (rl2_get_raw_raster_data 3491 - (handle, max_threads, cvg, width, height, minx, miny, maxx, 3492 - maxy, xx_res, yy_res, &outbuf, &outbuf_size, &palette, 3483 + (handle, max_threads, cvg, width, height, minx, miny, maxx, maxy, 3484 + xx_res, yy_res, &outbuf, &outbuf_size, &palette, 3493 3485 pixel_type) != RL2_OK) 3494 3486 goto error; 3495 3487 } 3496 3488 3497 3489 /* computing the sample size */ 3498 3490 switch (sample_type) 3499 3491 { ................................................................................ 3510 3502 pix_sz = 8; 3511 3503 break; 3512 3504 }; 3513 3505 3514 3506 tiff = 3515 3507 rl2_create_tiff_worldfile_destination (dst_path, width, height, 3516 3508 sample_type, pixel_type, 3517 - num_bands, palette, 3518 - compression, 1, tile_sz, srid, 3519 - minx, miny, maxx, maxy, xx_res, 3520 - yy_res); 3509 + num_bands, palette, compression, 3510 + 1, tile_sz, srid, minx, miny, 3511 + maxx, maxy, xx_res, yy_res); 3521 3512 if (tiff == NULL) 3522 3513 goto error; 3523 3514 for (base_y = 0; base_y < height; base_y += tile_sz) 3524 3515 { 3525 3516 for (base_x = 0; base_x < width; base_x += tile_sz) 3526 3517 { 3527 3518 /* exporting all tiles from the output buffer */ ................................................................................ 3533 3524 "rl2tool Export: Insufficient Memory !!!\n"); 3534 3525 goto error; 3535 3526 } 3536 3527 if (pixel_type == RL2_PIXEL_PALETTE && palette != NULL) 3537 3528 rl2_prime_void_tile_palette (bufpix, tile_sz, tile_sz, 3538 3529 no_data); 3539 3530 else 3540 - rl2_prime_void_tile (bufpix, tile_sz, tile_sz, 3541 - sample_type, num_bands, no_data); 3531 + rl2_prime_void_tile (bufpix, tile_sz, tile_sz, sample_type, 3532 + num_bands, no_data); 3542 3533 copy_from_outbuf_to_tile (outbuf, bufpix, sample_type, 3543 3534 num_bands, width, height, tile_sz, 3544 3535 tile_sz, base_y, base_x); 3545 3536 plt2 = rl2_clone_palette (palette); 3546 3537 raster = 3547 3538 rl2_create_raster (tile_sz, tile_sz, sample_type, 3548 3539 pixel_type, num_bands, bufpix, ................................................................................ 3589 3580 double miny, double maxx, double maxy, 3590 3581 unsigned int width, unsigned int height, 3591 3582 unsigned char compression, 3592 3583 unsigned int tile_sz) 3593 3584 { 3594 3585 /* exporting a TIFF+TFW from the DBMS into the file-system */ 3595 3586 return export_tiff_worlfile_common (handle, max_threads, dst_path, cvg, 0, 3596 - 0, x_res, y_res, minx, miny, maxx, 3597 - maxy, width, height, compression, 3598 - tile_sz); 3587 + 0, x_res, y_res, minx, miny, maxx, maxy, 3588 + width, height, compression, tile_sz); 3599 3589 } 3600 3590 3601 3591 RL2_DECLARE int 3602 -rl2_export_section_tiff_worldfile_from_dbms (sqlite3 * handle, 3603 - int max_threads, 3592 +rl2_export_section_tiff_worldfile_from_dbms (sqlite3 * handle, int max_threads, 3604 3593 const char *dst_path, 3605 3594 rl2CoveragePtr cvg, 3606 3595 sqlite3_int64 section_id, 3607 3596 double x_res, double y_res, 3608 3597 double minx, double miny, 3609 3598 double maxx, double maxy, 3610 3599 unsigned int width, ................................................................................ 3611 3600 unsigned int height, 3612 3601 unsigned char compression, 3613 3602 unsigned int tile_sz) 3614 3603 { 3615 3604 /* exporting a TIFF+TFW - single Section */ 3616 3605 return export_tiff_worlfile_common (handle, max_threads, dst_path, cvg, 1, 3617 3606 section_id, x_res, y_res, minx, miny, 3618 - maxx, maxy, width, height, 3619 - compression, tile_sz); 3607 + maxx, maxy, width, height, compression, 3608 + tile_sz); 3620 3609 } 3621 3610 3622 3611 static int 3623 3612 export_tiff_common (sqlite3 * handle, int max_threads, const char *dst_path, 3624 3613 rl2CoveragePtr cvg, int by_section, 3625 3614 sqlite3_int64 section_id, double x_res, double y_res, 3626 3615 double minx, double miny, double maxx, double maxy, ................................................................................ 3692 3681 } 3693 3682 } 3694 3683 3695 3684 if (by_section) 3696 3685 { 3697 3686 /* just a single Section */ 3698 3687 if (rl2_get_section_raw_raster_data 3699 - (handle, max_threads, cvg, section_id, width, height, minx, 3700 - miny, maxx, maxy, xx_res, yy_res, &outbuf, &outbuf_size, 3701 - &palette, pixel_type) != RL2_OK) 3688 + (handle, max_threads, cvg, section_id, width, height, minx, miny, 3689 + maxx, maxy, xx_res, yy_res, &outbuf, &outbuf_size, &palette, 3690 + pixel_type) != RL2_OK) 3702 3691 goto error; 3703 3692 } 3704 3693 else 3705 3694 { 3706 3695 /* whole Coverage */ 3707 3696 if (rl2_get_raw_raster_data 3708 - (handle, max_threads, cvg, width, height, minx, miny, maxx, 3709 - maxy, xx_res, yy_res, &outbuf, &outbuf_size, &palette, 3697 + (handle, max_threads, cvg, width, height, minx, miny, maxx, maxy, 3698 + xx_res, yy_res, &outbuf, &outbuf_size, &palette, 3710 3699 pixel_type) != RL2_OK) 3711 3700 goto error; 3712 3701 } 3713 3702 3714 3703 /* computing the sample size */ 3715 3704 switch (sample_type) 3716 3705 { ................................................................................ 3747 3736 "rl2tool Export: Insufficient Memory !!!\n"); 3748 3737 goto error; 3749 3738 } 3750 3739 if (pixel_type == RL2_PIXEL_PALETTE && palette != NULL) 3751 3740 rl2_prime_void_tile_palette (bufpix, tile_sz, tile_sz, 3752 3741 no_data); 3753 3742 else 3754 - rl2_prime_void_tile (bufpix, tile_sz, tile_sz, 3755 - sample_type, num_bands, no_data); 3743 + rl2_prime_void_tile (bufpix, tile_sz, tile_sz, sample_type, 3744 + num_bands, no_data); 3756 3745 copy_from_outbuf_to_tile (outbuf, bufpix, sample_type, 3757 3746 num_bands, width, height, tile_sz, 3758 3747 tile_sz, base_y, base_x); 3759 3748 plt2 = rl2_clone_palette (palette); 3760 3749 raster = 3761 3750 rl2_create_raster (tile_sz, tile_sz, sample_type, 3762 3751 pixel_type, num_bands, bufpix, ................................................................................ 3791 3780 rl2_destroy_palette (palette); 3792 3781 return RL2_ERROR; 3793 3782 } 3794 3783 3795 3784 RL2_DECLARE int 3796 3785 rl2_export_tiff_from_dbms (sqlite3 * handle, int max_threads, 3797 3786 const char *dst_path, rl2CoveragePtr cvg, 3798 - double x_res, double y_res, double minx, 3799 - double miny, double maxx, double maxy, 3800 - unsigned int width, unsigned int height, 3801 - unsigned char compression, unsigned int tile_sz) 3787 + double x_res, double y_res, double minx, double miny, 3788 + double maxx, double maxy, unsigned int width, 3789 + unsigned int height, unsigned char compression, 3790 + unsigned int tile_sz) 3802 3791 { 3803 3792 /* exporting a plain TIFF from the DBMS into the file-system */ 3804 - return export_tiff_common (handle, max_threads, dst_path, cvg, 0, 0, 3805 - x_res, y_res, minx, miny, maxx, maxy, width, 3806 - height, compression, tile_sz); 3793 + return export_tiff_common (handle, max_threads, dst_path, cvg, 0, 0, x_res, 3794 + y_res, minx, miny, maxx, maxy, width, height, 3795 + compression, tile_sz); 3807 3796 } 3808 3797 3809 3798 RL2_DECLARE int 3810 3799 rl2_export_section_tiff_from_dbms (sqlite3 * handle, int max_threads, 3811 3800 const char *dst_path, rl2CoveragePtr cvg, 3812 3801 sqlite3_int64 section_id, double x_res, 3813 3802 double y_res, double minx, double miny, 3814 - double maxx, double maxy, 3815 - unsigned int width, unsigned int height, 3803 + double maxx, double maxy, unsigned int width, 3804 + unsigned int height, 3816 3805 unsigned char compression, 3817 3806 unsigned int tile_sz) 3818 3807 { 3819 3808 /* exporting a plain TIFF - single Section*/ 3820 3809 return export_tiff_common (handle, max_threads, dst_path, cvg, 1, 3821 - section_id, x_res, y_res, minx, miny, maxx, 3822 - maxy, width, height, compression, tile_sz); 3810 + section_id, x_res, y_res, minx, miny, maxx, maxy, 3811 + width, height, compression, tile_sz); 3823 3812 } 3824 3813 3825 3814 static int 3826 3815 export_triple_band_geotiff_common (int by_section, sqlite3 * handle, 3827 3816 const char *dst_path, 3828 - rl2CoveragePtr cvg, 3829 - sqlite3_int64 section_id, double x_res, 3830 - double y_res, double minx, double miny, 3831 - double maxx, double maxy, 3817 + rl2CoveragePtr cvg, sqlite3_int64 section_id, 3818 + double x_res, double y_res, double minx, 3819 + double miny, double maxx, double maxy, 3832 3820 unsigned int width, unsigned int height, 3833 3821 unsigned char red_band, 3834 3822 unsigned char green_band, 3835 3823 unsigned char blue_band, 3836 3824 unsigned char compression, 3837 3825 unsigned int tile_sz, int with_worldfile) 3838 3826 { ................................................................................ 3904 3892 goto error; 3905 3893 } 3906 3894 3907 3895 tiff = 3908 3896 rl2_create_geotiff_destination (dst_path, handle, width, height, 3909 3897 sample_type, RL2_PIXEL_RGB, 3, 3910 3898 NULL, compression, 1, tile_sz, srid, 3911 - minx, miny, maxx, maxy, xx_res, 3912 - yy_res, with_worldfile); 3899 + minx, miny, maxx, maxy, xx_res, yy_res, 3900 + with_worldfile); 3913 3901 if (tiff == NULL) 3914 3902 goto error; 3915 3903 for (base_y = 0; base_y < height; base_y += tile_sz) 3916 3904 { 3917 3905 for (base_x = 0; base_x < width; base_x += tile_sz) 3918 3906 { 3919 3907 /* exporting all tiles from the output buffer */ ................................................................................ 4102 4090 else 4103 4091 out_pixel = RL2_PIXEL_GRAYSCALE; 4104 4092 4105 4093 tiff = 4106 4094 rl2_create_geotiff_destination (dst_path, handle, width, height, 4107 4095 sample_type, out_pixel, 1, 4108 4096 NULL, compression, 1, tile_sz, srid, 4109 - minx, miny, maxx, maxy, xx_res, 4110 - yy_res, with_worldfile); 4097 + minx, miny, maxx, maxy, xx_res, yy_res, 4098 + with_worldfile); 4111 4099 if (tiff == NULL) 4112 4100 goto error; 4113 4101 for (base_y = 0; base_y < height; base_y += tile_sz) 4114 4102 { 4115 4103 for (base_x = 0; base_x < width; base_x += tile_sz) 4116 4104 { 4117 4105 /* exporting all tiles from the output buffer */ ................................................................................ 4182 4170 unsigned int height, 4183 4171 unsigned char mono_band, 4184 4172 unsigned char compression, 4185 4173 unsigned int tile_sz, 4186 4174 int with_worldfile) 4187 4175 { 4188 4176 /* exporting a Mono-Band GeoTIFF from the DBMS into the file-system */ 4189 - return export_mono_band_geotiff_common (0, handle, dst_path, cvg, 0, 4190 - x_res, y_res, minx, miny, maxx, 4191 - maxy, width, height, mono_band, 4177 + return export_mono_band_geotiff_common (0, handle, dst_path, cvg, 0, x_res, 4178 + y_res, minx, miny, maxx, maxy, 4179 + width, height, mono_band, 4192 4180 compression, tile_sz, 4193 4181 with_worldfile); 4194 4182 } 4195 4183 4196 4184 RL2_DECLARE int 4197 4185 rl2_export_section_mono_band_geotiff_from_dbms (sqlite3 * handle, 4198 4186 const char *dst_path, ................................................................................ 4218 4206 4219 4207 static int 4220 4208 export_triple_band_tiff_worldfile_common (int by_section, sqlite3 * handle, 4221 4209 const char *dst_path, 4222 4210 rl2CoveragePtr cvg, 4223 4211 sqlite3_int64 section_id, 4224 4212 double x_res, double y_res, 4225 - double minx, double miny, 4226 - double maxx, double maxy, 4227 - unsigned int width, 4213 + double minx, double miny, double maxx, 4214 + double maxy, unsigned int width, 4228 4215 unsigned int height, 4229 4216 unsigned char red_band, 4230 4217 unsigned char green_band, 4231 4218 unsigned char blue_band, 4232 4219 unsigned char compression, 4233 4220 unsigned int tile_sz) 4234 4221 { ................................................................................ 4299 4286 no_data) != RL2_OK) 4300 4287 goto error; 4301 4288 } 4302 4289 4303 4290 tiff = 4304 4291 rl2_create_tiff_worldfile_destination (dst_path, width, height, 4305 4292 sample_type, RL2_PIXEL_RGB, 4306 - 3, NULL, compression, 1, 4307 - tile_sz, srid, minx, miny, 4308 - maxx, maxy, xx_res, yy_res); 4293 + 3, NULL, compression, 1, tile_sz, 4294 + srid, minx, miny, maxx, maxy, 4295 + xx_res, yy_res); 4309 4296 if (tiff == NULL) 4310 4297 goto error; 4311 4298 for (base_y = 0; base_y < height; base_y += tile_sz) 4312 4299 { 4313 4300 for (base_x = 0; base_x < width; base_x += tile_sz) 4314 4301 { 4315 4302 /* exporting all tiles from the output buffer */ ................................................................................ 4401 4388 double y_res, 4402 4389 double minx, 4403 4390 double miny, 4404 4391 double maxx, 4405 4392 double maxy, 4406 4393 unsigned int width, 4407 4394 unsigned int height, 4408 - unsigned char 4409 - red_band, 4395 + unsigned char red_band, 4410 4396 unsigned char 4411 4397 green_band, 4412 4398 unsigned char 4413 4399 blue_band, 4414 4400 unsigned char 4415 4401 compression, 4416 4402 unsigned int tile_sz) ................................................................................ 4424 4410 compression, tile_sz); 4425 4411 } 4426 4412 4427 4413 static int 4428 4414 export_mono_band_tiff_worldfile_common (int by_section, sqlite3 * handle, 4429 4415 const char *dst_path, 4430 4416 rl2CoveragePtr cvg, 4431 - sqlite3_int64 section_id, 4432 - double x_res, double y_res, 4433 - double minx, double miny, double maxx, 4434 - double maxy, unsigned int width, 4435 - unsigned int height, 4417 + sqlite3_int64 section_id, double x_res, 4418 + double y_res, double minx, double miny, 4419 + double maxx, double maxy, 4420 + unsigned int width, unsigned int height, 4436 4421 unsigned char mono_band, 4437 4422 unsigned char compression, 4438 4423 unsigned int tile_sz) 4439 4424 { 4440 4425 /* exporting a Mono-Band TIFF+TFW - common implementation */ 4441 4426 rl2RasterPtr raster = NULL; 4442 4427 rl2PixelPtr no_data_multi = NULL; ................................................................................ 4503 4488 out_pixel = RL2_PIXEL_DATAGRID; 4504 4489 else 4505 4490 out_pixel = RL2_PIXEL_GRAYSCALE; 4506 4491 4507 4492 tiff = 4508 4493 rl2_create_tiff_worldfile_destination (dst_path, width, height, 4509 4494 sample_type, out_pixel, 4510 - 1, NULL, compression, 1, 4511 - tile_sz, srid, minx, miny, 4512 - maxx, maxy, xx_res, yy_res); 4495 + 1, NULL, compression, 1, tile_sz, 4496 + srid, minx, miny, maxx, maxy, 4497 + xx_res, yy_res); 4513 4498 if (tiff == NULL) 4514 4499 goto error; 4515 4500 for (base_y = 0; base_y < height; base_y += tile_sz) 4516 4501 { 4517 4502 for (base_x = 0; base_x < width; base_x += tile_sz) 4518 4503 { 4519 4504 /* exporting all tiles from the output buffer */ ................................................................................ 4581 4566 unsigned int width, 4582 4567 unsigned int height, 4583 4568 unsigned char mono_band, 4584 4569 unsigned char compression, 4585 4570 unsigned int tile_sz) 4586 4571 { 4587 4572 /* exporting a Mono-Band TIFF+TFW from the DBMS into the file-system */ 4588 - return export_mono_band_tiff_worldfile_common (0, handle, dst_path, cvg, 4589 - 0, x_res, y_res, minx, 4590 - miny, maxx, maxy, width, 4591 - height, mono_band, 4592 - compression, tile_sz); 4573 + return export_mono_band_tiff_worldfile_common (0, handle, dst_path, cvg, 0, 4574 + x_res, y_res, minx, miny, 4575 + maxx, maxy, width, height, 4576 + mono_band, compression, 4577 + tile_sz); 4593 4578 } 4594 4579 4595 4580 RL2_DECLARE int 4596 4581 rl2_export_section_mono_band_tiff_worldfile_from_dbms (sqlite3 * handle, 4597 4582 const char *dst_path, 4598 4583 rl2CoveragePtr cvg, 4599 - sqlite3_int64 4600 - section_id, 4584 + sqlite3_int64 section_id, 4601 4585 double x_res, 4602 4586 double y_res, 4603 - double minx, 4604 - double miny, 4605 - double maxx, 4606 - double maxy, 4587 + double minx, double miny, 4588 + double maxx, double maxy, 4607 4589 unsigned int width, 4608 4590 unsigned int height, 4609 - unsigned char 4610 - mono_band, 4591 + unsigned char mono_band, 4611 4592 unsigned char 4612 4593 compression, 4613 4594 unsigned int tile_sz) 4614 4595 { 4615 4596 /* exporting a Mono-Band TIFF+TFW - Section */ 4616 4597 return export_mono_band_tiff_worldfile_common (1, handle, dst_path, cvg, 4617 4598 section_id, x_res, y_res, ................................................................................ 4771 4752 unsigned char green_band, 4772 4753 unsigned char blue_band, 4773 4754 unsigned char compression, 4774 4755 unsigned int tile_sz) 4775 4756 { 4776 4757 /* exporting a plain Band-Composed TIFF from the DBMS into the file-system */ 4777 4758 return export_triple_band_tiff_common (0, handle, dst_path, cvg, 0, x_res, 4778 - y_res, minx, miny, maxx, maxy, 4779 - width, height, red_band, 4780 - green_band, blue_band, compression, 4781 - tile_sz); 4759 + y_res, minx, miny, maxx, maxy, width, 4760 + height, red_band, green_band, 4761 + blue_band, compression, tile_sz); 4782 4762 } 4783 4763 4784 4764 RL2_DECLARE int 4785 4765 rl2_export_section_triple_band_tiff_from_dbms (sqlite3 * handle, 4786 4766 const char *dst_path, 4787 4767 rl2CoveragePtr cvg, 4788 4768 sqlite3_int64 section_id, ................................................................................ 4794 4774 unsigned char red_band, 4795 4775 unsigned char green_band, 4796 4776 unsigned char blue_band, 4797 4777 unsigned char compression, 4798 4778 unsigned int tile_sz) 4799 4779 { 4800 4780 /* exporting a plain Band-Composed TIFF - Section */ 4801 - return export_triple_band_tiff_common (1, handle, dst_path, cvg, 4802 - section_id, x_res, y_res, minx, 4803 - miny, maxx, maxy, width, height, 4804 - red_band, green_band, blue_band, 4805 - compression, tile_sz); 4781 + return export_triple_band_tiff_common (1, handle, dst_path, cvg, section_id, 4782 + x_res, y_res, minx, miny, maxx, maxy, 4783 + width, height, red_band, green_band, 4784 + blue_band, compression, tile_sz); 4806 4785 } 4807 4786 4808 4787 static int 4809 4788 export_mono_band_tiff_common (int by_section, sqlite3 * handle, 4810 4789 const char *dst_path, rl2CoveragePtr cvg, 4811 4790 sqlite3_int64 section_id, double x_res, 4812 4791 double y_res, double minx, double miny, ................................................................................ 4973 4952 unsigned char mono_band, 4974 4953 unsigned char compression, 4975 4954 unsigned int tile_sz) 4976 4955 { 4977 4956 /* exporting a plain Mono-Band TIFF from the DBMS - Section */ 4978 4957 return export_mono_band_tiff_common (1, handle, dst_path, cvg, section_id, 4979 4958 x_res, y_res, minx, miny, maxx, maxy, 4980 - width, height, mono_band, 4981 - compression, tile_sz); 4959 + width, height, mono_band, compression, 4960 + tile_sz); 4982 4961 } 4983 4962 4984 4963 static int 4985 4964 export_ascii_grid_common (int by_section, sqlite3 * handle, int max_threads, 4986 4965 const char *dst_path, rl2CoveragePtr cvg, 4987 4966 sqlite3_int64 section_id, double res, double minx, 4988 4967 double miny, double maxx, double maxy, ................................................................................ 5082 5061 } 5083 5062 } 5084 5063 5085 5064 if (by_section) 5086 5065 { 5087 5066 /* single Section */ 5088 5067 if (rl2_get_section_raw_raster_data 5089 - (handle, max_threads, cvg, section_id, width, height, minx, 5090 - miny, maxx, maxy, res, res, &pixels, &pixels_size, &palette, 5068 + (handle, max_threads, cvg, section_id, width, height, minx, miny, 5069 + maxx, maxy, res, res, &pixels, &pixels_size, &palette, 5091 5070 RL2_PIXEL_DATAGRID) != RL2_OK) 5092 5071 goto error; 5093 5072 } 5094 5073 else 5095 5074 { 5096 5075 /* whole Coverage */ 5097 5076 if (rl2_get_raw_raster_data 5098 - (handle, max_threads, cvg, width, height, minx, miny, maxx, 5099 - maxy, res, res, &pixels, &pixels_size, &palette, 5077 + (handle, max_threads, cvg, width, height, minx, miny, maxx, maxy, 5078 + res, res, &pixels, &pixels_size, &palette, 5100 5079 RL2_PIXEL_DATAGRID) != RL2_OK) 5101 5080 goto error; 5102 5081 } 5103 5082 5104 5083 ascii = 5105 5084 rl2_create_ascii_grid_destination (dst_path, width, height, 5106 5085 xx_res, minx, miny, is_centered, ................................................................................ 5141 5120 double res, double minx, double miny, 5142 5121 double maxx, double maxy, unsigned int width, 5143 5122 unsigned int height, int is_centered, 5144 5123 int decimal_digits) 5145 5124 { 5146 5125 /* exporting an ASCII Grid from the DBMS into the file-system */ 5147 5126 return export_ascii_grid_common (0, handle, max_threads, dst_path, cvg, 0, 5148 - res, minx, miny, maxx, maxy, width, 5149 - height, is_centered, decimal_digits); 5127 + res, minx, miny, maxx, maxy, width, height, 5128 + is_centered, decimal_digits); 5150 5129 } 5151 5130 5152 5131 RL2_DECLARE int 5153 5132 rl2_export_section_ascii_grid_from_dbms (sqlite3 * handle, int max_threads, 5154 5133 const char *dst_path, 5155 5134 rl2CoveragePtr cvg, 5156 5135 sqlite3_int64 section_id, double res, 5157 - double minx, double miny, 5158 - double maxx, double maxy, 5159 - unsigned int width, 5136 + double minx, double miny, double maxx, 5137 + double maxy, unsigned int width, 5160 5138 unsigned int height, int is_centered, 5161 5139 int decimal_digits) 5162 5140 { 5163 5141 /* exporting an ASCII Grid - Section */ 5164 5142 return export_ascii_grid_common (1, handle, max_threads, dst_path, cvg, 5165 5143 section_id, res, minx, miny, maxx, maxy, 5166 5144 width, height, is_centered, ................................................................................ 5206 5184 if (match == no_data->nBands) 5207 5185 return 1; 5208 5186 } 5209 5187 return 0; 5210 5188 } 5211 5189 5212 5190 static float 5213 -compute_ndvi (void *pixels, unsigned char sample_type, 5214 - unsigned char num_bands, unsigned short width, 5215 - unsigned char red_band, unsigned char nir_band, 5216 - unsigned short row, unsigned short col, 5191 +compute_ndvi (void *pixels, unsigned char sample_type, unsigned char num_bands, 5192 + unsigned short width, unsigned char red_band, 5193 + unsigned char nir_band, unsigned short row, unsigned short col, 5217 5194 rl2PrivPixelPtr in_no_data, float out_no_data) 5218 5195 { 5219 5196 /* computing a Normalized Difference Vegetaion Index -NDVI */ 5220 5197 float red; 5221 5198 float nir; 5222 5199 unsigned char *p8; 5223 5200 unsigned short *p16; ................................................................................ 5246 5223 5247 5224 static int 5248 5225 export_ndvi_ascii_grid_common (int by_section, sqlite3 * handle, 5249 5226 int max_threads, const char *dst_path, 5250 5227 rl2CoveragePtr cvg, sqlite3_int64 section_id, 5251 5228 double res, double minx, double miny, 5252 5229 double maxx, double maxy, unsigned int width, 5253 - unsigned int height, int red_band, 5254 - int nir_band, int is_centered, 5255 - int decimal_digits) 5230 + unsigned int height, int red_band, int nir_band, 5231 + int is_centered, int decimal_digits) 5256 5232 { 5257 5233 /* exporting an NDVI ASCII Grid common implementation */ 5258 5234 rl2PalettePtr palette = NULL; 5259 5235 rl2PixelPtr in_no_data; 5260 5236 rl2AsciiGridDestinationPtr ascii = NULL; 5261 5237 unsigned char level; 5262 5238 unsigned char scale; ................................................................................ 5301 5277 if (red_band == nir_band) 5302 5278 goto error; 5303 5279 5304 5280 if (by_section) 5305 5281 { 5306 5282 /* single Section */ 5307 5283 if (rl2_get_section_raw_raster_data 5308 - (handle, max_threads, cvg, section_id, width, height, minx, 5309 - miny, maxx, maxy, res, res, &pixels, &pixels_size, &palette, 5284 + (handle, max_threads, cvg, section_id, width, height, minx, miny, 5285 + maxx, maxy, res, res, &pixels, &pixels_size, &palette, 5310 5286 RL2_PIXEL_MULTIBAND) != RL2_OK) 5311 5287 goto error; 5312 5288 } 5313 5289 else 5314 5290 { 5315 5291 /* whole Coverage */ 5316 5292 if (rl2_get_raw_raster_data 5317 - (handle, max_threads, cvg, width, height, minx, miny, maxx, 5318 - maxy, res, res, &pixels, &pixels_size, &palette, 5293 + (handle, max_threads, cvg, width, height, minx, miny, maxx, maxy, 5294 + res, res, &pixels, &pixels_size, &palette, 5319 5295 RL2_PIXEL_MULTIBAND) != RL2_OK) 5320 5296 goto error; 5321 5297 } 5322 5298 5323 5299 /* creating the output NDVI raster */ 5324 5300 out_pixels_size = width * height * sizeof (float); 5325 5301 out_pixels = malloc (out_pixels_size); ................................................................................ 5327 5303 goto error; 5328 5304 po = (float *) out_pixels; 5329 5305 for (row = 0; row < height; row++) 5330 5306 { 5331 5307 /* computing NDVI */ 5332 5308 for (col = 0; col < width; col++) 5333 5309 *po++ = 5334 - compute_ndvi (pixels, sample_type, num_bands, width, 5335 - red_band, nir_band, row, col, 5310 + compute_ndvi (pixels, sample_type, num_bands, width, red_band, 5311 + nir_band, row, col, 5336 5312 (rl2PrivPixelPtr) in_no_data, out_no_data); 5337 5313 } 5338 5314 free (pixels); 5339 5315 pixels = NULL; 5340 5316 5341 5317 ascii = 5342 5318 rl2_create_ascii_grid_destination (dst_path, width, height, ................................................................................ 5371 5347 if (palette != NULL) 5372 5348 rl2_destroy_palette (palette); 5373 5349 return RL2_ERROR; 5374 5350 } 5375 5351 5376 5352 RL2_DECLARE int 5377 5353 rl2_export_ndvi_ascii_grid_from_dbms (sqlite3 * handle, int max_threads, 5378 - const char *dst_path, 5379 - rl2CoveragePtr cvg, double res, 5380 - double minx, double miny, double maxx, 5381 - double maxy, unsigned int width, 5382 - unsigned int height, int red_band, 5383 - int nir_band, int is_centered, 5384 - int decimal_digits) 5354 + const char *dst_path, rl2CoveragePtr cvg, 5355 + double res, double minx, double miny, 5356 + double maxx, double maxy, 5357 + unsigned int width, unsigned int height, 5358 + int red_band, int nir_band, 5359 + int is_centered, int decimal_digits) 5385 5360 { 5386 5361 /* exporting an ASCII Grid from the DBMS into the file-system */ 5387 - return export_ndvi_ascii_grid_common (0, handle, max_threads, dst_path, 5388 - cvg, 0, res, minx, miny, maxx, maxy, 5389 - width, height, red_band, nir_band, 5362 + return export_ndvi_ascii_grid_common (0, handle, max_threads, dst_path, cvg, 5363 + 0, res, minx, miny, maxx, maxy, width, 5364 + height, red_band, nir_band, 5390 5365 is_centered, decimal_digits); 5391 5366 } 5392 5367 5393 5368 RL2_DECLARE int 5394 -rl2_export_section_ndvi_ascii_grid_from_dbms (sqlite3 * handle, 5395 - int max_threads, 5369 +rl2_export_section_ndvi_ascii_grid_from_dbms (sqlite3 * handle, int max_threads, 5396 5370 const char *dst_path, 5397 5371 rl2CoveragePtr cvg, 5398 5372 sqlite3_int64 section_id, 5399 5373 double res, double minx, 5400 5374 double miny, double maxx, 5401 5375 double maxy, unsigned int width, 5402 - unsigned int height, 5403 - int red_band, int nir_band, 5404 - int is_centered, 5376 + unsigned int height, int red_band, 5377 + int nir_band, int is_centered, 5405 5378 int decimal_digits) 5406 5379 { 5407 5380 /* exporting an ASCII Grid - Section */ 5408 - return export_ndvi_ascii_grid_common (1, handle, max_threads, dst_path, 5409 - cvg, section_id, res, minx, miny, 5410 - maxx, maxy, width, height, red_band, 5381 + return export_ndvi_ascii_grid_common (1, handle, max_threads, dst_path, cvg, 5382 + section_id, res, minx, miny, maxx, 5383 + maxy, width, height, red_band, 5411 5384 nir_band, is_centered, 5412 5385 decimal_digits); 5413 5386 } 5414 5387 5415 5388 static int 5416 5389 export_jpeg_common (int by_section, sqlite3 * handle, int max_threads, 5417 5390 const char *dst_path, rl2CoveragePtr cvg, ................................................................................ 5454 5427 else 5455 5428 goto error; 5456 5429 5457 5430 if (by_section) 5458 5431 { 5459 5432 /* single Section */ 5460 5433 if (rl2_get_section_raw_raster_data 5461 - (handle, max_threads, cvg, section_id, width, height, minx, 5462 - miny, maxx, maxy, xx_res, yy_res, &outbuf, &outbuf_size, NULL, 5434 + (handle, max_threads, cvg, section_id, width, height, minx, miny, 5435 + maxx, maxy, xx_res, yy_res, &outbuf, &outbuf_size, NULL, 5463 5436 pixel_type) != RL2_OK) 5464 5437 goto error; 5465 5438 } 5466 5439 else 5467 5440 { 5468 5441 /* whole Coverage */ 5469 5442 if (rl2_get_raw_raster_data 5470 - (handle, max_threads, cvg, width, height, minx, miny, maxx, 5471 - maxy, xx_res, yy_res, &outbuf, &outbuf_size, NULL, 5443 + (handle, max_threads, cvg, width, height, minx, miny, maxx, maxy, 5444 + xx_res, yy_res, &outbuf, &outbuf_size, NULL, 5472 5445 pixel_type) != RL2_OK) 5473 5446 goto error; 5474 5447 } 5475 5448 5476 5449 raster = 5477 5450 rl2_create_raster (width, height, sample_type, pixel_type, num_bands, 5478 5451 outbuf, outbuf_size, NULL, NULL, 0, NULL); ................................................................................ 5505 5478 free (outbuf); 5506 5479 return RL2_ERROR; 5507 5480 } 5508 5481 5509 5482 RL2_DECLARE int 5510 5483 rl2_export_jpeg_from_dbms (sqlite3 * handle, int max_threads, 5511 5484 const char *dst_path, rl2CoveragePtr cvg, 5512 - double x_res, double y_res, double minx, 5513 - double miny, double maxx, double maxy, 5514 - unsigned int width, unsigned int height, 5515 - int quality, int with_worldfile) 5485 + double x_res, double y_res, double minx, double miny, 5486 + double maxx, double maxy, unsigned int width, 5487 + unsigned int height, int quality, int with_worldfile) 5516 5488 { 5517 5489 /* exporting a JPEG (with possible JGW) from the DBMS into the file-system */ 5518 - return export_jpeg_common (0, handle, max_threads, dst_path, cvg, 0, 5519 - x_res, y_res, minx, miny, maxx, maxy, width, 5520 - height, quality, with_worldfile); 5490 + return export_jpeg_common (0, handle, max_threads, dst_path, cvg, 0, x_res, 5491 + y_res, minx, miny, maxx, maxy, width, height, 5492 + quality, with_worldfile); 5521 5493 } 5522 5494 5523 5495 RL2_DECLARE int 5524 5496 rl2_export_section_jpeg_from_dbms (sqlite3 * handle, int max_threads, 5525 5497 const char *dst_path, rl2CoveragePtr cvg, 5526 5498 sqlite3_int64 section_id, double x_res, 5527 5499 double y_res, double minx, double miny, 5528 - double maxx, double maxy, 5529 - unsigned int width, unsigned int height, 5530 - int quality, int with_worldfile) 5500 + double maxx, double maxy, unsigned int width, 5501 + unsigned int height, int quality, 5502 + int with_worldfile) 5531 5503 { 5532 5504 /* exporting a JPEG (with possible JGW) - Section */ 5533 5505 return export_jpeg_common (1, handle, max_threads, dst_path, cvg, 5534 - section_id, x_res, y_res, minx, miny, maxx, 5535 - maxy, width, height, quality, with_worldfile); 5506 + section_id, x_res, y_res, minx, miny, maxx, maxy, 5507 + width, height, quality, with_worldfile); 5536 5508 } 5537 5509 5538 5510 static int 5539 5511 export_raw_pixels_common (int by_section, sqlite3 * handle, int max_threads, 5540 5512 rl2CoveragePtr cvg, sqlite3_int64 section_id, 5541 - double x_res, double y_res, double minx, 5542 - double miny, double maxx, double maxy, 5543 - unsigned int width, unsigned int height, 5544 - int big_endian, unsigned char **blob, int *blob_size) 5513 + double x_res, double y_res, double minx, double miny, 5514 + double maxx, double maxy, unsigned int width, 5515 + unsigned int height, int big_endian, 5516 + unsigned char **blob, int *blob_size) 5545 5517 { 5546 5518 /* common implementation for Export RAW pixels */ 5547 5519 unsigned char level; 5548 5520 unsigned char scale; 5549 5521 double xx_res = x_res; 5550 5522 double yy_res = y_res; 5551 5523 unsigned char sample_type; ................................................................................ 5568 5540 RL2_OK) 5569 5541 goto error; 5570 5542 5571 5543 if (by_section) 5572 5544 { 5573 5545 /* single Section */ 5574 5546 if (rl2_get_section_raw_raster_data 5575 - (handle, max_threads, cvg, section_id, width, height, minx, 5576 - miny, maxx, maxy, xx_res, yy_res, &outbuf, &outbuf_size, NULL, 5547 + (handle, max_threads, cvg, section_id, width, height, minx, miny, 5548 + maxx, maxy, xx_res, yy_res, &outbuf, &outbuf_size, NULL, 5577 5549 pixel_type) != RL2_OK) 5578 5550 goto error; 5579 5551 } 5580 5552 else 5581 5553 { 5582 5554 /* whole Coverage */ 5583 5555 if (rl2_get_raw_raster_data 5584 - (handle, max_threads, cvg, width, height, minx, miny, maxx, 5585 - maxy, xx_res, yy_res, &outbuf, &outbuf_size, NULL, 5556 + (handle, max_threads, cvg, width, height, minx, miny, maxx, maxy, 5557 + xx_res, yy_res, &outbuf, &outbuf_size, NULL, 5586 5558 pixel_type) != RL2_OK) 5587 5559 goto error; 5588 5560 } 5589 5561 bufpix = 5590 5562 rl2_copy_endian_raw_pixels (outbuf, outbuf_size, width, height, 5591 5563 sample_type, num_bands, big_endian); 5592 5564 if (bufpix == NULL) ................................................................................ 5608 5580 double y_res, double minx, double miny, 5609 5581 double maxx, double maxy, 5610 5582 unsigned int width, 5611 5583 unsigned int height, int big_endian, 5612 5584 unsigned char **blob, int *blob_size) 5613 5585 { 5614 5586 /* exporting RAW pixel buffer and Transparency Mask from the DBMS */ 5615 - return export_raw_pixels_common (0, handle, max_threads, coverage, 0, 5616 - x_res, y_res, minx, miny, maxx, maxy, 5617 - width, height, big_endian, blob, 5618 - blob_size); 5587 + return export_raw_pixels_common (0, handle, max_threads, coverage, 0, x_res, 5588 + y_res, minx, miny, maxx, maxy, width, 5589 + height, big_endian, blob, blob_size); 5619 5590 } 5620 5591 5621 5592 RL2_DECLARE int 5622 5593 rl2_export_section_raw_pixels_from_dbms (sqlite3 * handle, int max_threads, 5623 5594 rl2CoveragePtr coverage, 5624 5595 sqlite3_int64 section_id, 5625 5596 double x_res, double y_res, ................................................................................ 5628 5599 unsigned int width, 5629 5600 unsigned int height, 5630 5601 int big_endian, 5631 5602 unsigned char **blob, int *blob_size) 5632 5603 { 5633 5604 /* exporting RAW pixel buffer and Transparency Mask - Section */ 5634 5605 return export_raw_pixels_common (1, handle, max_threads, coverage, 5635 - section_id, x_res, y_res, minx, miny, 5636 - maxx, maxy, width, height, big_endian, 5637 - blob, blob_size); 5606 + section_id, x_res, y_res, minx, miny, maxx, 5607 + maxy, width, height, big_endian, blob, 5608 + blob_size); 5638 5609 } 5639 5610 5640 5611 RL2_DECLARE int 5641 5612 rl2_load_raw_raster_into_dbms (sqlite3 * handle, int max_threads, 5642 5613 rl2CoveragePtr cvg, const char *section, 5643 5614 rl2RasterPtr rst, int pyramidize) 5644 5615 {
Changes to src/rl2jpeg.c.
226 226 /* The source object is made permanent so that a series of JPEG images 227 227 * can be read from the same buffer by calling jpeg_mem_src only before 228 228 * the first one. 229 229 */ 230 230 if (cinfo->src == NULL) 231 231 { /* first time for this JPEG object? */ 232 232 cinfo->src = (struct jpeg_source_mgr *) 233 - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, 234 - JPOOL_PERMANENT, 233 + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, 235 234 sizeof (struct jpeg_source_mgr)); 236 235 } 237 236 238 237 src = cinfo->src; 239 238 src->init_source = init_mem_source; 240 239 src->fill_input_buffer = fill_mem_input_buffer; 241 240 src->skip_input_data = skip_input_data; ................................................................................ 262 261 263 262 /* The destination object is made permanent so that multiple JPEG images 264 263 * can be written to the same buffer without re-executing jpeg_mem_dest. 265 264 */ 266 265 if (cinfo->dest == NULL) 267 266 { /* first time for this JPEG object? */ 268 267 cinfo->dest = (struct jpeg_destination_mgr *) 269 - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, 270 - JPOOL_PERMANENT, 268 + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, 271 269 sizeof (jpeg_mem_destination_mgr)); 272 270 dest = (jpeg_mem_dest_ptr) cinfo->dest; 273 271 dest->newbuffer = NULL; 274 272 } 275 273 276 274 dest = (jpeg_mem_dest_ptr) cinfo->dest; 277 275 dest->pub.init_destination = init_mem_destination; ................................................................................ 755 753 /* creating a JPEG image from a raster */ 756 754 rl2PrivRasterPtr rst = (rl2PrivRasterPtr) raster; 757 755 unsigned char *blob; 758 756 int blob_size; 759 757 760 758 if (rst == NULL) 761 759 return RL2_ERROR; 762 - if (check_jpeg_compatibility 763 - (rst->sampleType, rst->pixelType, rst->nBands) != RL2_OK) 760 + if (check_jpeg_compatibility (rst->sampleType, rst->pixelType, rst->nBands) 761 + != RL2_OK) 764 762 return RL2_ERROR; 765 763 if (rl2_data_to_jpeg 766 764 (rst->rasterBuffer, rst->maskBuffer, (rl2PalettePtr) (rst->Palette), 767 765 rst->width, rst->height, rst->sampleType, rst->pixelType, &blob, 768 766 &blob_size, quality) != RL2_OK) 769 767 return RL2_ERROR; 770 768 *jpeg = blob; ................................................................................ 780 778 /* creating a PNG image from an RGB buffer */ 781 779 unsigned char *blob; 782 780 int blob_size; 783 781 if (rgb == NULL) 784 782 return RL2_ERROR; 785 783 786 784 if (rl2_data_to_jpeg 787 - (rgb, NULL, NULL, width, height, RL2_SAMPLE_UINT8, RL2_PIXEL_RGB, 788 - &blob, &blob_size, quality) != RL2_OK) 785 + (rgb, NULL, NULL, width, height, RL2_SAMPLE_UINT8, RL2_PIXEL_RGB, &blob, 786 + &blob_size, quality) != RL2_OK) 789 787 return RL2_ERROR; 790 788 *jpeg = blob; 791 789 *jpeg_size = blob_size; 792 790 return RL2_OK; 793 791 } 794 792 795 793 RL2_DECLARE int 796 794 rl2_gray_to_jpeg (unsigned int width, unsigned int height, 797 - const unsigned char *gray, int quality, 798 - unsigned char **jpeg, int *jpeg_size) 795 + const unsigned char *gray, int quality, unsigned char **jpeg, 796 + int *jpeg_size) 799 797 { 800 798 /* creating a PNG image from a Grayscale buffer */ 801 799 unsigned char *blob; 802 800 int blob_size; 803 801 if (gray == NULL) 804 802 return RL2_ERROR; 805 803 806 804 if (rl2_data_to_jpeg 807 - (gray, NULL, NULL, width, height, RL2_SAMPLE_UINT8, 808 - RL2_PIXEL_GRAYSCALE, &blob, &blob_size, quality) != RL2_OK) 805 + (gray, NULL, NULL, width, height, RL2_SAMPLE_UINT8, RL2_PIXEL_GRAYSCALE, 806 + &blob, &blob_size, quality) != RL2_OK) 809 807 return RL2_ERROR; 810 808 *jpeg = blob; 811 809 *jpeg_size = blob_size; 812 810 return RL2_OK; 813 811 } 814 812 815 813 RL2_PRIVATE int ................................................................................ 849 847 rst = rl2_raster_from_jpeg (blob, blob_size); 850 848 free (blob); 851 849 if (rst == NULL) 852 850 return NULL; 853 851 854 852 /* creating the raster section */ 855 853 scn = 856 - rl2_create_section (path, RL2_COMPRESSION_JPEG, 857 - RL2_TILESIZE_UNDEFINED, RL2_TILESIZE_UNDEFINED, 858 - rst); 854 + rl2_create_section (path, RL2_COMPRESSION_JPEG, RL2_TILESIZE_UNDEFINED, 855 + RL2_TILESIZE_UNDEFINED, rst); 859 856 return scn; 860 857 } 861 858 862 859 RL2_DECLARE rl2RasterPtr 863 860 rl2_raster_from_jpeg (const unsigned char *jpeg, int jpeg_size) 864 861 { 865 862 /* attempting to create a raster from a JPEG image */ ................................................................................ 877 874 goto error; 878 875 nBands = 1; 879 876 if (pixel_type == RL2_PIXEL_RGB) 880 877 nBands = 3; 881 878 882 879 /* creating the raster */ 883 880 rst = 884 - rl2_create_raster (width, height, RL2_SAMPLE_UINT8, pixel_type, 885 - nBands, data, data_size, NULL, NULL, 0, NULL); 881 + rl2_create_raster (width, height, RL2_SAMPLE_UINT8, pixel_type, nBands, 882 + data, data_size, NULL, NULL, 0, NULL); 886 883 if (rst == NULL) 887 884 goto error; 888 885 return rst; 889 886 890 887 error: 891 888 if (rst != NULL) 892 889 rl2_destroy_raster (rst); 893 890 if (data != NULL) 894 891 free (data); 895 892 return NULL; 896 893 } 897 894 898 895 RL2_DECLARE int 899 -rl2_get_jpeg_infos (const char *path, unsigned int *width, 900 - unsigned int *height, unsigned char *pixel_type) 896 +rl2_get_jpeg_infos (const char *path, unsigned int *width, unsigned int *height, 897 + unsigned char *pixel_type) 901 898 { 902 899 /* attempting to retrieve basic infos from a JPEG image */ 903 900 int jpeg_size; 904 901 unsigned char *jpeg = NULL; 905 902 struct jpeg_decompress_struct cinfo; 906 903 struct jpeg_error_mgr jerr; 907 904 int row_stride; ................................................................................ 1063 1060 /* reading all decompressed scanlines */ 1064 1061 jpeg_read_scanlines (&cinfo, buffer, 1); 1065 1062 if (cinfo.out_color_space == JCS_CMYK) 1066 1063 { 1067 1064 JSAMPROW row = buffer[0]; 1068 1065 for (i = 0; i < (int) (cinfo.output_width); i++) 1069 1066 { 1070 - CMYK2RGB (*(row + 0), *(row + 1), *(row + 2), 1071 - *(row + 3), inverted, p_data); 1067 + CMYK2RGB (*(row + 0), *(row + 1), *(row + 2), *(row + 3), 1068 + inverted, p_data); 1072 1069 row += 4; 1073 1070 p_data += 3; 1074 1071 } 1075 1072 } 1076 1073 else if (cinfo.out_color_space == JCS_GRAYSCALE) 1077 1074 { 1078 1075 JSAMPROW row = buffer[0]; ................................................................................ 1297 1294 unsigned char forced_conversion, int verbose) 1298 1295 { 1299 1296 /* checking for strict compatibility */ 1300 1297 if (coverage->sampleType == RL2_SAMPLE_UINT8 1301 1298 && coverage->pixelType == RL2_PIXEL_GRAYSCALE && coverage->nBands == 1) 1302 1299 { 1303 1300 if (raster->sampleType == RL2_SAMPLE_UINT8 1304 - && raster->pixelType == RL2_PIXEL_GRAYSCALE 1305 - && raster->nBands == 1 && forced_conversion == RL2_CONVERT_NO) 1301 + && raster->pixelType == RL2_PIXEL_GRAYSCALE && raster->nBands == 1 1302 + && forced_conversion == RL2_CONVERT_NO) 1306 1303 return 1; 1307 1304 if (raster->sampleType == RL2_SAMPLE_UINT8 1308 1305 && raster->pixelType == RL2_PIXEL_RGB && raster->nBands == 3 1309 1306 && forced_conversion == RL2_CONVERT_RGB_TO_GRAYSCALE) 1310 1307 return 1; 1311 1308 } 1312 1309 if (coverage->sampleType == RL2_SAMPLE_UINT8 ................................................................................ 1313 1310 && coverage->pixelType == RL2_PIXEL_RGB && coverage->nBands == 3) 1314 1311 { 1315 1312 if (raster->sampleType == RL2_SAMPLE_UINT8 1316 1313 && raster->pixelType == RL2_PIXEL_RGB && raster->nBands == 3 1317 1314 && forced_conversion == RL2_CONVERT_NO) 1318 1315 return 1; 1319 1316 if (raster->sampleType == RL2_SAMPLE_UINT8 1320 - && raster->pixelType == RL2_PIXEL_GRAYSCALE 1321 - && raster->nBands == 1 1317 + && raster->pixelType == RL2_PIXEL_GRAYSCALE && raster->nBands == 1 1322 1318 && forced_conversion == RL2_CONVERT_GRAYSCALE_TO_RGB) 1323 1319 return 1; 1324 1320 } 1325 1321 if (verbose) 1326 1322 fprintf (stderr, "Mismatching JPEG colorspace !!!\n"); 1327 1323 return 0; 1328 1324 } ................................................................................ 1532 1528 xml = sqlite3_mprintf ("%s</BoundingBox>", prev); 1533 1529 sqlite3_free (prev); 1534 1530 prev = xml; 1535 1531 xml = sqlite3_mprintf ("%s<Extent>", prev); 1536 1532 sqlite3_free (prev); 1537 1533 prev = xml; 1538 1534 xml = 1539 - sqlite3_mprintf 1540 - ("%s<HorizontalExtent>%1.10f</HorizontalExtent>", prev, 1541 - maxx - minx); 1535 + sqlite3_mprintf ("%s<HorizontalExtent>%1.10f</HorizontalExtent>", 1536 + prev, maxx - minx); 1542 1537 sqlite3_free (prev); 1543 1538 prev = xml; 1544 1539 xml = 1545 1540 sqlite3_mprintf ("%s<VerticalExtent>%1.10f</VerticalExtent>", 1546 1541 prev, maxy - miny); 1547 1542 sqlite3_free (prev); 1548 1543 prev = xml;
Changes to src/rl2openjpeg.c.
56 56 #include "rasterlite2_private.h" 57 57 58 58 #ifndef OMIT_OPENJPEG /* only if OpenJpeg is enabled */ 59 59 60 60 #ifdef HAVE_OPENJPEG_2_1_OPENJPEG_H 61 61 #include <openjpeg-2.1/openjpeg.h> 62 62 #else 63 -#ifdef __ANDROID__ /* Android specific */ 64 -#include <openjpeg.h> 65 -#else 66 63 #include <openjpeg-2.0/openjpeg.h> 67 -#endif 68 64 #endif 69 65 70 66 struct jp2_memfile 71 67 { 72 68 /* a struct emulating a file [memory mapped] */ 73 69 unsigned char *buffer; 74 70 int malloc_block; ................................................................................ 692 688 } 693 689 } 694 690 695 691 RL2_PRIVATE int 696 692 rl2_decode_jpeg2000_scaled (int scale, const unsigned char *jpeg2000, 697 693 int jpeg2000_sz, unsigned int *xwidth, 698 694 unsigned int *xheight, unsigned char xsample_type, 699 - unsigned char xpixel_type, 700 - unsigned char xnum_bands, unsigned char **pixels, 701 - int *pixels_size) 695 + unsigned char xpixel_type, unsigned char xnum_bands, 696 + unsigned char **pixels, int *pixels_size) 702 697 { 703 698 /* attempting to create a raster from a Jpeg2000 image - supporting rescaled size */ 704 699 unsigned char *buf = NULL; 705 700 int buf_size = 0; 706 701 unsigned int width; 707 702 unsigned int height; 708 703 unsigned char sample_type = RL2_SAMPLE_UNKNOWN; ................................................................................ 859 854 fprintf (stderr, 860 855 "OpenJpeg Error: opj_decode_tile_data() failed\n"); 861 856 goto error; 862 857 } 863 858 if (sample_type == RL2_SAMPLE_UINT16) 864 859 save_tile_u16 ((unsigned short *) buf, 865 860 (unsigned short *) jp2_data, tile_x0 / scale, 866 - tile_y0 / scale, tile_x1 / scale, 867 - tile_y1 / scale, num_bands, width / scale, 868 - height / scale); 861 + tile_y0 / scale, tile_x1 / scale, tile_y1 / scale, 862 + num_bands, width / scale, height / scale); 869 863 else 870 864 save_tile_u8 ((unsigned char *) buf, (unsigned char *) jp2_data, 871 865 tile_x0 / scale, tile_y0 / scale, tile_x1 / scale, 872 866 tile_y1 / scale, num_bands, width / scale, 873 867 height / scale); 874 868 free (jp2_data); 875 869 jp2_data = NULL; ................................................................................ 903 897 int verbose) 904 898 { 905 899 /* checking for strict compatibility */ 906 900 if (coverage->sampleType == RL2_SAMPLE_UINT8 907 901 && coverage->pixelType == RL2_PIXEL_GRAYSCALE && coverage->nBands == 1) 908 902 { 909 903 if (raster->sampleType == RL2_SAMPLE_UINT8 910 - && raster->pixelType == RL2_PIXEL_GRAYSCALE 911 - && raster->nBands == 1 && forced_conversion == RL2_CONVERT_NO) 904 + && raster->pixelType == RL2_PIXEL_GRAYSCALE && raster->nBands == 1 905 + && forced_conversion == RL2_CONVERT_NO) 912 906 return 1; 913 907 if (raster->sampleType == RL2_SAMPLE_UINT8 914 908 && raster->pixelType == RL2_PIXEL_RGB && raster->nBands == 3 915 909 && forced_conversion == RL2_CONVERT_RGB_TO_GRAYSCALE) 916 910 return 1; 917 911 } 918 912 if (coverage->sampleType == RL2_SAMPLE_UINT8 ................................................................................ 919 913 && coverage->pixelType == RL2_PIXEL_RGB && coverage->nBands == 3) 920 914 { 921 915 if (raster->sampleType == RL2_SAMPLE_UINT8 922 916 && raster->pixelType == RL2_PIXEL_RGB && raster->nBands == 3 923 917 && forced_conversion == RL2_CONVERT_NO) 924 918 return 1; 925 919 if (raster->sampleType == RL2_SAMPLE_UINT8 926 - && raster->pixelType == RL2_PIXEL_GRAYSCALE 927 - && raster->nBands == 1 920 + && raster->pixelType == RL2_PIXEL_GRAYSCALE && raster->nBands == 1 928 921 && forced_conversion == RL2_CONVERT_GRAYSCALE_TO_RGB) 929 922 return 1; 930 923 } 931 924 if (coverage->sampleType == RL2_SAMPLE_UINT8 932 925 && coverage->pixelType == RL2_PIXEL_DATAGRID && coverage->nBands == 1) 933 926 { 934 927 if (raster->sampleType == RL2_SAMPLE_UINT8 935 - && raster->pixelType == RL2_PIXEL_DATAGRID 936 - && raster->nBands == 1 && forced_conversion == RL2_CONVERT_NO) 928 + && raster->pixelType == RL2_PIXEL_DATAGRID && raster->nBands == 1 929 + && forced_conversion == RL2_CONVERT_NO) 937 930 return 1; 938 931 } 939 932 if (coverage->sampleType == RL2_SAMPLE_UINT8 940 - && coverage->pixelType == RL2_PIXEL_MULTIBAND 941 - && (coverage->nBands == 3 || coverage->nBands == 4)) 933 + && coverage->pixelType == RL2_PIXEL_MULTIBAND && (coverage->nBands == 3 934 + || coverage->nBands == 935 + 4)) 942 936 { 943 937 if (raster->sampleType == RL2_SAMPLE_UINT8 944 938 && raster->pixelType == RL2_PIXEL_MULTIBAND 945 939 && raster->nBands == coverage->nBands 946 940 && forced_conversion == RL2_CONVERT_NO) 947 941 return 1; 948 942 } 949 943 if (coverage->sampleType == RL2_SAMPLE_UINT16 950 944 && coverage->pixelType == RL2_PIXEL_DATAGRID && coverage->nBands == 1) 951 945 { 952 946 if (raster->sampleType == RL2_SAMPLE_UINT16 953 - && raster->pixelType == RL2_PIXEL_DATAGRID 954 - && raster->nBands == 1 && forced_conversion == RL2_CONVERT_NO) 947 + && raster->pixelType == RL2_PIXEL_DATAGRID && raster->nBands == 1 948 + && forced_conversion == RL2_CONVERT_NO) 955 949 return 1; 956 950 } 957 951 if (coverage->sampleType == RL2_SAMPLE_UINT16 958 952 && coverage->pixelType == RL2_PIXEL_RGB && coverage->nBands == 3) 959 953 { 960 954 if (raster->sampleType == RL2_SAMPLE_UINT16 961 955 && raster->pixelType == RL2_PIXEL_RGB && raster->nBands == 3 962 956 && forced_conversion == RL2_CONVERT_NO) 963 957 return 1; 964 958 } 965 959 if (coverage->sampleType == RL2_SAMPLE_UINT16 966 - && coverage->pixelType == RL2_PIXEL_MULTIBAND 967 - && (coverage->nBands == 3 || coverage->nBands == 4)) 960 + && coverage->pixelType == RL2_PIXEL_MULTIBAND && (coverage->nBands == 3 961 + || coverage->nBands == 962 + 4)) 968 963 { 969 964 if (raster->sampleType == RL2_SAMPLE_UINT16 970 965 && raster->pixelType == RL2_PIXEL_MULTIBAND 971 966 && raster->nBands == coverage->nBands 972 967 && forced_conversion == RL2_CONVERT_NO) 973 968 return 1; 974 969 } 975 970 if (verbose) 976 971 fprintf (stderr, "Mismatching Jpeg2000 colorspace !!!\n"); 977 972 return 0; 978 973 } 979 974 980 975 static int 981 -read_jpeg2000_pixels_gray_to_rgb (rl2PrivRasterPtr origin, 982 - unsigned short width, unsigned short height, 983 - unsigned int startRow, 976 +read_jpeg2000_pixels_gray_to_rgb (rl2PrivRasterPtr origin, unsigned short width, 977 + unsigned short height, unsigned int startRow, 984 978 unsigned int startCol, unsigned char *pixels) 985 979 { 986 980 /* Grayscale -> RGB */ 987 981 unsigned short x; 988 982 unsigned short y; 989 983 unsigned short row; 990 984 unsigned short col; ................................................................................ 1004 998 *p_out++ = value; /* blue */ 1005 999 } 1006 1000 } 1007 1001 return 1; 1008 1002 } 1009 1003 1010 1004 static int 1011 -read_jpeg2000_pixels_rgb_to_gray (rl2PrivRasterPtr origin, 1012 - unsigned short width, unsigned short height, 1013 - unsigned int startRow, 1005 +read_jpeg2000_pixels_rgb_to_gray (rl2PrivRasterPtr origin, unsigned short width, 1006 + unsigned short height, unsigned int startRow, 1014 1007 unsigned int startCol, unsigned char *pixels) 1015 1008 { 1016 1009 /* RGB -> Grayscale */ 1017 1010 unsigned short x; 1018 1011 unsigned short y; 1019 1012 unsigned short row; 1020 1013 unsigned short col; ................................................................................ 1193 1186 if (no_data != NULL) 1194 1187 rl2_destroy_pixel (no_data); 1195 1188 return RL2_ERROR; 1196 1189 } 1197 1190 1198 1191 RL2_DECLARE rl2RasterPtr 1199 1192 rl2_get_tile_from_jpeg2000_origin (rl2CoveragePtr cvg, rl2RasterPtr jpeg2000, 1200 - unsigned int startRow, 1201 - unsigned int startCol, 1193 + unsigned int startRow, unsigned int startCol, 1202 1194 unsigned char forced_conversion, int verbose) 1203 1195 { 1204 1196 /* attempting to create a Coverage-tile from a Jpeg2000 origin */ 1205 1197 unsigned int x; 1206 1198 rl2PrivCoveragePtr coverage = (rl2PrivCoveragePtr) cvg; 1207 1199 rl2PrivRasterPtr origin = (rl2PrivRasterPtr) jpeg2000; 1208 1200 rl2RasterPtr raster = NULL; ................................................................................ 1608 1600 xml = sqlite3_mprintf ("%s</BoundingBox>", prev); 1609 1601 sqlite3_free (prev); 1610 1602 prev = xml; 1611 1603 xml = sqlite3_mprintf ("%s<Extent>", prev); 1612 1604 sqlite3_free (prev); 1613 1605 prev = xml; 1614 1606 xml = 1615 - sqlite3_mprintf 1616 - ("%s<HorizontalExtent>%1.10f</HorizontalExtent>", prev, 1617 - maxx - minx); 1607 + sqlite3_mprintf ("%s<HorizontalExtent>%1.10f</HorizontalExtent>", 1608 + prev, maxx - minx); 1618 1609 sqlite3_free (prev); 1619 1610 prev = xml; 1620 1611 xml = 1621 1612 sqlite3_mprintf ("%s<VerticalExtent>%1.10f</VerticalExtent>", 1622 1613 prev, maxy - miny); 1623 1614 sqlite3_free (prev); 1624 1615 prev = xml;
Changes to src/rl2paint.c.
768 768 double height, unsigned char red1, 769 769 unsigned char green1, 770 770 unsigned char blue1, 771 771 unsigned char alpha1, 772 772 unsigned char red2, 773 773 unsigned char green2, 774 774 unsigned char blue2, 775 - unsigned char alpha2, 776 - double pen_width, int line_cap, 777 - int line_join) 775 + unsigned char alpha2, double pen_width, 776 + int line_cap, int line_join) 778 777 { 779 778 /* setting up a Linear Gradient Pen - solid style */ 780 779 double d_red = (double) red1 / 255.0; 781 780 double d_green = (double) green1 / 255.0; 782 781 double d_blue = (double) blue1 / 255.0; 783 782 double d_alpha = (double) alpha1 / 255.0; 784 783 RL2GraphContextPtr ctx = (RL2GraphContextPtr) context; ................................................................................ 1044 1043 return 1; 1045 1044 } 1046 1045 1047 1046 RL2_DECLARE int 1048 1047 rl2_graph_set_linear_gradient_brush (rl2GraphicsContextPtr context, double x, 1049 1048 double y, double width, double height, 1050 1049 unsigned char red1, unsigned char green1, 1051 - unsigned char blue1, 1052 - unsigned char alpha1, unsigned char red2, 1053 - unsigned char green2, 1050 + unsigned char blue1, unsigned char alpha1, 1051 + unsigned char red2, unsigned char green2, 1054 1052 unsigned char blue2, unsigned char alpha2) 1055 1053 { 1056 1054 /* setting up a Linear Gradient Brush */ 1057 1055 double d_red = (double) red1 / 255.0; 1058 1056 double d_green = (double) green1 / 255.0; 1059 1057 double d_blue = (double) blue1 / 255.0; 1060 1058 double d_alpha = (double) alpha1 / 255.0; ................................................................................ 1556 1554 unsigned char red; 1557 1555 unsigned char green; 1558 1556 unsigned char blue; 1559 1557 unsigned char alpha; 1560 1558 unsigned char xred; 1561 1559 unsigned char xgreen; 1562 1560 unsigned char xblue; 1563 - unsigned char xalpha; 1564 1561 int valid = 0; 1565 - int has_black = 0; 1566 1562 unsigned char *bitmap; 1567 1563 RL2PrivGraphPatternPtr pattern = (RL2PrivGraphPatternPtr) ptrn; 1568 1564 if (pattern == NULL) 1569 1565 return RL2_ERROR; 1570 1566 1571 1567 width = pattern->width; 1572 1568 height = pattern->height; ................................................................................ 1575 1571 if (bitmap == NULL) 1576 1572 return RL2_ERROR; 1577 1573 /* checking for a Monochrome Pattern */ 1578 1574 for (y = 0; y < height; y++) 1579 1575 { 1580 1576 for (x = 0; x < width; x++) 1581 1577 { 1582 - aux_pattern_get_pixel (x, y, width, bitmap, &red, &green, 1583 - &blue, &alpha); 1578 + aux_pattern_get_pixel (x, y, width, bitmap, &red, &green, &blue, 1579 + &alpha); 1584 1580 if (alpha != 0) 1585 1581 { 1586 - if (red < 64 && green < 64 && blue < 64) 1587 - has_black++; 1588 1582 if (valid) 1589 1583 { 1590 - if (xred == red && xgreen == green 1591 - && xblue == blue && alpha == xalpha) 1584 + if (xred == red && xgreen == green && xblue == blue) 1592 1585 ; 1593 1586 else 1594 - goto not_mono; 1587 + return RL2_ERROR; 1595 1588 } 1596 1589 else 1597 1590 { 1598 1591 xred = red; 1599 1592 xgreen = green; 1600 1593 xblue = blue; 1601 - xalpha = alpha; 1602 1594 valid = 1; 1603 1595 } 1604 1596 } 1605 1597 } 1606 1598 } 1607 1599 /* all right, applying the new color */ 1608 1600 for (y = 0; y < height; y++) 1609 1601 { 1610 1602 for (x = 0; x < width; x++) 1611 1603 { 1612 - aux_pattern_get_pixel (x, y, width, bitmap, &red, &green, 1613 - &blue, &alpha); 1604 + aux_pattern_get_pixel (x, y, width, bitmap, &red, &green, &blue, 1605 + &alpha); 1614 1606 if (alpha != 0) 1615 1607 aux_pattern_set_pixel (x, y, width, bitmap, r, g, b, alpha); 1616 1608 } 1617 1609 } 1618 1610 cairo_surface_mark_dirty (pattern->bitmap); 1619 1611 return RL2_OK; 1620 - 1621 - not_mono: 1622 - if (has_black) 1623 - { 1624 - /* recoloring only the black pixels */ 1625 - for (y = 0; y < height; y++) 1626 - { 1627 - for (x = 0; x < width; x++) 1628 - { 1629 - aux_pattern_get_pixel (x, y, width, bitmap, &red, 1630 - &green, &blue, &alpha); 1631 - if (red < 64 && green < 64 && blue < 64) 1632 - aux_pattern_set_pixel (x, y, width, bitmap, r, g, b, 1633 - alpha); 1634 - } 1635 - } 1636 - cairo_surface_mark_dirty (pattern->bitmap); 1637 - return RL2_OK; 1638 - } 1639 - return RL2_ERROR; 1640 1612 } 1641 1613 1642 1614 RL2_DECLARE int 1643 1615 rl2_graph_pattern_transparency (rl2GraphicsPatternPtr ptrn, unsigned char aleph) 1644 1616 { 1645 1617 /* changing the Pattern's transparency */ 1646 1618 int x; ................................................................................ 1663 1635 if (bitmap == NULL) 1664 1636 return RL2_ERROR; 1665 1637 /* applying the new transparency */ 1666 1638 for (y = 0; y < height; y++) 1667 1639 { 1668 1640 for (x = 0; x < width; x++) 1669 1641 { 1670 - aux_pattern_get_pixel (x, y, width, bitmap, &red, &green, 1671 - &blue, &alpha); 1642 + aux_pattern_get_pixel (x, y, width, bitmap, &red, &green, &blue, 1643 + &alpha); 1672 1644 if (alpha != 0) 1673 1645 aux_pattern_set_pixel (x, y, width, bitmap, red, green, 1674 1646 blue, aleph); 1675 1647 } 1676 1648 } 1677 1649 cairo_surface_mark_dirty (pattern->bitmap); 1678 1650 return RL2_OK; ................................................................................ 1793 1765 } 1794 1766 1795 1767 /* destroying the cached font */ 1796 1768 rl2_destroy_private_tt_font (font); 1797 1769 } 1798 1770 1799 1771 RL2_DECLARE rl2GraphicsFontPtr 1800 -rl2_graph_create_TrueType_font (const void *priv_data, 1801 - const unsigned char *ttf, int ttf_bytes, 1802 - double size) 1772 +rl2_graph_create_TrueType_font (const void *priv_data, const unsigned char *ttf, 1773 + int ttf_bytes, double size) 1803 1774 { 1804 1775 /* creating a TrueType font */ 1805 1776 RL2GraphFontPtr fnt; 1806 1777 char *facename; 1807 1778 int is_bold; 1808 1779 int is_italic; 1809 1780 unsigned char *font = NULL; ................................................................................ 2291 2262 set_current_pen (ctx); 2292 2263 cairo_stroke (cairo); 2293 2264 return 1; 2294 2265 } 2295 2266 2296 2267 RL2_DECLARE int 2297 2268 rl2_graph_draw_circle_sector (rl2GraphicsContextPtr context, double center_x, 2298 - double center_y, double radius, 2299 - double from_angle, double to_angle) 2269 + double center_y, double radius, double from_angle, 2270 + double to_angle) 2300 2271 { 2301 2272 /* drawing a filled circular sector */ 2302 2273 cairo_t *cairo; 2303 2274 RL2GraphContextPtr ctx = (RL2GraphContextPtr) context; 2304 2275 if (ctx == NULL) 2305 2276 return 0; 2306 2277 if (ctx->type == RL2_SURFACE_PDF) ................................................................................ 2456 2427 *height = extents.height; 2457 2428 *post_x = extents.x_advance; 2458 2429 *post_y = extents.y_advance; 2459 2430 return 1; 2460 2431 } 2461 2432 2462 2433 RL2_DECLARE int 2463 -rl2_graph_draw_text (rl2GraphicsContextPtr context, const char *text, 2464 - double x, double y, double angle, double anchor_point_x, 2434 +rl2_graph_draw_text (rl2GraphicsContextPtr context, const char *text, double x, 2435 + double y, double angle, double anchor_point_x, 2465 2436 double anchor_point_y) 2466 2437 { 2467 2438 /* drawing a text string (using the current font) */ 2468 2439 double rads; 2469 2440 double pre_x; 2470 2441 double pre_y; 2471 2442 double width; ................................................................................ 2638 2609 rl2GetPoint (ln->coords, ln->points - 1, &xx, &yy); 2639 2610 if (xx == x && yy == y) 2640 2611 return 1; 2641 2612 return 0; 2642 2613 } 2643 2614 2644 2615 static rl2GeometryPtr 2645 -aux_reduce_curve (sqlite3 * handle, rl2GeometryPtr geom, 2646 - rl2GeometryPtr circle, double x, double y) 2616 +aux_reduce_curve (sqlite3 * handle, rl2GeometryPtr geom, rl2GeometryPtr circle, 2617 + double x, double y) 2647 2618 { 2648 2619 /* reducing a Curve by discarding the alreasdy processed portion */ 2649 2620 sqlite3_stmt *stmt = NULL; 2650 2621 const char *sql; 2651 2622 int ret; 2652 2623 unsigned char *blob1; 2653 2624 int size1; ................................................................................ 2711 2682 2712 2683 error: 2713 2684 if (stmt != NULL) 2714 2685 sqlite3_finalize (stmt); 2715 2686 return NULL; 2716 2687 } 2717 2688 2718 -static int 2719 -check_reverse (rl2GeometryPtr geom) 2720 -{ 2721 -/* testing for an inverse label */ 2722 - rl2LinestringPtr ln; 2723 - double x0; 2724 - double y0; 2725 - double x1; 2726 - double y1; 2727 - double width; 2728 - double height; 2729 - int last; 2730 - 2731 - if (geom == NULL) 2732 - return 0; 2733 - ln = geom->first_linestring; 2734 - if (ln == NULL) 2735 - return 0; 2736 - if (ln->points < 2) 2737 - return 0; 2738 - last = ln->points - 1; 2739 - 2740 - rl2GetPoint (ln->coords, 0, &x0, &y0); 2741 - rl2GetPoint (ln->coords, last, &x1, &y1); 2742 - width = fabs (x0 - x1); 2743 - height = fabs (y0 - y1); 2744 - if (width > 3.0) 2745 - { 2746 - if (x0 > x1) 2747 - return 1; 2748 - } 2749 - else 2750 - { 2751 - if (y0 > y1) 2752 - return 1; 2753 - } 2754 - return 0; 2755 -} 2756 - 2757 -static void 2758 -reverse_text (const char *in, char *dest, int len) 2759 -{ 2760 -/* reversing a text string */ 2761 - char *out; 2762 - int n = 1; 2763 - while (*in != '\0') 2764 - { 2765 - out = dest + len - n; 2766 - *out = *in++; 2767 - n++; 2768 - } 2769 - *(dest + len) = '\0'; 2770 -} 2771 - 2772 2689 static rl2GeometryPtr 2773 2690 rl2_draw_wrapped_label (sqlite3 * handle, rl2GraphicsContextPtr context, 2774 2691 cairo_t * cairo, const char *text, rl2GeometryPtr geom) 2775 2692 { 2776 2693 /* placing each character along the modelling line */ 2777 2694 double x0; 2778 2695 double y0; ................................................................................ 2782 2699 double m; 2783 2700 double rads; 2784 2701 double angle; 2785 2702 char buf[2]; 2786 2703 rl2GeometryPtr g2; 2787 2704 rl2GeometryPtr g = rl2_clone_curve (geom); 2788 2705 rl2GeometryPtr circle; 2789 - char *rev_text = NULL; 2790 2706 const char *c = text; 2791 2707 cairo_font_extents_t extents; 2792 2708 2793 2709 cairo_font_extents (cairo, &extents); 2794 2710 radius = 2795 2711 sqrt ((extents.max_x_advance * extents.max_x_advance) + 2796 2712 (extents.height * extents.height)) / 2.0; 2797 - if (check_reverse (g)) 2798 - { 2799 - /* reverse text */ 2800 - int len = strlen (text); 2801 - rev_text = malloc (len + 1); 2802 - reverse_text (text, rev_text, len); 2803 - c = rev_text; 2804 - } 2805 2713 while (*c != '\0' && g != NULL) 2806 2714 { 2807 2715 buf[0] = *c; 2808 2716 buf[1] = '\0'; 2809 2717 get_aux_start_point (g, &x0, &y0); 2810 2718 circle = rl2_build_circle (x0, y0, radius); 2811 2719 if (!get_aux_interception_point (handle, g, circle, &x1, &y1)) ................................................................................ 2814 2722 rl2_destroy_geometry (g); 2815 2723 g = NULL; 2816 2724 break; 2817 2725 } 2818 2726 m = (y1 - y0) / (x1 - x0); 2819 2727 rads = atan (m); 2820 2728 angle = rads / .0174532925199432958; 2821 - if (x1 < x0 && rev_text == NULL) 2729 + if (x1 < x0) 2822 2730 angle += 180.0; 2823 2731 rl2_graph_draw_text (context, buf, x0, y0, angle, 0.5, 0.5); 2824 2732 c++; 2825 2733 g2 = aux_reduce_curve (handle, g, circle, x0, y0); 2826 2734 rl2_destroy_geometry (circle); 2827 2735 rl2_destroy_geometry (g); 2828 2736 g = g2; 2829 2737 } 2830 - if (rev_text) 2831 - free (rev_text); 2832 2738 return g; 2833 2739 } 2834 2740 2835 2741 RL2_DECLARE int 2836 2742 rl2_graph_draw_warped_text (sqlite3 * handle, rl2GraphicsContextPtr context, 2837 - const char *text, int points, double *x, 2838 - double *y, double initial_gap, double gap, 2839 - int repeated) 2743 + const char *text, int points, double *x, double *y, 2744 + double initial_gap, double gap, int repeated) 2840 2745 { 2841 2746 /* drawing a text string warped along a modelling curve (using the current font) */ 2842 2747 double curve_len; 2843 2748 double text_len; 2844 2749 double extra_len; 2845 2750 double start; 2846 2751 double from; ................................................................................ 2860 2765 2861 2766 geom = rl2_curve_from_XY (points, x, y); 2862 2767 if (geom == NULL) 2863 2768 return 0; 2864 2769 2865 2770 curve_len = rl2_compute_curve_length (geom); 2866 2771 do_estimate_text_length (cairo, text, &text_len, &extra_len); 2867 - if ((initial_gap + text_len + (2.0 * extra_len)) > curve_len) 2772 + if ((text_len + (2.0 * extra_len)) > curve_len) 2868 2773 return 0; /* not enough room to place the label */ 2869 2774 2870 2775 if (repeated) 2871 2776 { 2872 2777 /* repeated labels */ 2873 2778 int first = 1; 2874 2779 rl2GeometryPtr geom3 = rl2_clone_linestring (geom->first_linestring); ................................................................................ 2878 2783 { 2879 2784 start = initial_gap + extra_len; 2880 2785 first = 0; 2881 2786 } 2882 2787 else 2883 2788 start = gap + extra_len; 2884 2789 curve_len = rl2_compute_curve_length (geom3); 2885 - if ((start + text_len + extra_len) > curve_len) 2886 - break; /* not enough room to place the label */ 2887 2790 from = start / curve_len; 2888 2791 /* extracting the sub-path modelling the label */ 2889 2792 geom2 = rl2_curve_substring (handle, geom3, from, 1.0); 2890 2793 rl2_destroy_geometry (geom3); 2891 2794 if (geom2 == NULL) 2892 2795 goto error; 2893 2796 geom3 =
Changes to src/rl2png.c.
224 224 rl2_free (green); 225 225 if (blue != NULL) 226 226 rl2_free (blue); 227 227 return RL2_ERROR; 228 228 } 229 229 230 230 static int 231 -compress_grayscale_png8 (const unsigned char *pixels, 232 - const unsigned char *mask, double opacity, 233 - unsigned int width, unsigned int height, 234 - unsigned char sample_type, unsigned char pixel_type, 235 - unsigned char **png, int *png_size) 231 +compress_grayscale_png8 (const unsigned char *pixels, const unsigned char *mask, 232 + double opacity, unsigned int width, 233 + unsigned int height, unsigned char sample_type, 234 + unsigned char pixel_type, unsigned char **png, 235 + int *png_size) 236 236 { 237 237 /* compressing a PNG image of the GRAYSCALE type - 8 bits */ 238 238 png_structp png_ptr; 239 239 png_infop info_ptr; 240 240 int bit_depth; 241 241 png_bytep *row_pointers = NULL; 242 242 png_bytep p_out; ................................................................................ 1080 1080 *png = blob; 1081 1081 *png_size = blob_size; 1082 1082 return RL2_OK; 1083 1083 } 1084 1084 1085 1085 RL2_DECLARE int 1086 1086 rl2_rgb_real_alpha_to_png (unsigned int width, unsigned int height, 1087 - const unsigned char *rgb, 1088 - const unsigned char *alpha, unsigned char **png, 1089 - int *png_size) 1087 + const unsigned char *rgb, const unsigned char *alpha, 1088 + unsigned char **png, int *png_size) 1090 1089 { 1091 1090 /* creating a PNG image from two distinct RGB + Alpha buffer */ 1092 1091 unsigned char *blob; 1093 1092 int blob_size; 1094 1093 if (rgb == NULL || alpha == NULL) 1095 1094 return RL2_ERROR; 1096 1095 ................................................................................ 1172 1171 case RL2_PIXEL_DATAGRID: 1173 1172 if (sample_type == RL2_SAMPLE_UINT16) 1174 1173 ret = 1175 1174 compress_grayscale_png16 (pixels, width, height, 1176 1175 sample_type, &blob, &blob_size); 1177 1176 else 1178 1177 ret = 1179 - compress_grayscale_png8 (pixels, mask, opacity, width, 1180 - height, sample_type, pixel_type, 1181 - &blob, &blob_size); 1178 + compress_grayscale_png8 (pixels, mask, opacity, width, height, 1179 + sample_type, pixel_type, &blob, 1180 + &blob_size); 1182 1181 break; 1183 1182 case RL2_PIXEL_RGB: 1184 1183 if (sample_type == RL2_SAMPLE_UINT8) 1185 1184 ret = 1186 1185 compress_rgb_png8 (pixels, mask, opacity, width, height, 1187 1186 &blob, &blob_size); 1188 1187 else if (sample_type == RL2_SAMPLE_UINT16) ................................................................................ 1190 1189 compress_rgb_png16 (pixels, width, height, &blob, &blob_size); 1191 1190 break; 1192 1191 case RL2_PIXEL_MULTIBAND: 1193 1192 if (sample_type == RL2_SAMPLE_UINT8) 1194 1193 { 1195 1194 if (num_bands == 3) 1196 1195 ret = 1197 - compress_rgb_png8 (pixels, mask, opacity, width, 1198 - height, &blob, &blob_size); 1196 + compress_rgb_png8 (pixels, mask, opacity, width, height, 1197 + &blob, &blob_size); 1199 1198 else if (num_bands == 4) 1200 1199 ret = 1201 1200 compress_4bands_png8 (pixels, width, height, &blob, 1202 1201 &blob_size); 1203 1202 } 1204 1203 else if (sample_type == RL2_SAMPLE_UINT16) 1205 1204 { ................................................................................ 1412 1411 if (color_type == PNG_COLOR_TYPE_RGB_ALPHA) 1413 1412 nBands = 4; 1414 1413 } 1415 1414 if (*xpixel_type == RL2_PIXEL_DATAGRID) 1416 1415 pixel_type = RL2_PIXEL_DATAGRID; 1417 1416 if (pixel_type == RL2_PIXEL_PALETTE) 1418 1417 { 1419 - if (png_get_tRNS 1420 - (png_ptr, info_ptr, &transp, &nTransp, 1421 - &transpValues) == PNG_INFO_tRNS) 1418 + if (png_get_tRNS (png_ptr, info_ptr, &transp, &nTransp, &transpValues) 1419 + == PNG_INFO_tRNS) 1422 1420 { 1423 1421 /* a Transparency palette is defined */ 1424 1422 int i; 1425 1423 for (i = 0; i < nTransp; i++) 1426 1424 *(alpha + i) = *(transp + i); 1427 1425 has_alpha = 1; 1428 1426 }
Changes to src/rl2pyramid.c.
255 255 #endif 256 256 257 257 table = sqlite3_mprintf ("%s_tiles", coverage); 258 258 xtable = rl2_double_quoted_sql (table); 259 259 sqlite3_free (table); 260 260 sql = 261 261 sqlite3_mprintf ("SELECT Count(*) FROM \"%s\" " 262 - "WHERE section_id = %s AND pyramid_level > 0", 263 - xtable, sect_id); 262 + "WHERE section_id = %s AND pyramid_level > 0", xtable, 263 + sect_id); 264 264 free (xtable); 265 265 ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); 266 266 sqlite3_free (sql); 267 267 if (ret != SQLITE_OK) 268 268 return 1; 269 269 while (1) 270 270 { ................................................................................ 347 347 } 348 348 sqlite3_finalize (stmt); 349 349 stmt = NULL; 350 350 if (!ok) 351 351 goto error; 352 352 353 353 /* Coverage's palette and no-data */ 354 - sql = 355 - sqlite3_mprintf ("SELECT palette, nodata_pixel FROM raster_coverages " 356 - "WHERE Lower(coverage_name) = Lower(%Q)", coverage); 354 + sql = sqlite3_mprintf ("SELECT palette, nodata_pixel FROM raster_coverages " 355 + "WHERE Lower(coverage_name) = Lower(%Q)", coverage); 357 356 ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); 358 357 sqlite3_free (sql); 359 358 if (ret != SQLITE_OK) 360 359 { 361 360 fprintf (stderr, "SQL error: %s\n%s\n", sql, sqlite3_errmsg (handle)); 362 361 goto error; 363 362 } ................................................................................ 488 487 free (tile_in); 489 488 tile_in = tile_in_n; 490 489 } 491 490 free (pyr); 492 491 } 493 492 494 493 static int 495 -insert_tile_into_section_pyramid (SectionPyramidPtr pyr, 496 - sqlite3_int64 tile_id, double minx, 497 - double miny, double maxx, double maxy) 494 +insert_tile_into_section_pyramid (SectionPyramidPtr pyr, sqlite3_int64 tile_id, 495 + double minx, double miny, double maxx, 496 + double maxy) 498 497 { 499 498 /* inserting a base tile into the Pyramid level */ 500 499 SectionPyramidTileInPtr tile; 501 500 if (pyr == NULL) 502 501 return 0; 503 502 tile = alloc_section_pyramid_tile (tile_id, minx, miny, maxx, maxy); 504 503 if (tile == NULL) ................................................................................ 573 572 { 574 573 if (tile->cx > minx && tile->cx < maxx && tile->cy > miny 575 574 && tile->cy < maxy) 576 575 { 577 576 if (first) 578 577 { 579 578 out = 580 - add_pyramid_out_tile (pyr, row, col, minx, miny, 581 - maxx, maxy); 579 + add_pyramid_out_tile (pyr, row, col, minx, miny, maxx, 580 + maxy); 582 581 first = 0; 583 582 } 584 583 if (out != NULL) 585 584 add_pyramid_sub_tile (out, tile); 586 585 } 587 586 tile = tile->next; 588 587 } ................................................................................ 764 763 for (col = 0; col < (unsigned int) tic_x; col++) 765 764 { 766 765 unsigned int xx = col + x; 767 766 char *p_out = p_out_base + xx; 768 767 if (xx >= tileWidth) 769 768 break; 770 769 *p_out = 771 - rescale_pixel_int8 (buf_in, tileWidth, tileHeight, 772 - col * 8, row * 8, nd); 770 + rescale_pixel_int8 (buf_in, tileWidth, tileHeight, col * 8, 771 + row * 8, nd); 773 772 } 774 773 } 775 774 } 776 775 777 776 static double 778 777 rescale_pixel_uint8 (const unsigned char *buf_in, unsigned int tileWidth, 779 778 unsigned int tileHeight, int x, int y, unsigned char nd) ................................................................................ 844 843 for (col = 0; col < (unsigned int) tic_x; col++) 845 844 { 846 845 unsigned int xx = col + x; 847 846 unsigned char *p_out = p_out_base + xx; 848 847 if (xx >= tileWidth) 849 848 break; 850 849 *p_out = 851 - rescale_pixel_uint8 (buf_in, tileWidth, tileHeight, 852 - col * 8, row * 8, nd); 850 + rescale_pixel_uint8 (buf_in, tileWidth, tileHeight, col * 8, 851 + row * 8, nd); 853 852 } 854 853 } 855 854 } 856 855 857 856 static double 858 857 rescale_pixel_int16 (const short *buf_in, unsigned int tileWidth, 859 858 unsigned int tileHeight, int x, int y, short nd) ................................................................................ 924 923 for (col = 0; col < (unsigned int) tic_x; col++) 925 924 { 926 925 unsigned int xx = col + x; 927 926 short *p_out = p_out_base + xx; 928 927 if (xx >= tileWidth) 929 928 break; 930 929 *p_out = 931 - rescale_pixel_int16 (buf_in, tileWidth, tileHeight, 932 - col * 8, row * 8, nd); 930 + rescale_pixel_int16 (buf_in, tileWidth, tileHeight, col * 8, 931 + row * 8, nd); 933 932 } 934 933 } 935 934 } 936 935 937 936 static double 938 937 rescale_pixel_uint16 (const unsigned short *buf_in, unsigned int tileWidth, 939 938 unsigned int tileHeight, int x, int y, unsigned short nd) ................................................................................ 1084 1083 for (col = 0; col < (unsigned int) tic_x; col++) 1085 1084 { 1086 1085 unsigned int xx = col + x; 1087 1086 int *p_out = p_out_base + xx; 1088 1087 if (xx >= tileWidth) 1089 1088 break; 1090 1089 *p_out = 1091 - rescale_pixel_int32 (buf_in, tileWidth, tileHeight, 1092 - col * 8, row * 8, nd); 1090 + rescale_pixel_int32 (buf_in, tileWidth, tileHeight, col * 8, 1091 + row * 8, nd); 1093 1092 } 1094 1093 } 1095 1094 } 1096 1095 1097 1096 static double 1098 1097 rescale_pixel_uint32 (const unsigned int *buf_in, unsigned int tileWidth, 1099 1098 unsigned int tileHeight, int x, int y, unsigned int nd) ................................................................................ 1244 1243 for (col = 0; col < (unsigned int) tic_x; col++) 1245 1244 { 1246 1245 unsigned int xx = col + x; 1247 1246 float *p_out = p_out_base + xx; 1248 1247 if (xx >= tileWidth) 1249 1248 break; 1250 1249 *p_out = 1251 - rescale_pixel_float (buf_in, tileWidth, tileHeight, 1252 - col * 8, row * 8, nd); 1250 + rescale_pixel_float (buf_in, tileWidth, tileHeight, col * 8, 1251 + row * 8, nd); 1253 1252 } 1254 1253 } 1255 1254 } 1256 1255 1257 1256 static double 1258 1257 rescale_pixel_double (const double *buf_in, unsigned int tileWidth, 1259 1258 unsigned int tileHeight, int x, int y, double nd) ................................................................................ 1345 1344 { 1346 1345 case RL2_SAMPLE_INT8: 1347 1346 rescale_grid_int8 ((char *) buf_out, tileWidth, tileHeight, 1348 1347 (const char *) buf_in, x, y, tic_x, tic_y, 1349 1348 no_data); 1350 1349 break; 1351 1350 case RL2_SAMPLE_UINT8: 1352 - rescale_grid_uint8 ((unsigned char *) buf_out, tileWidth, 1353 - tileHeight, (const unsigned char *) buf_in, x, 1354 - y, tic_x, tic_y, no_data); 1351 + rescale_grid_uint8 ((unsigned char *) buf_out, tileWidth, tileHeight, 1352 + (const unsigned char *) buf_in, x, y, tic_x, 1353 + tic_y, no_data); 1355 1354 break; 1356 1355 case RL2_SAMPLE_INT16: 1357 1356 rescale_grid_int16 ((short *) buf_out, tileWidth, tileHeight, 1358 1357 (const short *) buf_in, x, y, tic_x, tic_y, 1359 1358 no_data); 1360 1359 break; 1361 1360 case RL2_SAMPLE_UINT16: ................................................................................ 1365 1364 break; 1366 1365 case RL2_SAMPLE_INT32: 1367 1366 rescale_grid_int32 ((int *) buf_out, tileWidth, tileHeight, 1368 1367 (const int *) buf_in, x, y, tic_x, tic_y, 1369 1368 no_data); 1370 1369 break; 1371 1370 case RL2_SAMPLE_UINT32: 1372 - rescale_grid_uint32 ((unsigned int *) buf_out, tileWidth, 1373 - tileHeight, (const unsigned int *) buf_in, x, 1374 - y, tic_x, tic_y, no_data); 1371 + rescale_grid_uint32 ((unsigned int *) buf_out, tileWidth, tileHeight, 1372 + (const unsigned int *) buf_in, x, y, tic_x, 1373 + tic_y, no_data); 1375 1374 break; 1376 1375 case RL2_SAMPLE_FLOAT: 1377 1376 rescale_grid_float ((float *) buf_out, tileWidth, tileHeight, 1378 1377 (const float *) buf_in, x, y, tic_x, tic_y, 1379 1378 no_data); 1380 1379 break; 1381 1380 case RL2_SAMPLE_DOUBLE: ................................................................................ 1516 1515 break; 1517 1516 } 1518 1517 pos_x += geo_x; 1519 1518 } 1520 1519 pos_y -= geo_y; 1521 1520 } 1522 1521 rst = (rl2PrivRasterPtr) raster_in; 1523 - rescale_grid (buf_out, tileWidth, tileHeight, 1524 - rst->rasterBuffer, sample_type, x, y, tic_x, 1525 - tic_y, no_data); 1522 + rescale_grid (buf_out, tileWidth, tileHeight, rst->rasterBuffer, 1523 + sample_type, x, y, tic_x, tic_y, no_data); 1526 1524 rl2_destroy_raster (raster_in); 1527 1525 raster_in = NULL; 1528 1526 tile_in = tile_in->next; 1529 1527 } 1530 1528 1531 1529 raster_out = NULL; 1532 1530 raster_out = ................................................................................ 1548 1546 goto error; 1549 1547 } 1550 1548 rl2_destroy_raster (raster_out); 1551 1549 raster_out = NULL; 1552 1550 1553 1551 /* INSERTing the tile */ 1554 1552 if (!do_insert_pyramid_tile 1555 - (handle, blob_odd, blob_odd_sz, blob_even, blob_even_sz, 1556 - id_level, pyr->section_id, pyr->srid, tile_out->minx, 1557 - tile_out->miny, tile_out->maxx, tile_out->maxy, stmt_tils, 1558 - stmt_data)) 1553 + (handle, blob_odd, blob_odd_sz, blob_even, blob_even_sz, id_level, 1554 + pyr->section_id, pyr->srid, tile_out->minx, tile_out->miny, 1555 + tile_out->maxx, tile_out->maxy, stmt_tils, stmt_data)) 1559 1556 goto error; 1560 1557 1561 1558 tile_out = tile_out->next; 1562 1559 } 1563 1560 1564 1561 return 1; 1565 1562 ................................................................................ 1573 1570 if (mask != NULL) 1574 1571 free (mask); 1575 1572 return 0; 1576 1573 } 1577 1574 1578 1575 static double 1579 1576 rescale_mb_pixel_uint8 (const unsigned char *buf_in, unsigned int tileWidth, 1580 - unsigned int tileHeight, unsigned int x, 1581 - unsigned int y, unsigned char nd, unsigned char nb, 1577 + unsigned int tileHeight, unsigned int x, unsigned int y, 1578 + unsigned char nd, unsigned char nb, 1582 1579 unsigned char num_bands) 1583 1580 { 1584 1581 /* rescaling a MultiBand pixel sample (8x8) - UINT8 */ 1585 1582 unsigned int row; 1586 1583 unsigned int col; 1587 1584 int nodata = 0; 1588 1585 int valid = 0; ................................................................................ 1651 1648 && pxl->nBands == num_bands) 1652 1649 { 1653 1650 rl2PrivSamplePtr sample = pxl->Samples + nb; 1654 1651 nd = sample->uint8; 1655 1652 } 1656 1653 } 1657 1654 *(p_out + nb) = 1658 - rescale_mb_pixel_uint8 (buf_in, tileWidth, 1659 - tileHeight, col * 8, 1660 - row * 8, nd, nb, num_bands); 1655 + rescale_mb_pixel_uint8 (buf_in, tileWidth, tileHeight, 1656 + col * 8, row * 8, nd, nb, 1657 + num_bands); 1661 1658 } 1662 1659 } 1663 1660 } 1664 1661 } 1665 1662 1666 1663 static double 1667 1664 rescale_mb_pixel_uint16 (const unsigned short *buf_in, unsigned int tileWidth, ................................................................................ 1741 1738 { 1742 1739 rl2PrivSamplePtr sample = pxl->Samples + nb; 1743 1740 nd = sample->uint16; 1744 1741 } 1745 1742 } 1746 1743 *(p_out + nb) = 1747 1744 rescale_mb_pixel_uint16 (buf_in, tileWidth, 1748 - tileHeight, col * 8, 1749 - row * 8, nd, nb, num_bands); 1745 + tileHeight, col * 8, row * 8, 1746 + nd, nb, num_bands); 1750 1747 } 1751 1748 } 1752 1749 } 1753 1750 } 1754 1751 1755 1752 static void 1756 1753 rescale_multiband (void *buf_out, unsigned int tileWidth, ................................................................................ 1765 1762 case RL2_SAMPLE_UINT8: 1766 1763 rescale_multiband_uint8 ((unsigned char *) buf_out, tileWidth, 1767 1764 tileHeight, (const unsigned char *) buf_in, 1768 1765 x, y, tic_x, tic_y, num_bands, no_data); 1769 1766 break; 1770 1767 case RL2_SAMPLE_UINT16: 1771 1768 rescale_multiband_uint16 ((unsigned short *) buf_out, tileWidth, 1772 - tileHeight, 1773 - (const unsigned short *) buf_in, x, y, 1774 - tic_x, tic_y, num_bands, no_data); 1769 + tileHeight, (const unsigned short *) buf_in, 1770 + x, y, tic_x, tic_y, num_bands, no_data); 1775 1771 break; 1776 1772 }; 1777 1773 } 1778 1774 1779 1775 static int 1780 1776 update_sect_pyramid_multiband (sqlite3 * handle, sqlite3_stmt * stmt_rd, 1781 1777 sqlite3_stmt * stmt_tils, ................................................................................ 1900 1896 } 1901 1897 pos_x += geo_x; 1902 1898 } 1903 1899 pos_y -= geo_y; 1904 1900 } 1905 1901 rst = (rl2PrivRasterPtr) raster_in; 1906 1902 rescale_multiband (buf_out, tileWidth, tileHeight, 1907 - rst->rasterBuffer, sample_type, num_bands, 1908 - x, y, tic_x, tic_y, no_data); 1903 + rst->rasterBuffer, sample_type, num_bands, x, 1904 + y, tic_x, tic_y, no_data); 1909 1905 rl2_destroy_raster (raster_in); 1910 1906 raster_in = NULL; 1911 1907 tile_in = tile_in->next; 1912 1908 } 1913 1909 1914 1910 raster_out = NULL; 1915 1911 raster_out = ................................................................................ 1931 1927 goto error; 1932 1928 } 1933 1929 rl2_destroy_raster (raster_out); 1934 1930 raster_out = NULL; 1935 1931 1936 1932 /* INSERTing the tile */ 1937 1933 if (!do_insert_pyramid_tile 1938 - (handle, blob_odd, blob_odd_sz, blob_even, blob_even_sz, 1939 - id_level, pyr->section_id, pyr->srid, tile_out->minx, 1940 - tile_out->miny, tile_out->maxx, tile_out->maxy, stmt_tils, 1941 - stmt_data)) 1934 + (handle, blob_odd, blob_odd_sz, blob_even, blob_even_sz, id_level, 1935 + pyr->section_id, pyr->srid, tile_out->minx, tile_out->miny, 1936 + tile_out->maxx, tile_out->maxy, stmt_tils, stmt_data)) 1942 1937 goto error; 1943 1938 1944 1939 tile_out = tile_out->next; 1945 1940 } 1946 1941 1947 1942 return 1; 1948 1943 ................................................................................ 2123 2118 0); 2124 2119 } 2125 2120 compression = RL2_COMPRESSION_PNG; 2126 2121 } 2127 2122 else 2128 2123 nd = rl2_clone_pixel (no_data); 2129 2124 raster = 2130 - rl2_create_raster (tileWidth, tileHeight, 2131 - RL2_SAMPLE_UINT8, RL2_PIXEL_GRAYSCALE, 2132 - 1, gray, tileWidth * tileHeight, NULL, 2133 - alpha, tileWidth * tileHeight, nd); 2125 + rl2_create_raster (tileWidth, tileHeight, RL2_SAMPLE_UINT8, 2126 + RL2_PIXEL_GRAYSCALE, 1, gray, 2127 + tileWidth * tileHeight, NULL, alpha, 2128 + tileWidth * tileHeight, nd); 2134 2129 } 2135 2130 else if (pyr->pixel_type == RL2_PIXEL_RGB) 2136 2131 { 2137 2132 /* RGB Pyramid */ 2138 2133 nd = rl2_clone_pixel (no_data); 2139 2134 raster = 2140 - rl2_create_raster (tileWidth, tileHeight, 2141 - RL2_SAMPLE_UINT8, RL2_PIXEL_RGB, 3, 2142 - rgb, tileWidth * tileHeight * 3, NULL, 2143 - alpha, tileWidth * tileHeight, nd); 2135 + rl2_create_raster (tileWidth, tileHeight, RL2_SAMPLE_UINT8, 2136 + RL2_PIXEL_RGB, 3, rgb, 2137 + tileWidth * tileHeight * 3, NULL, alpha, 2138 + tileWidth * tileHeight, nd); 2144 2139 } 2145 2140 if (raster == NULL) 2146 2141 { 2147 2142 fprintf (stderr, "ERROR: unable to create a Pyramid Tile\n"); 2148 2143 goto error; 2149 2144 } 2150 2145 if (rl2_raster_encode ................................................................................ 2157 2152 rl2_destroy_raster (raster); 2158 2153 raster = NULL; 2159 2154 rl2_graph_destroy_context (ctx); 2160 2155 ctx = NULL; 2161 2156 2162 2157 /* INSERTing the tile */ 2163 2158 if (!do_insert_pyramid_tile 2164 - (handle, blob_odd, blob_odd_sz, blob_even, blob_even_sz, 2165 - id_level, pyr->section_id, pyr->srid, tile_out->minx, 2166 - tile_out->miny, tile_out->maxx, tile_out->maxy, stmt_tils, 2167 - stmt_data)) 2159 + (handle, blob_odd, blob_odd_sz, blob_even, blob_even_sz, id_level, 2160 + pyr->section_id, pyr->srid, tile_out->minx, tile_out->miny, 2161 + tile_out->maxx, tile_out->maxy, stmt_tils, stmt_data)) 2168 2162 goto error; 2169 2163 2170 2164 tile_out = tile_out->next; 2171 2165 } 2172 2166 2173 2167 return 1; 2174 2168 ................................................................................ 2346 2340 rl2_graph_destroy_context (ctx); 2347 2341 return 0; 2348 2342 } 2349 2343 2350 2344 #define floor2(exp) ((long) exp) 2351 2345 2352 2346 static rl2RasterPtr 2353 -create_124_rescaled_raster (const unsigned char *rgba, 2354 - unsigned char pixel_type, unsigned int tileWidth, 2355 - unsigned int tileHeight, int scale) 2347 +create_124_rescaled_raster (const unsigned char *rgba, unsigned char pixel_type, 2348 + unsigned int tileWidth, unsigned int tileHeight, 2349 + int scale) 2356 2350 { 2357 2351 /* creating a rescaled raster (1,2 or 4 bit pyramids) 2358 2352 / 2359 2353 / this function builds an high quality rescaled sub-image by applying pixel interpolation 2360 2354 / 2361 2355 / this code is widely inspired by the original GD gdImageCopyResampled() function 2362 2356 */ ................................................................................ 2535 2529 *p_msk = 1; 2536 2530 } 2537 2531 } 2538 2532 } 2539 2533 } 2540 2534 2541 2535 raster = 2542 - rl2_create_raster (out_width, out_height, RL2_SAMPLE_UINT8, 2543 - pixel_type, num_bands, rgb, rgb_sz, NULL, mask, 2544 - mask_sz, NULL); 2536 + rl2_create_raster (out_width, out_height, RL2_SAMPLE_UINT8, pixel_type, 2537 + num_bands, rgb, rgb_sz, NULL, mask, mask_sz, NULL); 2545 2538 return raster; 2546 2539 } 2547 2540 2548 2541 static void 2549 2542 copy_124_rescaled (rl2RasterPtr raster_out, rl2RasterPtr raster_in, 2550 2543 unsigned int base_x, unsigned int base_y) 2551 2544 { ................................................................................ 2747 2740 double tile_x = sqlite3_column_double (stmt_geo, 1); 2748 2741 double tile_y = sqlite3_column_double (stmt_geo, 2); 2749 2742 2750 2743 rgba = load_tile_base (stmt_data, tile_id, palette, no_data); 2751 2744 if (rgba == NULL) 2752 2745 goto error; 2753 2746 base_tile = 2754 - create_124_rescaled_raster (rgba, out_pixel_type, 2755 - tileWidth, tileHeight, factor); 2747 + create_124_rescaled_raster (rgba, out_pixel_type, tileWidth, 2748 + tileHeight, factor); 2756 2749 free (rgba); 2757 2750 if (base_tile == NULL) 2758 2751 goto error; 2759 2752 shift_x = tile_x - minx; 2760 2753 shift_y = maxy - tile_y; 2761 2754 x = (int) (shift_x / res_x); 2762 2755 y = (int) (shift_y / res_y); ................................................................................ 3122 3115 for (ib = 0; ib < num_bands; ib++) 3123 3116 *p_out++ = (unsigned char) (*(sum + ib) / (double) valid); 3124 3117 free (sum); 3125 3118 *p_msk = 1; 3126 3119 } 3127 3120 3128 3121 static void 3129 -mb_prime_nodata_u8 (unsigned char *buf, unsigned int width, 3130 - unsigned int height, unsigned char num_bands, 3131 - rl2PixelPtr no_data) 3122 +mb_prime_nodata_u8 (unsigned char *buf, unsigned int width, unsigned int height, 3123 + unsigned char num_bands, rl2PixelPtr no_data) 3132 3124 { 3133 3125 /* priming a void buffer */ 3134 3126 rl2PrivPixelPtr nd = (rl2PrivPixelPtr) no_data; 3135 3127 unsigned int x; 3136 3128 unsigned int y; 3137 3129 unsigned char ib; 3138 3130 unsigned char *p = buf; ................................................................................ 3252 3244 (unsigned char *) buf_in, mask_in, 3253 3245 (unsigned char *) buf, mask, x, y, 3254 3246 ox, oy, no_data); 3255 3247 break; 3256 3248 case RL2_SAMPLE_UINT16: 3257 3249 rescale_multiband_u16 (tileWidth, tileHeight, num_bands, 3258 3250 out_width, out_height, factor, 3259 - (unsigned short *) buf_in, 3260 - mask_in, (unsigned short *) buf, 3261 - mask, x, y, ox, oy, no_data); 3251 + (unsigned short *) buf_in, mask_in, 3252 + (unsigned short *) buf, mask, x, y, 3253 + ox, oy, no_data); 3262 3254 break; 3263 3255 }; 3264 3256 ox++; 3265 3257 } 3266 3258 oy++; 3267 3259 } 3268 3260 ................................................................................ 4044 4036 out_height, factor, 4045 4037 (unsigned char *) buf_in, 4046 4038 (unsigned char *) buf, mask, x, y, 4047 4039 ox, oy, no_data_u8); 4048 4040 break; 4049 4041 case RL2_SAMPLE_INT16: 4050 4042 rescale_datagrid_16 (tileWidth, tileHeight, out_width, 4051 - out_height, factor, 4052 - (short *) buf_in, (short *) buf, 4053 - mask, x, y, ox, oy, no_data_16); 4043 + out_height, factor, (short *) buf_in, 4044 + (short *) buf, mask, x, y, ox, oy, 4045 + no_data_16); 4054 4046 break; 4055 4047 case RL2_SAMPLE_UINT16: 4056 4048 rescale_datagrid_u16 (tileWidth, tileHeight, out_width, 4057 4049 out_height, factor, 4058 4050 (unsigned short *) buf_in, 4059 - (unsigned short *) buf, mask, x, 4060 - y, ox, oy, no_data_u16); 4051 + (unsigned short *) buf, mask, x, y, 4052 + ox, oy, no_data_u16); 4061 4053 break; 4062 4054 case RL2_SAMPLE_INT32: 4063 4055 rescale_datagrid_32 (tileWidth, tileHeight, out_width, 4064 4056 out_height, factor, (int *) buf_in, 4065 4057 (int *) buf, mask, x, y, ox, oy, 4066 4058 no_data_32); 4067 4059 break; ................................................................................ 4097 4089 return raster; 4098 4090 } 4099 4091 4100 4092 static int 4101 4093 rescale_monolithic_multiband (int id_level, 4102 4094 unsigned int tileWidth, unsigned int tileHeight, 4103 4095 unsigned char sample_type, 4104 - unsigned char num_bands, int factor, 4105 - double res_x, double res_y, double minx, 4106 - double miny, double maxx, double maxy, 4107 - unsigned char *buffer, int buf_size, 4108 - unsigned char *mask, int *mask_size, 4096 + unsigned char num_bands, int factor, double res_x, 4097 + double res_y, double minx, double miny, 4098 + double maxx, double maxy, unsigned char *buffer, 4099 + int buf_size, unsigned char *mask, int *mask_size, 4109 4100 rl2PixelPtr no_data, sqlite3_stmt * stmt_geo, 4110 4101 sqlite3_stmt * stmt_data) 4111 4102 { 4112 4103 /* rescaling monolithic MultiBand */ 4113 4104 rl2RasterPtr raster = NULL; 4114 4105 rl2RasterPtr base_tile = NULL; 4115 4106 rl2PrivRasterPtr rst; ................................................................................ 4127 4118 p_out = mask; 4128 4119 for (y = 0; y < tileHeight; y++) 4129 4120 { 4130 4121 /* priming full transparency */ 4131 4122 for (x = 0; x < tileWidth; x++) 4132 4123 *p_out++ = 0; 4133 4124 } 4134 - rl2_prime_void_tile (buffer, tileWidth, tileHeight, sample_type, 4135 - num_bands, no_data); 4125 + rl2_prime_void_tile (buffer, tileWidth, tileHeight, sample_type, num_bands, 4126 + no_data); 4136 4127 /* creating the output raster */ 4137 4128 raster = 4138 4129 rl2_create_raster (tileWidth, tileHeight, sample_type, 4139 4130 RL2_PIXEL_MULTIBAND, num_bands, buffer, buf_size, 4140 4131 NULL, mask, *mask_size, nd); 4141 4132 if (raster == NULL) 4142 4133 goto error; ................................................................................ 4338 4329 rl2_destroy_raster (raster); 4339 4330 } 4340 4331 return 0; 4341 4332 } 4342 4333 4343 4334 static int 4344 4335 prepare_section_pyramid_stmts (sqlite3 * handle, const char *coverage, 4345 - int mixed_resolutions, 4346 - sqlite3_stmt ** xstmt_rd, 4336 + int mixed_resolutions, sqlite3_stmt ** xstmt_rd, 4347 4337 sqlite3_stmt ** xstmt_levl, 4348 4338 sqlite3_stmt ** xstmt_tils, 4349 4339 sqlite3_stmt ** xstmt_data) 4350 4340 { 4351 4341 /* preparing the section pyramid related SQL statements */ 4352 4342 char *table_tile_data; 4353 4343 char *xtable_tile_data; ................................................................................ 4510 4500 4511 4501 if (!get_section_infos 4512 4502 (handle, coverage, section_id, §_width, §_height, &minx, 4513 4503 &miny, &maxx, &maxy, &palette, &no_data)) 4514 4504 goto error; 4515 4505 4516 4506 if (!prepare_section_pyramid_stmts 4517 - (handle, coverage, mixed_resolutions, &stmt_rd, &stmt_levl, 4518 - &stmt_tils, &stmt_data)) 4507 + (handle, coverage, mixed_resolutions, &stmt_rd, &stmt_levl, &stmt_tils, 4508 + &stmt_data)) 4519 4509 goto error; 4520 4510 4521 4511 while (1) 4522 4512 { 4523 4513 /* looping on pyramid levels */ 4524 4514 if (mixed_resolutions) 4525 4515 table_levels = sqlite3_mprintf ("%s_section_levels", coverage); ................................................................................ 4590 4580 scale = 8; 4591 4581 if (first) 4592 4582 { 4593 4583 pyr = 4594 4584 alloc_sect_pyramid (section_id, sect_width, 4595 4585 sect_height, sample_type, 4596 4586 pixel_type, num_samples, 4597 - compression, quality, 4598 - srid, new_res_x, 4599 - new_res_y, 4587 + compression, quality, srid, 4588 + new_res_x, new_res_y, 4600 4589 (double) tileWidth * 4601 4590 new_res_x, 4602 4591 (double) tileHeight * 4603 - new_res_y, minx, miny, 4604 - maxx, maxy, scale); 4592 + new_res_y, minx, miny, maxx, 4593 + maxy, scale); 4605 4594 first = 0; 4606 4595 if (pyr == NULL) 4607 4596 goto error; 4608 4597 } 4609 4598 if (!insert_tile_into_section_pyramid 4610 4599 (pyr, tile_id, tminx, tminy, tmaxx, tmaxy)) 4611 4600 goto error; ................................................................................ 4965 4954 } 4966 4955 4967 4956 static int 4968 4957 get_section_raw_raster_data (sqlite3 * handle, int max_threads, 4969 4958 const char *coverage, sqlite3_int64 sect_id, 4970 4959 unsigned int width, unsigned int height, 4971 4960 unsigned char sample_type, 4972 - unsigned char pixel_type, 4973 - unsigned char num_bands, double minx, 4974 - double maxy, double x_res, double y_res, 4975 - unsigned char **buffer, int *buf_size, 4976 - rl2PalettePtr palette, rl2PixelPtr no_data) 4961 + unsigned char pixel_type, unsigned char num_bands, 4962 + double minx, double maxy, double x_res, 4963 + double y_res, unsigned char **buffer, 4964 + int *buf_size, rl2PalettePtr palette, 4965 + rl2PixelPtr no_data) 4977 4966 { 4978 4967 /* attempting to return a buffer containing raw pixels from the whole DBMS Section */ 4979 4968 unsigned char *bufpix = NULL; 4980 4969 int bufpix_size; 4981 4970 char *xtiles; 4982 4971 char *xxtiles; 4983 4972 char *xdata; ................................................................................ 5011 5000 } 5012 5001 memset (bufpix, 0, bufpix_size); 5013 5002 5014 5003 /* preparing the "tiles" SQL query */ 5015 5004 xtiles = sqlite3_mprintf ("%s_tiles", coverage); 5016 5005 xxtiles = rl2_double_quoted_sql (xtiles); 5017 5006 sql = 5018 - sqlite3_mprintf 5019 - ("SELECT tile_id, MbrMinX(geometry), MbrMaxY(geometry) " 5020 - "FROM \"%s\" " "WHERE pyramid_level = 0 AND section_id = ?", xxtiles); 5007 + sqlite3_mprintf ("SELECT tile_id, MbrMinX(geometry), MbrMaxY(geometry) " 5008 + "FROM \"%s\" " 5009 + "WHERE pyramid_level = 0 AND section_id = ?", xxtiles); 5021 5010 sqlite3_free (xtiles); 5022 5011 free (xxtiles); 5023 5012 ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt_tiles, NULL); 5024 5013 sqlite3_free (sql); 5025 5014 if (ret != SQLITE_OK) 5026 5015 { 5027 5016 printf ("SELECT section raw tiles SQL error: %s\n", ................................................................................ 5070 5059 if (bufpix != NULL) 5071 5060 free (bufpix); 5072 5061 return 0; 5073 5062 } 5074 5063 5075 5064 static void 5076 5065 raster_tile_124_rescaled (unsigned char *outbuf, 5077 - unsigned char pixel_type, 5078 - const unsigned char *inbuf, 5066 + unsigned char pixel_type, const unsigned char *inbuf, 5079 5067 unsigned int section_width, 5080 5068 unsigned int section_height, unsigned int out_width, 5081 5069 unsigned int out_height, rl2PalettePtr palette) 5082 5070 { 5083 5071 /* 5084 5072 / this function builds an high quality rescaled sub-image by applying pixel interpolation 5085 5073 / ................................................................................ 5369 5357 do_build_124_bit_section_pyramid (sqlite3 * handle, int max_threads, 5370 5358 const char *coverage, int mixed_resolutions, 5371 5359 sqlite3_int64 section_id, 5372 5360 unsigned char sample_type, 5373 5361 unsigned char pixel_type, 5374 5362 unsigned char num_samples, int srid, 5375 5363 unsigned int tileWidth, 5376 - unsigned int tileHeight, 5377 - unsigned char bgRed, unsigned char bgGreen, 5378 - unsigned char bgBlue) 5364 + unsigned int tileHeight, unsigned char bgRed, 5365 + unsigned char bgGreen, unsigned char bgBlue) 5379 5366 { 5380 5367 /* attempting to (re)build a 1,2,4-bit section pyramid from scratch */ 5381 5368 double base_res_x; 5382 5369 double base_res_y; 5383 5370 unsigned int sect_width; 5384 5371 unsigned int sect_height; 5385 5372 int id_level = 0; ................................................................................ 5438 5425 if (!get_section_raw_raster_data 5439 5426 (handle, max_threads, coverage, section_id, sect_width, sect_height, 5440 5427 sample_type, pixel_type, num_samples, minx, maxy, base_res_x, 5441 5428 base_res_y, &inbuf, &inbuf_size, palette, no_data)) 5442 5429 goto error; 5443 5430 5444 5431 if (!prepare_section_pyramid_stmts 5445 - (handle, coverage, mixed_resolutions, &stmt_rd, &stmt_levl, 5446 - &stmt_tils, &stmt_data)) 5432 + (handle, coverage, mixed_resolutions, &stmt_rd, &stmt_levl, &stmt_tils, 5433 + &stmt_data)) 5447 5434 goto error; 5448 5435 5449 5436 id_level = 1; 5450 5437 scale = 2; 5451 5438 x_res = base_res_x * 2.0; 5452 5439 y_res = base_res_y * 2.0; 5453 5440 while (1) ................................................................................ 5541 5528 if (no_data == NULL) 5542 5529 nd = NULL; 5543 5530 else 5544 5531 { 5545 5532 /* converting the NO-DATA pixel */ 5546 5533 nd = rl2_create_pixel (RL2_SAMPLE_UINT8, 5547 5534 RL2_PIXEL_RGB, 3); 5548 - rl2_set_pixel_sample_uint8 (nd, 5549 - RL2_RED_BAND, 5535 + rl2_set_pixel_sample_uint8 (nd, RL2_RED_BAND, 5550 5536 bgRed); 5551 5537 rl2_set_pixel_sample_uint8 (nd, 5552 5538 RL2_GREEN_BAND, 5553 5539 bgGreen); 5554 - rl2_set_pixel_sample_uint8 (nd, 5555 - RL2_BLUE_BAND, 5540 + rl2_set_pixel_sample_uint8 (nd, RL2_BLUE_BAND, 5556 5541 bgBlue); 5557 5542 } 5558 5543 } 5559 5544 t_maxx = t_minx + (tileWidth * x_res); 5560 5545 if (!copy_124_tile 5561 5546 (out_pixel_type, outbuf, &tilebuf, 5562 5547 &tilebuf_sz, &tilemask, &tilemask_sz, row, col, ................................................................................ 5578 5563 if (raster == NULL) 5579 5564 { 5580 5565 fprintf (stderr, 5581 5566 "ERROR: unable to create a Pyramid Tile\n"); 5582 5567 goto error; 5583 5568 } 5584 5569 if (rl2_raster_encode 5585 - (raster, RL2_COMPRESSION_PNG, &blob_odd, 5586 - &blob_odd_sz, &blob_even, &blob_even_sz, 100, 5587 - 1) != RL2_OK) 5570 + (raster, RL2_COMPRESSION_PNG, &blob_odd, &blob_odd_sz, 5571 + &blob_even, &blob_even_sz, 100, 1) != RL2_OK) 5588 5572 { 5589 5573 fprintf (stderr, 5590 5574 "ERROR: unable to encode a Pyramid tile\n"); 5591 5575 goto error; 5592 5576 } 5593 5577 5594 5578 /* INSERTing the tile */ ................................................................................ 5650 5634 } 5651 5635 5652 5636 static int 5653 5637 do_build_palette_section_pyramid (sqlite3 * handle, int max_threads, 5654 5638 const char *coverage, int mixed_resolutions, 5655 5639 sqlite3_int64 section_id, int srid, 5656 5640 unsigned int tileWidth, 5657 - unsigned int tileHeight, 5658 - unsigned char bgRed, unsigned char bgGreen, 5659 - unsigned char bgBlue) 5641 + unsigned int tileHeight, unsigned char bgRed, 5642 + unsigned char bgGreen, unsigned char bgBlue) 5660 5643 { 5661 5644 /* attempting to (re)build a Palette section pyramid from scratch */ 5662 5645 double base_res_x; 5663 5646 double base_res_y; 5664 5647 unsigned int sect_width; 5665 5648 unsigned int sect_height; 5666 5649 int id_level = 0; ................................................................................ 5721 5704 if (!get_section_raw_raster_data 5722 5705 (handle, max_threads, coverage, section_id, sect_width, sect_height, 5723 5706 RL2_SAMPLE_UINT8, RL2_PIXEL_PALETTE, 1, minx, maxy, base_res_x, 5724 5707 base_res_y, &inbuf, &inbuf_size, palette, no_data)) 5725 5708 goto error; 5726 5709 5727 5710 if (!prepare_section_pyramid_stmts 5728 - (handle, coverage, mixed_resolutions, &stmt_rd, &stmt_levl, 5729 - &stmt_tils, &stmt_data)) 5711 + (handle, coverage, mixed_resolutions, &stmt_rd, &stmt_levl, &stmt_tils, 5712 + &stmt_data)) 5730 5713 goto error; 5731 5714 5732 5715 id_level = 1; 5733 5716 scale = 2; 5734 5717 x_res = base_res_x * 2.0; 5735 5718 y_res = base_res_y * 2.0; 5736 5719 while (1) ................................................................................ 5797 5780 RL2_GREEN_BAND, 5798 5781 bgGreen); 5799 5782 rl2_set_pixel_sample_uint8 (nd, RL2_BLUE_BAND, 5800 5783 bgBlue); 5801 5784 } 5802 5785 t_maxx = t_minx + (tileWidth * x_res); 5803 5786 if (!copy_124_tile (out_pixel_type, outbuf, &tilebuf, 5804 - &tilebuf_sz, &tilemask, 5805 - &tilemask_sz, row, col, out_width, 5806 - out_height, tileWidth, tileHeight, 5807 - no_data)) 5787 + &tilebuf_sz, &tilemask, &tilemask_sz, 5788 + row, col, out_width, out_height, 5789 + tileWidth, tileHeight, no_data)) 5808 5790 { 5809 5791 fprintf (stderr, 5810 5792 "ERROR: unable to extract a Pyramid Tile\n"); 5811 5793 goto error; 5812 5794 } 5813 5795 5814 5796 raster = ................................................................................ 6067 6049 goto error; 6068 6050 } 6069 6051 else 6070 6052 { 6071 6053 /* ordinary RGB, Grayscale, MultiBand or DataGrid Pyramid */ 6072 6054 if (!do_build_section_pyramid 6073 6055 (handle, coverage, section_id, sample_type, pixel_type, 6074 - num_bands, compression, ptrcvg->mixedResolutions, 6075 - quality, srid, tileWidth, tileHeight)) 6056 + num_bands, compression, ptrcvg->mixedResolutions, quality, 6057 + srid, tileWidth, tileHeight)) 6076 6058 goto error; 6077 6059 } 6078 6060 if (verbose) 6079 6061 { 6080 6062 printf (" ----------\n"); 6081 6063 #if defined(_WIN32) && !defined(__MINGW32__) 6082 6064 printf ................................................................................ 6125 6107 ret = sqlite3_step (stmt); 6126 6108 if (ret == SQLITE_DONE) 6127 6109 break; 6128 6110 if (ret == SQLITE_ROW) 6129 6111 { 6130 6112 sqlite3_int64 section_id = sqlite3_column_int64 (stmt, 0); 6131 6113 if (rl2_build_section_pyramid 6132 - (handle, max_threads, coverage, section_id, 6133 - forced_rebuild, verbose) != RL2_OK) 6114 + (handle, max_threads, coverage, section_id, forced_rebuild, 6115 + verbose) != RL2_OK) 6134 6116 goto error; 6135 6117 } 6136 6118 else 6137 6119 { 6138 6120 fprintf (stderr, 6139 6121 "SELECT section_id; sqlite3_step() error: %s\n", 6140 6122 sqlite3_errmsg (handle)); ................................................................................ 6299 6281 out_sample_type = RL2_SAMPLE_UINT8; 6300 6282 out_pixel_type = RL2_PIXEL_RGB; 6301 6283 out_num_bands = 3; 6302 6284 out_compression = RL2_COMPRESSION_PNG; 6303 6285 out_quality = 100; 6304 6286 virt_levels = 1; 6305 6287 } 6306 - else if (sample_type == RL2_SAMPLE_UINT8 6307 - && pixel_type == RL2_PIXEL_PALETTE && num_bands == 1) 6288 + else if (sample_type == RL2_SAMPLE_UINT8 && pixel_type == RL2_PIXEL_PALETTE 6289 + && num_bands == 1) 6308 6290 { 6309 6291 /* palette 8: output colorspace is RGB compression PNG */ 6310 6292 out_sample_type = RL2_SAMPLE_UINT8; 6311 6293 out_pixel_type = RL2_PIXEL_RGB; 6312 6294 out_num_bands = 3; 6313 6295 out_compression = RL2_COMPRESSION_PNG; 6314 6296 out_quality = 100; ................................................................................ 6421 6403 if (tile_miny < miny) 6422 6404 end_y = miny; 6423 6405 6424 6406 if ((sample_type == RL2_SAMPLE_UINT8 6425 6407 && pixel_type == RL2_PIXEL_GRAYSCALE 6426 6408 && num_bands == 1) 6427 6409 || (sample_type == RL2_SAMPLE_UINT8 6428 - && pixel_type == RL2_PIXEL_RGB 6429 - && num_bands == 3) 6410 + && pixel_type == RL2_PIXEL_RGB && num_bands == 3) 6430 6411 || (sample_type == RL2_SAMPLE_UINT8 6431 6412 && pixel_type == RL2_PIXEL_PALETTE 6432 6413 && num_bands == 1)) 6433 6414 { 6434 6415 /* RGB, PALETTE or GRAYSCALE datasource (UINT8) */ 6435 6416 if (!rescale_monolithic_rgba 6436 - (id_level, tileWidth, tileHeight, 6437 - resize_factor, res_x, res_y, tile_minx, 6438 - tile_miny, tile_maxx, tile_maxy, buffer, 6439 - buf_size, mask, &mask_size, palette, no_data, 6440 - stmt_geo, stmt_rd)) 6417 + (id_level, tileWidth, tileHeight, resize_factor, 6418 + res_x, res_y, tile_minx, tile_miny, 6419 + tile_maxx, tile_maxy, buffer, buf_size, mask, 6420 + &mask_size, palette, no_data, stmt_geo, 6421 + stmt_rd)) 6441 6422 goto error; 6442 6423 if (mask_size == 0) 6443 6424 mask = NULL; 6444 6425 } 6445 6426 else if (((sample_type == RL2_SAMPLE_1_BIT 6446 6427 || sample_type == RL2_SAMPLE_2_BIT 6447 6428 || sample_type == RL2_SAMPLE_4_BIT) ................................................................................ 6479 6460 else if (pixel_type == RL2_PIXEL_DATAGRID) 6480 6461 { 6481 6462 /* DataGrid */ 6482 6463 if (!rescale_monolithic_datagrid 6483 6464 (id_level, tileWidth, tileHeight, sample_type, 6484 6465 resize_factor, res_x, res_y, tile_minx, 6485 6466 tile_miny, tile_maxx, tile_maxy, buffer, 6486 - buf_size, mask, &mask_size, no_data, 6487 - stmt_geo, stmt_rd)) 6467 + buf_size, mask, &mask_size, no_data, stmt_geo, 6468 + stmt_rd)) 6488 6469 goto error; 6489 6470 if (mask_size == 0) 6490 6471 mask = NULL; 6491 6472 } 6492 6473 else 6493 6474 { 6494 6475 /* unknown */ ................................................................................ 6532 6513 { 6533 6514 if (no_data == NULL) 6534 6515 nd = NULL; 6535 6516 else 6536 6517 { 6537 6518 nd = rl2_create_pixel (RL2_SAMPLE_UINT8, 6538 6519 RL2_PIXEL_RGB, 3); 6539 - rl2_set_pixel_sample_uint8 (nd, 6540 - RL2_RED_BAND, 6520 + rl2_set_pixel_sample_uint8 (nd, RL2_RED_BAND, 6541 6521 255); 6542 6522 rl2_set_pixel_sample_uint8 (nd, 6543 6523 RL2_GREEN_BAND, 6544 6524 255); 6545 - rl2_set_pixel_sample_uint8 (nd, 6546 - RL2_BLUE_BAND, 6525 + rl2_set_pixel_sample_uint8 (nd, RL2_BLUE_BAND, 6547 6526 255); 6548 6527 } 6549 6528 } 6550 6529 else 6551 6530 nd = rl2_clone_pixel (no_data); 6552 6531 6553 6532 raster = ................................................................................ 6627 6606 sqlite3_finalize (stmt_rd); 6628 6607 sqlite3_finalize (stmt_levl); 6629 6608 sqlite3_finalize (stmt_tils); 6630 6609 sqlite3_finalize (stmt_data); 6631 6610 if (verbose) 6632 6611 { 6633 6612 printf (" ----------\n"); 6634 - printf 6635 - (" Monolithic Pyramid levels successfully built for: %s\n", 6636 - coverage); 6613 + printf (" Monolithic Pyramid levels successfully built for: %s\n", 6614 + coverage); 6637 6615 } 6638 6616 free (buffer); 6639 6617 free (mask); 6640 6618 rl2_destroy_coverage (cvg); 6641 6619 6642 6620 return RL2_OK; 6643 6621
Changes to src/rl2rastersym.c.
690 690 for (ib = 0; ib < out_num_bands; ib++) 691 691 p_out++; 692 692 } 693 693 else 694 694 { 695 695 /* opaque pixel */ 696 696 p_out = 697 - mono_int8_pixel_handler (p_in, p_out, 698 - mono_band, 697 + mono_int8_pixel_handler (p_in, p_out, mono_band, 699 698 mono_handling); 700 699 } 701 700 } 702 701 else 703 702 { 704 703 /* testing for NO-DATA values */ 705 704 int match = 0; ................................................................................ 708 707 rl2_get_pixel_sample_int8 (no_data, &sample); 709 708 if (sample == *p_save++) 710 709 match++; 711 710 if (match != 1) 712 711 { 713 712 /* opaque pixel */ 714 713 p_out = 715 - mono_int8_pixel_handler (p_in, p_out, 716 - mono_band, 714 + mono_int8_pixel_handler (p_in, p_out, mono_band, 717 715 mono_handling); 718 716 } 719 717 else 720 718 { 721 719 /* NO-DATA pixel */ 722 720 for (ib = 0; ib < out_num_bands; ib++) 723 721 p_out++; ................................................................................ 760 758 { 761 759 ignore_no_data = 0; 762 760 if (rl2_get_pixel_type (no_data, &sample_type, &pixel_type, &nbands) 763 761 != RL2_OK) 764 762 ignore_no_data = 1; 765 763 if (nbands != num_bands) 766 764 ignore_no_data = 1; 767 - if (sample_type == RL2_SAMPLE_1_BIT 768 - || sample_type == RL2_SAMPLE_2_BIT 765 + if (sample_type == RL2_SAMPLE_1_BIT || sample_type == RL2_SAMPLE_2_BIT 769 766 || sample_type == RL2_SAMPLE_4_BIT 770 767 || sample_type == RL2_SAMPLE_UINT8) 771 768 ; 772 769 else 773 770 ignore_no_data = 1; 774 771 } 775 772 ................................................................................ 880 877 return apply_contrast_enhancement ((double) mono, p_out, mono_handling); 881 878 } 882 879 883 880 static void 884 881 copy_uint8_raw_selected_pixels (const unsigned char *buffer, 885 882 const unsigned char *mask, 886 883 unsigned char *outbuf, unsigned short width, 887 - unsigned short height, 888 - unsigned char num_bands, double x_res, 889 - double y_res, double minx, double maxy, 890 - double tile_minx, double tile_maxy, 884 + unsigned short height, unsigned char num_bands, 885 + double x_res, double y_res, double minx, 886 + double maxy, double tile_minx, double tile_maxy, 891 887 unsigned short tile_width, 892 - unsigned short tile_height, 893 - rl2PixelPtr no_data, unsigned char red_band, 888 + unsigned short tile_height, rl2PixelPtr no_data, 889 + unsigned char red_band, 894 890 unsigned char green_band, 895 891 unsigned char blue_band, 896 892 rl2BandHandlingPtr red_handling, 897 893 rl2BandHandlingPtr green_handling, 898 894 rl2BandHandlingPtr blue_handling) 899 895 { 900 896 /* copying UINT8 raw pixels from the DBMS tile into the output image */ ................................................................................ 969 965 /* skipping a transparent pixel */ 970 966 p_out += 3; 971 967 } 972 968 else 973 969 { 974 970 /* opaque pixel */ 975 971 p_out = 976 - mono_uint8_pixel_handler (p_in, p_out, 977 - red_band, 972 + mono_uint8_pixel_handler (p_in, p_out, red_band, 978 973 red_handling); 979 974 p_out = 980 975 mono_uint8_pixel_handler (p_in, p_out, 981 976 green_band, 982 977 green_handling); 983 978 p_out = 984 979 mono_uint8_pixel_handler (p_in, p_out, ................................................................................ 998 993 if (sample == *p_save++) 999 994 match++; 1000 995 } 1001 996 if (match != num_bands) 1002 997 { 1003 998 /* opaque pixel */ 1004 999 p_out = 1005 - mono_uint8_pixel_handler (p_in, p_out, 1006 - red_band, 1000 + mono_uint8_pixel_handler (p_in, p_out, red_band, 1007 1001 red_handling); 1008 1002 p_out = 1009 1003 mono_uint8_pixel_handler (p_in, p_out, 1010 1004 green_band, 1011 1005 green_handling); 1012 1006 p_out = 1013 1007 mono_uint8_pixel_handler (p_in, p_out, ................................................................................ 1026 1020 } 1027 1021 1028 1022 static void 1029 1023 copy_uint8_raw_mono_pixels (const unsigned char *buffer, 1030 1024 const unsigned char *mask, unsigned char *outbuf, 1031 1025 unsigned short width, unsigned short height, 1032 1026 unsigned char out_num_bands, 1033 - unsigned char num_bands, double x_res, 1034 - double y_res, double minx, double maxy, 1035 - double tile_minx, double tile_maxy, 1036 - unsigned short tile_width, 1027 + unsigned char num_bands, double x_res, double y_res, 1028 + double minx, double maxy, double tile_minx, 1029 + double tile_maxy, unsigned short tile_width, 1037 1030 unsigned short tile_height, rl2PixelPtr no_data, 1038 1031 unsigned char mono_band, 1039 1032 rl2BandHandlingPtr mono_handling) 1040 1033 { 1041 1034 /* copying UINT8 raw pixels from the DBMS tile into the output image */ 1042 1035 int x; 1043 1036 int y; ................................................................................ 1400 1393 } 1401 1394 p_in++; 1402 1395 } 1403 1396 } 1404 1397 } 1405 1398 1406 1399 static void 1407 -copy_uint16_raw_pixels (const unsigned short *buffer, 1408 - const unsigned char *mask, unsigned short *outbuf, 1409 - unsigned short width, unsigned short height, 1410 - unsigned char num_bands, double x_res, double y_res, 1411 - double minx, double maxy, double tile_minx, 1412 - double tile_maxy, unsigned short tile_width, 1413 - unsigned short tile_height, rl2PixelPtr no_data) 1400 +copy_uint16_raw_pixels (const unsigned short *buffer, const unsigned char *mask, 1401 + unsigned short *outbuf, unsigned short width, 1402 + unsigned short height, unsigned char num_bands, 1403 + double x_res, double y_res, double minx, double maxy, 1404 + double tile_minx, double tile_maxy, 1405 + unsigned short tile_width, unsigned short tile_height, 1406 + rl2PixelPtr no_data) 1414 1407 { 1415 1408 /* copying UINT16 raw pixels from the DBMS tile into the output image */ 1416 1409 int x; 1417 1410 int y; 1418 1411 int b; 1419 1412 int out_x; 1420 1413 int out_y; ................................................................................ 1537 1530 return apply_contrast_enhancement ((double) mono, p_out, mono_handling); 1538 1531 } 1539 1532 1540 1533 static void 1541 1534 copy_uint16_raw_selected_pixels (const unsigned short *buffer, 1542 1535 const unsigned char *mask, 1543 1536 unsigned char *outbuf, unsigned short width, 1544 - unsigned short height, 1545 - unsigned char num_bands, double x_res, 1546 - double y_res, double minx, double maxy, 1547 - double tile_minx, double tile_maxy, 1548 - unsigned short tile_width, 1537 + unsigned short height, unsigned char num_bands, 1538 + double x_res, double y_res, double minx, 1539 + double maxy, double tile_minx, 1540 + double tile_maxy, unsigned short tile_width, 1549 1541 unsigned short tile_height, 1550 1542 rl2PixelPtr no_data, unsigned char red_band, 1551 1543 unsigned char green_band, 1552 1544 unsigned char blue_band, 1553 1545 rl2BandHandlingPtr red_handling, 1554 1546 rl2BandHandlingPtr green_handling, 1555 1547 rl2BandHandlingPtr blue_handling) ................................................................................ 3083 3075 if (style->contrastEnhancement == 3084 3076 RL2_CONTRAST_ENHANCEMENT_NORMALIZE) 3085 3077 { 3086 3078 r = malloc (sizeof (rl2BandHandling)); 3087 3079 r->colorMap = NULL; 3088 3080 r->contrastEnhancement = 3089 3081 RL2_CONTRAST_ENHANCEMENT_NORMALIZE; 3090 - compute_stretching (band, &(r->minValue), 3091 - &(r->maxValue), &(r->scaleFactor)); 3082 + compute_stretching (band, &(r->minValue), &(r->maxValue), 3083 + &(r->scaleFactor)); 3092 3084 } 3093 3085 else if (style->contrastEnhancement == 3094 3086 RL2_CONTRAST_ENHANCEMENT_NONE) 3095 3087 { 3096 3088 r = malloc (sizeof (rl2BandHandling)); 3097 3089 r->colorMap = NULL; 3098 3090 r->contrastEnhancement = RL2_CONTRAST_ENHANCEMENT_NONE; ................................................................................ 3169 3161 if (style->contrastEnhancement == 3170 3162 RL2_CONTRAST_ENHANCEMENT_NORMALIZE) 3171 3163 { 3172 3164 g = malloc (sizeof (rl2BandHandling)); 3173 3165 g->colorMap = NULL; 3174 3166 g->contrastEnhancement = 3175 3167 RL2_CONTRAST_ENHANCEMENT_NORMALIZE; 3176 - compute_stretching (band, &(g->minValue), 3177 - &(g->maxValue), &(g->scaleFactor)); 3168 + compute_stretching (band, &(g->minValue), &(g->maxValue), 3169 + &(g->scaleFactor)); 3178 3170 } 3179 3171 else if (style->contrastEnhancement == 3180 3172 RL2_CONTRAST_ENHANCEMENT_NONE) 3181 3173 { 3182 3174 g = malloc (sizeof (rl2BandHandling)); 3183 3175 g->colorMap = NULL; 3184 3176 g->contrastEnhancement = RL2_CONTRAST_ENHANCEMENT_NONE; ................................................................................ 3255 3247 if (style->contrastEnhancement == 3256 3248 RL2_CONTRAST_ENHANCEMENT_NORMALIZE) 3257 3249 { 3258 3250 b = malloc (sizeof (rl2BandHandling)); 3259 3251 b->colorMap = NULL; 3260 3252 b->contrastEnhancement = 3261 3253 RL2_CONTRAST_ENHANCEMENT_NORMALIZE; 3262 - compute_stretching (band, &(b->minValue), 3263 - &(b->maxValue), &(b->scaleFactor)); 3254 + compute_stretching (band, &(b->minValue), &(b->maxValue), 3255 + &(b->scaleFactor)); 3264 3256 } 3265 3257 else if (style->contrastEnhancement == 3266 3258 RL2_CONTRAST_ENHANCEMENT_NONE) 3267 3259 { 3268 3260 b = malloc (sizeof (rl2BandHandling)); 3269 3261 b->colorMap = NULL; 3270 3262 b->contrastEnhancement = RL2_CONTRAST_ENHANCEMENT_NONE; ................................................................................ 3607 3599 if (style->contrastEnhancement == 3608 3600 RL2_CONTRAST_ENHANCEMENT_NORMALIZE) 3609 3601 { 3610 3602 g = malloc (sizeof (rl2BandHandling)); 3611 3603 g->colorMap = NULL; 3612 3604 g->contrastEnhancement = 3613 3605 RL2_CONTRAST_ENHANCEMENT_NORMALIZE; 3614 - compute_stretching (band, &(g->minValue), 3615 - &(g->maxValue), &(g->scaleFactor)); 3606 + compute_stretching (band, &(g->minValue), &(g->maxValue), 3607 + &(g->scaleFactor)); 3616 3608 } 3617 3609 else if (style->contrastEnhancement == 3618 3610 RL2_CONTRAST_ENHANCEMENT_NONE) 3619 3611 { 3620 3612 g = malloc (sizeof (rl2BandHandling)); 3621 3613 g->colorMap = NULL; 3622 3614 g->contrastEnhancement = RL2_CONTRAST_ENHANCEMENT_NONE; ................................................................................ 3901 3893 } 3902 3894 3903 3895 static int 3904 3896 do_copy_raw_selected_pixels (rl2PrivRasterPtr rst, unsigned char *outbuf, 3905 3897 unsigned int width, unsigned int height, 3906 3898 double x_res, double y_res, double minx, 3907 3899 double maxy, double tile_minx, double tile_maxy, 3908 - unsigned int tile_width, 3909 - unsigned int tile_height, rl2PixelPtr no_data, 3910 - unsigned char red_band, unsigned char green_band, 3911 - unsigned char blue_band, 3900 + unsigned int tile_width, unsigned int tile_height, 3901 + rl2PixelPtr no_data, unsigned char red_band, 3902 + unsigned char green_band, unsigned char blue_band, 3912 3903 rl2BandHandlingPtr red_handling, 3913 3904 rl2BandHandlingPtr green_handling, 3914 3905 rl2BandHandlingPtr blue_handling) 3915 3906 { 3916 3907 switch (rst->sampleType) 3917 3908 { 3918 3909 case RL2_SAMPLE_UINT8: ................................................................................ 4168 4159 } 4169 4160 4170 4161 static int 4171 4162 do_copy_raw_pixels (rl2PrivRasterPtr rst, unsigned char *outbuf, 4172 4163 unsigned int width, unsigned int height, 4173 4164 unsigned char sample_type, unsigned char num_bands, 4174 4165 double x_res, double y_res, double minx, double maxy, 4175 - double tile_minx, double tile_maxy, 4176 - unsigned int tile_width, unsigned int tile_height, 4177 - rl2PixelPtr no_data) 4166 + double tile_minx, double tile_maxy, unsigned int tile_width, 4167 + unsigned int tile_height, rl2PixelPtr no_data) 4178 4168 { 4179 4169 4180 4170 4181 4171 switch (sample_type) 4182 4172 { 4183 4173 case RL2_SAMPLE_INT8: 4184 4174 copy_int8_raw_pixels ((const char *) (rst->rasterBuffer), ................................................................................ 4191 4181 copy_int16_raw_pixels ((const short *) (rst->rasterBuffer), 4192 4182 (const unsigned char *) (rst->maskBuffer), 4193 4183 (short *) outbuf, width, height, 4194 4184 x_res, y_res, minx, maxy, tile_minx, 4195 4185 tile_maxy, tile_width, tile_height, no_data); 4196 4186 return 1; 4197 4187 case RL2_SAMPLE_UINT16: 4198 - copy_uint16_raw_pixels ((const unsigned short 4199 - *) (rst->rasterBuffer), 4188 + copy_uint16_raw_pixels ((const unsigned short *) (rst->rasterBuffer), 4200 4189 (const unsigned char *) (rst->maskBuffer), 4201 4190 (unsigned short *) outbuf, width, height, 4202 4191 num_bands, x_res, y_res, minx, maxy, 4203 4192 tile_minx, tile_maxy, tile_width, 4204 4193 tile_height, no_data); 4205 4194 return 1; 4206 4195 case RL2_SAMPLE_INT32: ................................................................................ 4233 4222 tile_minx, tile_maxy, tile_width, 4234 4223 tile_height, no_data); 4235 4224 return 1; 4236 4225 default: 4237 4226 copy_uint8_raw_pixels ((const unsigned char *) (rst->rasterBuffer), 4238 4227 (const unsigned char *) (rst->maskBuffer), 4239 4228 (unsigned char *) outbuf, width, height, 4240 - num_bands, x_res, y_res, minx, maxy, 4241 - tile_minx, tile_maxy, tile_width, 4242 - tile_height, no_data); 4229 + num_bands, x_res, y_res, minx, maxy, tile_minx, 4230 + tile_maxy, tile_width, tile_height, no_data); 4243 4231 return 1; 4244 4232 }; 4245 4233 return 0; 4246 4234 } 4247 4235 4248 4236 RL2_PRIVATE int 4249 4237 rl2_copy_raw_pixels (rl2RasterPtr raster, unsigned char *outbuf, 4250 4238 unsigned int width, 4251 4239 unsigned int height, unsigned char sample_type, 4252 4240 unsigned char num_bands, unsigned char auto_ndvi, 4253 - unsigned char red_band_index, 4254 - unsigned char nir_band_index, double x_res, double y_res, 4255 - double minx, double maxy, double tile_minx, 4256 - double tile_maxy, rl2PixelPtr no_data, 4241 + unsigned char red_band_index, unsigned char nir_band_index, 4242 + double x_res, double y_res, double minx, double maxy, 4243 + double tile_minx, double tile_maxy, rl2PixelPtr no_data, 4257 4244 rl2RasterSymbolizerPtr style, rl2RasterStatisticsPtr stats) 4258 4245 { 4259 4246 /* copying raw pixels into the output buffer */ 4260 4247 unsigned int tile_width; 4261 4248 unsigned int tile_height; 4262 4249 rl2PrivRasterPtr rst = (rl2PrivRasterPtr) raster; 4263 4250 ................................................................................ 4265 4252 return 0; 4266 4253 if (style != NULL && stats != NULL) 4267 4254 { 4268 4255 /* attempting to apply a RasterSymbolizer */ 4269 4256 int yes_no; 4270 4257 int categorize; 4271 4258 int interpolate; 4272 - if (rl2_is_raster_symbolizer_triple_band_selected (style, &yes_no) 4273 - == RL2_OK) 4259 + if (rl2_is_raster_symbolizer_triple_band_selected (style, &yes_no) == 4260 + RL2_OK) 4274 4261 { 4275 4262 if ((rst->sampleType == RL2_SAMPLE_UINT8 4276 4263 || rst->sampleType == RL2_SAMPLE_UINT16) 4277 4264 && (rst->pixelType == RL2_PIXEL_RGB 4278 4265 || rst->pixelType == RL2_PIXEL_MULTIBAND) && yes_no) 4279 4266 { 4280 4267 /* triple band selection - false color RGB */ ................................................................................ 4300 4287 blue_band, &red_handling, 4301 4288 &green_handling, 4302 4289 &blue_handling); 4303 4290 if (red_handling == NULL || green_handling == NULL 4304 4291 || blue_handling == NULL) 4305 4292 return 0; 4306 4293 if (do_copy_raw_selected_pixels 4307 - (rst, outbuf, width, height, x_res, y_res, minx, 4308 - maxy, tile_minx, tile_maxy, tile_width, 4309 - tile_height, no_data, red_band, green_band, 4310 - blue_band, red_handling, green_handling, 4311 - blue_handling)) 4294 + (rst, outbuf, width, height, x_res, y_res, minx, maxy, 4295 + tile_minx, tile_maxy, tile_width, tile_height, 4296 + no_data, red_band, green_band, blue_band, 4297 + red_handling, green_handling, blue_handling)) 4312 4298 return 1; 4313 4299 if (red_handling != NULL) 4314 4300 free (red_handling); 4315 4301 if (green_handling != NULL) 4316 4302 free (green_handling); 4317 4303 if (blue_handling != NULL) 4318 4304 free (blue_handling); ................................................................................ 4330 4316 /* applying Auto NDVI */ 4331 4317 rl2BandHandlingPtr ndvi_handling = NULL; 4332 4318 build_ndvi_handling ((rl2PrivRasterSymbolizerPtr) 4333 4319 style, &ndvi_handling); 4334 4320 if (ndvi_handling == NULL) 4335 4321 return 0; 4336 4322 if (do_auto_ndvi_pixels 4337 - (rst, outbuf, width, height, num_bands, x_res, 4338 - y_res, minx, maxy, tile_minx, tile_maxy, 4339 - tile_width, tile_height, no_data, red_band_index, 4340 - nir_band_index, ndvi_handling)) 4323 + (rst, outbuf, width, height, num_bands, x_res, y_res, 4324 + minx, maxy, tile_minx, tile_maxy, tile_width, 4325 + tile_height, no_data, red_band_index, nir_band_index, 4326 + ndvi_handling)) 4341 4327 return 1; 4342 4328 if (ndvi_handling != NULL) 4343 4329 destroy_ndvi_handling (ndvi_handling); 4344 4330 } 4345 4331 if (((rst->sampleType == RL2_SAMPLE_UINT8 4346 4332 || rst->sampleType == RL2_SAMPLE_UINT16) 4347 4333 || rst->pixelType == RL2_PIXEL_DATAGRID) && yes_no) ................................................................................ 4358 4344 style, 4359 4345 (rl2PrivRasterStatisticsPtr) 4360 4346 stats, mono_band, 4361 4347 &mono_handling); 4362 4348 if (mono_handling == NULL) 4363 4349 return 0; 4364 4350 if (do_copy_raw_mono_pixels 4365 - (rst, outbuf, width, height, num_bands, x_res, 4366 - y_res, minx, maxy, tile_minx, tile_maxy, 4367 - tile_width, tile_height, no_data, mono_band, 4368 - mono_handling)) 4351 + (rst, outbuf, width, height, num_bands, x_res, y_res, 4352 + minx, maxy, tile_minx, tile_maxy, tile_width, 4353 + tile_height, no_data, mono_band, mono_handling)) 4369 4354 return 1; 4370 4355 if (mono_handling != NULL) 4371 4356 destroy_mono_handling (mono_handling); 4372 4357 } 4373 4358 } 4374 4359 } 4375 4360 4376 4361 if (do_copy_raw_pixels 4377 - (rst, outbuf, width, height, sample_type, num_bands, x_res, y_res, 4378 - minx, maxy, tile_minx, tile_maxy, tile_width, tile_height, no_data)) 4362 + (rst, outbuf, width, height, sample_type, num_bands, x_res, y_res, minx, 4363 + maxy, tile_minx, tile_maxy, tile_width, tile_height, no_data)) 4379 4364 return 1; 4380 4365 4381 4366 return 0; 4382 4367 } 4383 4368 4384 4369 static void 4385 4370 get_int8_ennuple (const char *rawbuf, unsigned short row, unsigned short col, ................................................................................ 4466 4451 /* checking for NoData values */ 4467 4452 if (ennuple[i] == nd_val) 4468 4453 *has_no_data = 1; 4469 4454 } 4470 4455 } 4471 4456 4472 4457 static void 4473 -get_int16_ennuple (const short *rawbuf, unsigned short row, 4474 - unsigned short col, unsigned short row_stride, 4475 - rl2PixelPtr no_data, double ennuple[], int *has_no_data) 4458 +get_int16_ennuple (const short *rawbuf, unsigned short row, unsigned short col, 4459 + unsigned short row_stride, rl2PixelPtr no_data, 4460 + double ennuple[], int *has_no_data) 4476 4461 { 4477 4462 /* extracting a 3x3 "super-pixel" - INT16 */ 4478 4463 const short *p_in; 4479 4464 short nd_val = 0; 4480 4465 int i; 4481 4466 4482 4467 if (no_data != NULL) ................................................................................ 4642 4627 /* checking for NoData values */ 4643 4628 if (ennuple[i] == nd_val) 4644 4629 *has_no_data = 1; 4645 4630 } 4646 4631 } 4647 4632 4648 4633 static void 4649 -get_float_ennuple (const float *rawbuf, unsigned short row, 4650 - unsigned short col, unsigned short row_stride, 4651 - rl2PixelPtr no_data, double ennuple[], int *has_no_data) 4634 +get_float_ennuple (const float *rawbuf, unsigned short row, unsigned short col, 4635 + unsigned short row_stride, rl2PixelPtr no_data, 4636 + double ennuple[], int *has_no_data) 4652 4637 { 4653 4638 /* extracting a 3x3 "super-pixel" - FLOAT */ 4654 4639 const float *p_in; 4655 4640 float nd_val = 0.0; 4656 4641 int i; 4657 4642 4658 4643 if (no_data != NULL) ................................................................................ 5011 4996 if (no_data == NULL) 5012 4997 goto error; 5013 4998 5014 4999 /* preparing the "tiles" SQL query */ 5015 5000 xtiles = sqlite3_mprintf ("%s_tiles", coverage); 5016 5001 xxtiles = rl2_double_quoted_sql (xtiles); 5017 5002 sql = 5018 - sqlite3_mprintf 5019 - ("SELECT tile_id, MbrMinX(geometry), MbrMaxY(geometry) " 5020 - "FROM \"%s\" " "WHERE pyramid_level = ? AND ROWID IN ( " 5021 - "SELECT ROWID FROM SpatialIndex WHERE f_table_name = %Q " 5022 - "AND search_frame = BuildMBR(?, ?, ?, ?))", xxtiles, xtiles); 5003 + sqlite3_mprintf ("SELECT tile_id, MbrMinX(geometry), MbrMaxY(geometry) " 5004 + "FROM \"%s\" " 5005 + "WHERE pyramid_level = ? AND ROWID IN ( " 5006 + "SELECT ROWID FROM SpatialIndex WHERE f_table_name = %Q " 5007 + "AND search_frame = BuildMBR(?, ?, ?, ?))", xxtiles, 5008 + xtiles); 5023 5009 sqlite3_free (xtiles); 5024 5010 free (xxtiles); 5025 5011 ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt_tiles, NULL); 5026 5012 sqlite3_free (sql); 5027 5013 if (ret != SQLITE_OK) 5028 5014 { 5029 5015 printf ("SELECT shadedRelief tiles SQL error: %s\n", ................................................................................ 5126 5112 /* executing in a single thread */ 5127 5113 p_out = sr_mask; 5128 5114 for (row = 0; row < height; row++) 5129 5115 { 5130 5116 for (col = 0; col < width; col++) 5131 5117 *p_out++ = 5132 5118 shaded_relief_value (relief_factor, scale_factor, 5133 - altRadians, azRadians, rawbuf, 5134 - row, col, row_stride, 5135 - sample_type, no_data); 5119 + altRadians, azRadians, rawbuf, row, 5120 + col, row_stride, sample_type, 5121 + no_data); 5136 5122 } 5137 5123 } 5138 5124 else 5139 5125 { 5140 5126 /* executing as many concurrent threads */ 5141 5127 rl2AuxShadowerPtr aux = NULL; 5142 5128 rl2AuxShadowerPtr shadower;
Changes to src/rl2raw.c.
367 367 } 368 368 break; 369 369 case RL2_PIXEL_GRAYSCALE: 370 370 grayscale_as_rgb (rst->sampleType, no_data->Samples->uint8, 371 371 &transpR, &transpG, &transpB); 372 372 break; 373 373 case RL2_PIXEL_RGB: 374 - rl2_get_pixel_sample_uint8 ((rl2PixelPtr) no_data, 375 - RL2_RED_BAND, &transpR); 374 + rl2_get_pixel_sample_uint8 ((rl2PixelPtr) no_data, RL2_RED_BAND, 375 + &transpR); 376 376 rl2_get_pixel_sample_uint8 ((rl2PixelPtr) no_data, 377 377 RL2_GREEN_BAND, &transpG); 378 378 rl2_get_pixel_sample_uint8 ((rl2PixelPtr) no_data, 379 379 RL2_BLUE_BAND, &transpB); 380 380 break; 381 381 }; 382 382 } ................................................................................ 601 601 } 602 602 break; 603 603 case RL2_PIXEL_GRAYSCALE: 604 604 grayscale_as_rgb (rst->sampleType, no_data->Samples->uint8, 605 605 &transpR, &transpG, &transpB); 606 606 break; 607 607 case RL2_PIXEL_RGB: 608 - rl2_get_pixel_sample_uint8 ((rl2PixelPtr) no_data, 609 - RL2_RED_BAND, &transpR); 608 + rl2_get_pixel_sample_uint8 ((rl2PixelPtr) no_data, RL2_RED_BAND, 609 + &transpR); 610 610 rl2_get_pixel_sample_uint8 ((rl2PixelPtr) no_data, 611 611 RL2_GREEN_BAND, &transpG); 612 612 rl2_get_pixel_sample_uint8 ((rl2PixelPtr) no_data, 613 613 RL2_BLUE_BAND, &transpB); 614 614 break; 615 615 }; 616 616 } ................................................................................ 889 889 } 890 890 break; 891 891 case RL2_PIXEL_GRAYSCALE: 892 892 grayscale_as_rgb (rst->sampleType, no_data->Samples->uint8, 893 893 &transpR, &transpG, &transpB); 894 894 break; 895 895 case RL2_PIXEL_RGB: 896 - rl2_get_pixel_sample_uint8 ((rl2PixelPtr) no_data, 897 - RL2_RED_BAND, &transpR); 896 + rl2_get_pixel_sample_uint8 ((rl2PixelPtr) no_data, RL2_RED_BAND, 897 + &transpR); 898 898 rl2_get_pixel_sample_uint8 ((rl2PixelPtr) no_data, 899 899 RL2_GREEN_BAND, &transpG); 900 900 rl2_get_pixel_sample_uint8 ((rl2PixelPtr) no_data, 901 901 RL2_BLUE_BAND, &transpB); 902 902 break; 903 903 }; 904 904 } ................................................................................ 1506 1506 1507 1507 *buffer = buf; 1508 1508 *buf_size = sz; 1509 1509 return RL2_OK; 1510 1510 } 1511 1511 1512 1512 RL2_DECLARE int 1513 -rl2_raster_band_to_uint16 (rl2RasterPtr ptr, int band, 1514 - unsigned short **buffer, int *buf_size) 1513 +rl2_raster_band_to_uint16 (rl2RasterPtr ptr, int band, unsigned short **buffer, 1514 + int *buf_size) 1515 1515 { 1516 1516 /* attempting to export Raster BAND data as a UINT-16 array */ 1517 1517 unsigned short *buf; 1518 1518 int sz; 1519 1519 unsigned int row; 1520 1520 unsigned int col; 1521 1521 int nBand; ................................................................................ 1971 1971 } 1972 1972 } 1973 1973 } 1974 1974 1975 1975 RL2_PRIVATE unsigned char * 1976 1976 rl2_copy_endian_raw_pixels (const unsigned char *pixels, int pixels_sz, 1977 1977 unsigned int width, unsigned int height, 1978 - unsigned char sample_type, 1979 - unsigned char num_bands, int big_endian) 1978 + unsigned char sample_type, unsigned char num_bands, 1979 + int big_endian) 1980 1980 { 1981 1981 /* copying RAW pixels (in endian safe mode) */ 1982 1982 int sample_bytes = 0; 1983 1983 int outsize = width * height * num_bands; 1984 1984 unsigned char *outbuf = NULL; 1985 1985 1986 1986 switch (sample_type) ................................................................................ 2022 2022 copy_endian_raw_u8 (outbuf, pixels, width, height, num_bands); 2023 2023 break; 2024 2024 case RL2_SAMPLE_INT8: 2025 2025 copy_endian_raw_i8 ((char *) outbuf, (const char *) pixels, width, 2026 2026 height, num_bands); 2027 2027 break; 2028 2028 case RL2_SAMPLE_INT16: 2029 - copy_endian_raw_i16 ((short *) outbuf, (const short *) pixels, 2030 - width, height, num_bands, big_endian); 2029 + copy_endian_raw_i16 ((short *) outbuf, (const short *) pixels, width, 2030 + height, num_bands, big_endian); 2031 2031 break; 2032 2032 case RL2_SAMPLE_UINT16: 2033 2033 copy_endian_raw_u16 ((unsigned short *) outbuf, 2034 2034 (const unsigned short *) pixels, width, height, 2035 2035 num_bands, big_endian); 2036 2036 break; 2037 2037 case RL2_SAMPLE_INT32: ................................................................................ 2040 2040 break; 2041 2041 case RL2_SAMPLE_UINT32: 2042 2042 copy_endian_raw_u32 ((unsigned int *) outbuf, 2043 2043 (const unsigned int *) pixels, width, height, 2044 2044 num_bands, big_endian); 2045 2045 break; 2046 2046 case RL2_SAMPLE_FLOAT: 2047 - copy_endian_raw_flt ((float *) outbuf, (const float *) pixels, 2048 - width, height, num_bands, big_endian); 2047 + copy_endian_raw_flt ((float *) outbuf, (const float *) pixels, width, 2048 + height, num_bands, big_endian); 2049 2049 break; 2050 2050 case RL2_SAMPLE_DOUBLE: 2051 2051 copy_endian_raw_dbl ((double *) outbuf, (const double *) pixels, 2052 2052 width, height, num_bands, big_endian); 2053 2053 break; 2054 2054 }; 2055 2055 return outbuf; ................................................................................ 2065 2065 && coverage->nBands == raster->nBands) 2066 2066 return 1; 2067 2067 fprintf (stderr, "Mismatching RAW pixels !!!\n"); 2068 2068 return 0; 2069 2069 } 2070 2070 2071 2071 static void 2072 -copy_tile_raw_i8 (const char *in, unsigned int in_width, 2073 - unsigned int in_height, unsigned int startRow, 2074 - unsigned int startCol, char *out, unsigned int tileWidth, 2075 - unsigned int tileHeight, unsigned char num_bands) 2072 +copy_tile_raw_i8 (const char *in, unsigned int in_width, unsigned int in_height, 2073 + unsigned int startRow, unsigned int startCol, char *out, 2074 + unsigned int tileWidth, unsigned int tileHeight, 2075 + unsigned char num_bands) 2076 2076 { 2077 2077 /* signed int8 */ 2078 2078 unsigned int x; 2079 2079 unsigned int y; 2080 2080 unsigned char b; 2081 2081 for (y = 0; y < tileHeight; y++) 2082 2082 { ................................................................................ 2187 2187 for (b = 0; b < num_bands; b++) 2188 2188 *p_out++ = *p_in++; 2189 2189 } 2190 2190 } 2191 2191 } 2192 2192 2193 2193 static void 2194 -copy_tile_raw_i32 (const int *in, unsigned int in_width, 2195 - unsigned int in_height, unsigned int startRow, 2196 - unsigned int startCol, int *out, unsigned int tileWidth, 2197 - unsigned int tileHeight, unsigned char num_bands) 2194 +copy_tile_raw_i32 (const int *in, unsigned int in_width, unsigned int in_height, 2195 + unsigned int startRow, unsigned int startCol, int *out, 2196 + unsigned int tileWidth, unsigned int tileHeight, 2197 + unsigned char num_bands) 2198 2198 { 2199 2199 /* signed int32 */ 2200 2200 unsigned int x; 2201 2201 unsigned int y; 2202 2202 unsigned char b; 2203 2203 for (y = 0; y < tileHeight; y++) 2204 2204 { ................................................................................ 2309 2309 *p_out++ = *p_in++; 2310 2310 } 2311 2311 } 2312 2312 } 2313 2313 2314 2314 static int 2315 2315 build_tile_from_raw_pixels (rl2PrivRasterPtr origin, unsigned int tileWidth, 2316 - unsigned int tileHeight, 2317 - unsigned char sample_type, 2316 + unsigned int tileHeight, unsigned char sample_type, 2318 2317 unsigned char num_bands, unsigned int startRow, 2319 2318 unsigned int startCol, rl2PixelPtr no_data, 2320 2319 unsigned char **pixels, int *pixels_sz) 2321 2320 { 2322 2321 /* extracting a Tile from the RAW buffer */ 2323 2322 unsigned char *out; 2324 2323 int outsz = tileWidth * tileHeight * num_bands; ................................................................................ 2350 2349 case RL2_SAMPLE_INT8: 2351 2350 copy_tile_raw_i8 ((const char *) (origin->rasterBuffer), 2352 2351 origin->width, origin->height, startRow, startCol, 2353 2352 (char *) out, tileWidth, tileHeight, num_bands); 2354 2353 break; 2355 2354 case RL2_SAMPLE_INT16: 2356 2355 copy_tile_raw_i16 ((const short *) (origin->rasterBuffer), 2357 - origin->width, origin->height, startRow, 2358 - startCol, (short *) out, tileWidth, tileHeight, 2359 - num_bands); 2356 + origin->width, origin->height, startRow, startCol, 2357 + (short *) out, tileWidth, tileHeight, num_bands); 2360 2358 break; 2361 2359 case RL2_SAMPLE_UINT16: 2362 2360 copy_tile_raw_u16 ((const unsigned short *) (origin->rasterBuffer), 2363 - origin->width, origin->height, startRow, 2364 - startCol, (unsigned short *) out, tileWidth, 2365 - tileHeight, num_bands); 2361 + origin->width, origin->height, startRow, startCol, 2362 + (unsigned short *) out, tileWidth, tileHeight, 2363 + num_bands); 2366 2364 break; 2367 2365 case RL2_SAMPLE_INT32: 2368 2366 copy_tile_raw_i32 ((const int *) (origin->rasterBuffer), 2369 - origin->width, origin->height, startRow, 2370 - startCol, (int *) out, tileWidth, tileHeight, 2371 - num_bands); 2367 + origin->width, origin->height, startRow, startCol, 2368 + (int *) out, tileWidth, tileHeight, num_bands); 2372 2369 break; 2373 2370 case RL2_SAMPLE_UINT32: 2374 2371 copy_tile_raw_u32 ((const unsigned int *) (origin->rasterBuffer), 2375 - origin->width, origin->height, startRow, 2376 - startCol, (unsigned int *) out, tileWidth, 2377 - tileHeight, num_bands); 2372 + origin->width, origin->height, startRow, startCol, 2373 + (unsigned int *) out, tileWidth, tileHeight, 2374 + num_bands); 2378 2375 break; 2379 2376 case RL2_SAMPLE_FLOAT: 2380 2377 copy_tile_raw_flt ((const float *) (origin->rasterBuffer), 2381 - origin->width, origin->height, startRow, 2382 - startCol, (float *) out, tileWidth, tileHeight, 2383 - num_bands); 2378 + origin->width, origin->height, startRow, startCol, 2379 + (float *) out, tileWidth, tileHeight, num_bands); 2384 2380 break; 2385 2381 case RL2_SAMPLE_DOUBLE: 2386 2382 copy_tile_raw_dbl ((const double *) (origin->rasterBuffer), 2387 - origin->width, origin->height, startRow, 2388 - startCol, (double *) out, tileWidth, tileHeight, 2389 - num_bands); 2383 + origin->width, origin->height, startRow, startCol, 2384 + (double *) out, tileWidth, tileHeight, num_bands); 2390 2385 break; 2391 2386 default: 2392 2387 copy_tile_raw_u8 ((const unsigned char *) (origin->rasterBuffer), 2393 2388 origin->width, origin->height, startRow, startCol, 2394 2389 (unsigned char *) out, tileWidth, tileHeight, 2395 2390 num_bands); 2396 2391 break;
Changes to src/rl2sql.c.
657 657 else 658 658 { 659 659 blob_even = sqlite3_value_blob (argv[3]); 660 660 blob_even_sz = sqlite3_value_bytes (argv[3]); 661 661 } 662 662 663 663 if (!get_coverage_defs 664 - (sqlite, coverage, &tile_width, &tile_height, &sample_type, 665 - &pixel_type, &num_bands, &compression)) 664 + (sqlite, coverage, &tile_width, &tile_height, &sample_type, &pixel_type, 665 + &num_bands, &compression)) 666 666 { 667 667 sqlite3_result_int (context, -1); 668 668 return; 669 669 } 670 670 ret = 671 - rl2_is_valid_dbms_raster_tile (level, tile_width, tile_height, 672 - blob_odd, blob_odd_sz, blob_even, 673 - blob_even_sz, sample_type, pixel_type, 674 - num_bands, compression); 671 + rl2_is_valid_dbms_raster_tile (level, tile_width, tile_height, blob_odd, 672 + blob_odd_sz, blob_even, blob_even_sz, 673 + sample_type, pixel_type, num_bands, 674 + compression); 675 675 if (ret == RL2_OK) 676 676 sqlite3_result_int (context, 1); 677 677 else 678 678 sqlite3_result_int (context, 0); 679 679 } 680 680 681 681 static void ................................................................................ 1533 1533 if (pxl1 != NULL) 1534 1534 rl2_destroy_pixel (pxl1); 1535 1535 if (pxl2 != NULL) 1536 1536 rl2_destroy_pixel (pxl2); 1537 1537 } 1538 1538 1539 1539 static void 1540 -fnct_GetRasterStatistics_NoDataPixelsCount (sqlite3_context * context, 1541 - int argc, sqlite3_value ** argv) 1540 +fnct_GetRasterStatistics_NoDataPixelsCount (sqlite3_context * context, int argc, 1541 + sqlite3_value ** argv) 1542 1542 { 1543 1543 /* SQL function: 1544 1544 / GetRasterStatistics_NoDataPixelsCount(BLOBencoded statistics) 1545 1545 / 1546 1546 / will return the total count of NoData pixels 1547 1547 / or NULL (INVALID ARGS) 1548 1548 / ................................................................................ 1568 1568 } 1569 1569 st = (rl2PrivRasterStatisticsPtr) stats; 1570 1570 sqlite3_result_int64 (context, st->no_data); 1571 1571 rl2_destroy_raster_statistics (stats); 1572 1572 } 1573 1573 1574 1574 static void 1575 -fnct_GetRasterStatistics_ValidPixelsCount (sqlite3_context * context, 1576 - int argc, sqlite3_value ** argv) 1575 +fnct_GetRasterStatistics_ValidPixelsCount (sqlite3_context * context, int argc, 1576 + sqlite3_value ** argv) 1577 1577 { 1578 1578 /* SQL function: 1579 1579 / GetRasterStatistics_ValidPixelsCount(BLOBencoded statistics) 1580 1580 / 1581 1581 / will return the total count of valid pixels 1582 1582 / or NULL (INVALID ARGS) 1583 1583 / ................................................................................ 3883 3883 return; 3884 3884 } 3885 3885 if (rl2_get_coverage_srid (coverage, &srid) != RL2_OK) 3886 3886 { 3887 3887 sqlite3_result_int (context, -1); 3888 3888 return; 3889 3889 } 3890 - if (rl2_get_coverage_type 3891 - (coverage, &sample_type, &pixel_type, &num_bands) != RL2_OK) 3890 + if (rl2_get_coverage_type (coverage, &sample_type, &pixel_type, &num_bands) 3891 + != RL2_OK) 3892 3892 { 3893 3893 sqlite3_result_int (context, -1); 3894 3894 return; 3895 3895 } 3896 3896 no_data = rl2_get_coverage_no_data (coverage); 3897 3897 if (rl2_get_coverage_compression (coverage, &compression, &quality) 3898 3898 != RL2_OK) ................................................................................ 4047 4047 cvg = (rl2PrivCoveragePtr) coverage; 4048 4048 for (y = maxy; y > miny; y -= tileh) 4049 4049 { 4050 4050 for (x = minx; x < maxx; x += tilew) 4051 4051 { 4052 4052 char *err_msg = NULL; 4053 4053 unsigned char *rgba_tile = 4054 - do_wms_GetMap_get (NULL, url, proxy, wms_version, 4055 - wms_layer, 4054 + do_wms_GetMap_get (NULL, url, proxy, wms_version, wms_layer, 4056 4055 wms_crs, swap_xy, x, y - tileh, 4057 4056 x + tilew, y, tile_width, tile_height, 4058 4057 wms_style, wms_format, opaque, 0, 4059 4058 &err_msg); 4060 4059 if (rgba_tile == NULL) 4061 4060 { 4062 4061 add_retry (retry_list, x, y - tileh, x + tilew, y); ................................................................................ 4110 4109 if (retry->done) 4111 4110 { 4112 4111 retry = retry->next; 4113 4112 continue; 4114 4113 } 4115 4114 retry->count += 1; 4116 4115 rgba_tile = 4117 - do_wms_GetMap_get (NULL, url, proxy, wms_version, 4118 - wms_layer, wms_crs, swap_xy, 4119 - retry->minx, retry->miny, retry->maxx, 4120 - retry->maxy, tile_width, tile_height, 4121 - wms_style, wms_format, opaque, 0, 4122 - &err_msg); 4116 + do_wms_GetMap_get (NULL, url, proxy, wms_version, wms_layer, 4117 + wms_crs, swap_xy, retry->minx, 4118 + retry->miny, retry->maxx, retry->maxy, 4119 + tile_width, tile_height, wms_style, 4120 + wms_format, opaque, 0, &err_msg); 4123 4121 if (rgba_tile == NULL) 4124 4122 { 4125 4123 retry = retry->next; 4126 4124 continue; 4127 4125 } 4128 4126 4129 4127 params.sqlite = sqlite; ................................................................................ 4487 4485 double ext_x = (double) width * horz_res; 4488 4486 double ext_y = (double) height * vert_res; 4489 4487 minx = pt_x - ext_x / 2.0; 4490 4488 maxx = minx + ext_x; 4491 4489 miny = pt_y - ext_y / 2.0; 4492 4490 maxy = miny + ext_y; 4493 4491 } 4494 - else if (rl2_parse_bbox 4495 - (sqlite, blob, blob_sz, &minx, &miny, &maxx, &maxy) != RL2_OK) 4492 + else if (rl2_parse_bbox (sqlite, blob, blob_sz, &minx, &miny, &maxx, &maxy) 4493 + != RL2_OK) 4496 4494 { 4497 4495 errcode = -1; 4498 4496 goto error; 4499 4497 } 4500 4498 4501 4499 /* attempting to load the Coverage definitions from the DBMS */ 4502 4500 coverage = rl2_create_coverage_from_dbms (sqlite, cvg_name); ................................................................................ 4517 4515 height, compression, 4518 4516 tile_sz, worldfile); 4519 4517 } 4520 4518 else 4521 4519 { 4522 4520 /* whole Coverage */ 4523 4521 ret = 4524 - rl2_export_geotiff_from_dbms (sqlite, max_threads, path, 4525 - coverage, horz_res, vert_res, 4526 - minx, miny, maxx, maxy, width, 4527 - height, compression, tile_sz, 4528 - worldfile); 4522 + rl2_export_geotiff_from_dbms (sqlite, max_threads, path, coverage, 4523 + horz_res, vert_res, minx, miny, 4524 + maxx, maxy, width, height, 4525 + compression, tile_sz, worldfile); 4529 4526 } 4530 4527 if (ret != RL2_OK) 4531 4528 { 4532 4529 errcode = 0; 4533 4530 goto error; 4534 4531 } 4535 4532 rl2_destroy_coverage (coverage); ................................................................................ 4867 4864 double ext_x = (double) width * horz_res; 4868 4865 double ext_y = (double) height * vert_res; 4869 4866 minx = pt_x - ext_x / 2.0; 4870 4867 maxx = minx + ext_x; 4871 4868 miny = pt_y - ext_y / 2.0; 4872 4869 maxy = miny + ext_y; 4873 4870 } 4874 - else if (rl2_parse_bbox 4875 - (sqlite, blob, blob_sz, &minx, &miny, &maxx, &maxy) != RL2_OK) 4871 + else if (rl2_parse_bbox (sqlite, blob, blob_sz, &minx, &miny, &maxx, &maxy) 4872 + != RL2_OK) 4876 4873 { 4877 4874 errcode = -1; 4878 4875 goto error; 4879 4876 } 4880 4877 4881 4878 /* attempting to load the Coverage definitions from the DBMS */ 4882 4879 coverage = rl2_create_coverage_from_dbms (sqlite, cvg_name); ................................................................................ 4890 4887 { 4891 4888 /* single Section */ 4892 4889 ret = 4893 4890 rl2_export_section_triple_band_geotiff_from_dbms (sqlite, path, 4894 4891 coverage, 4895 4892 section_id, 4896 4893 horz_res, 4897 - vert_res, 4898 - minx, miny, 4899 - maxx, maxy, 4900 - width, height, 4894 + vert_res, minx, 4895 + miny, maxx, 4896 + maxy, width, 4897 + height, 4901 4898 red_band, 4902 4899 green_band, 4903 4900 blue_band, 4904 4901 compression, 4905 4902 tile_sz, 4906 4903 worldfile); 4907 4904 } 4908 4905 else 4909 4906 { 4910 4907 /* whole Coverage */ 4911 4908 4912 4909 ret = 4913 - rl2_export_triple_band_geotiff_from_dbms (sqlite, path, 4914 - coverage, horz_res, 4915 - vert_res, minx, miny, 4916 - maxx, maxy, width, 4917 - height, red_band, 4910 + rl2_export_triple_band_geotiff_from_dbms (sqlite, path, coverage, 4911 + horz_res, vert_res, 4912 + minx, miny, maxx, maxy, 4913 + width, height, red_band, 4918 4914 green_band, blue_band, 4919 4915 compression, tile_sz, 4920 4916 worldfile); 4921 4917 } 4922 4918 if (ret != RL2_OK) 4923 4919 { 4924 4920 errcode = 0; ................................................................................ 5248 5244 double ext_x = (double) width * horz_res; 5249 5245 double ext_y = (double) height * vert_res; 5250 5246 minx = pt_x - ext_x / 2.0; 5251 5247 maxx = minx + ext_x; 5252 5248 miny = pt_y - ext_y / 2.0; 5253 5249 maxy = miny + ext_y; 5254 5250 } 5255 - else if (rl2_parse_bbox 5256 - (sqlite, blob, blob_sz, &minx, &miny, &maxx, &maxy) != RL2_OK) 5251 + else if (rl2_parse_bbox (sqlite, blob, blob_sz, &minx, &miny, &maxx, &maxy) 5252 + != RL2_OK) 5257 5253 { 5258 5254 errcode = -1; 5259 5255 goto error; 5260 5256 } 5261 5257 5262 5258 /* attempting to load the Coverage definitions from the DBMS */ 5263 5259 coverage = rl2_create_coverage_from_dbms (sqlite, cvg_name); ................................................................................ 5272 5268 /* single Section */ 5273 5269 ret = 5274 5270 rl2_export_section_mono_band_geotiff_from_dbms (sqlite, path, 5275 5271 coverage, 5276 5272 section_id, 5277 5273 horz_res, 5278 5274 vert_res, minx, 5279 - miny, maxx, 5280 - maxy, width, 5281 - height, 5275 + miny, maxx, maxy, 5276 + width, height, 5282 5277 mono_band, 5283 5278 compression, 5284 5279 tile_sz, 5285 5280 worldfile); 5286 5281 } 5287 5282 else 5288 5283 { 5289 5284 /* whole Coverage */ 5290 5285 ret = 5291 5286 rl2_export_mono_band_geotiff_from_dbms (sqlite, path, coverage, 5292 - horz_res, vert_res, 5293 - minx, miny, maxx, maxy, 5294 - width, height, 5295 - mono_band, compression, 5296 - tile_sz, worldfile); 5287 + horz_res, vert_res, minx, 5288 + miny, maxx, maxy, width, 5289 + height, mono_band, 5290 + compression, tile_sz, 5291 + worldfile); 5297 5292 } 5298 5293 5299 5294 if (ret != RL2_OK) 5300 5295 { 5301 5296 errcode = 0; 5302 5297 goto error; 5303 5298 } ................................................................................ 5603 5598 double ext_x = (double) width * horz_res; 5604 5599 double ext_y = (double) height * vert_res; 5605 5600 minx = pt_x - ext_x / 2.0; 5606 5601 maxx = minx + ext_x; 5607 5602 miny = pt_y - ext_y / 2.0; 5608 5603 maxy = miny + ext_y; 5609 5604 } 5610 - else if (rl2_parse_bbox 5611 - (sqlite, blob, blob_sz, &minx, &miny, &maxx, &maxy) != RL2_OK) 5605 + else if (rl2_parse_bbox (sqlite, blob, blob_sz, &minx, &miny, &maxx, &maxy) 5606 + != RL2_OK) 5612 5607 { 5613 5608 errcode = -1; 5614 5609 goto error; 5615 5610 } 5616 5611 5617 5612 /* attempting to load the Coverage definitions from the DBMS */ 5618 5613 coverage = rl2_create_coverage_from_dbms (sqlite, cvg_name); ................................................................................ 5626 5621 /* only a single Section */ 5627 5622 if (with_worldfile) 5628 5623 { 5629 5624 /* TIFF + Worldfile */ 5630 5625 ret = 5631 5626 rl2_export_section_tiff_worldfile_from_dbms (sqlite, 5632 5627 max_threads, 5633 - path, 5634 - coverage, 5628 + path, coverage, 5635 5629 section_id, 5636 5630 horz_res, 5637 - vert_res, 5638 - minx, miny, 5639 - maxx, maxy, 5640 - width, 5631 + vert_res, minx, 5632 + miny, maxx, 5633 + maxy, width, 5641 5634 height, 5642 5635 compression, 5643 5636 tile_sz); 5644 5637 } 5645 5638 else 5646 5639 { 5647 5640 /* plain TIFF, no Worldfile */ ................................................................................ 5661 5654 if (with_worldfile) 5662 5655 { 5663 5656 /* TIFF + Worldfile */ 5664 5657 ret = 5665 5658 rl2_export_tiff_worldfile_from_dbms (sqlite, max_threads, 5666 5659 path, coverage, 5667 5660 horz_res, vert_res, 5668 - minx, miny, maxx, 5669 - maxy, width, height, 5661 + minx, miny, maxx, maxy, 5662 + width, height, 5670 5663 compression, tile_sz); 5671 5664 } 5672 5665 else 5673 5666 { 5674 5667 /* plain TIFF, no Worldfile */ 5675 5668 ret = 5676 5669 rl2_export_tiff_from_dbms (sqlite, max_threads, path, ................................................................................ 5976 5969 double ext_x = (double) width * horz_res; 5977 5970 double ext_y = (double) height * vert_res; 5978 5971 minx = pt_x - ext_x / 2.0; 5979 5972 maxx = minx + ext_x; 5980 5973 miny = pt_y - ext_y / 2.0; 5981 5974 maxy = miny + ext_y; 5982 5975 } 5983 - else if (rl2_parse_bbox 5984 - (sqlite, blob, blob_sz, &minx, &miny, &maxx, &maxy) != RL2_OK) 5976 + else if (rl2_parse_bbox (sqlite, blob, blob_sz, &minx, &miny, &maxx, &maxy) 5977 + != RL2_OK) 5985 5978 { 5986 5979 errcode = -1; 5987 5980 goto error; 5988 5981 } 5989 5982 5990 5983 /* attempting to load the Coverage definitions from the DBMS */ 5991 5984 coverage = rl2_create_coverage_from_dbms (sqlite, cvg_name); ................................................................................ 5996 5989 } 5997 5990 5998 5991 if (by_section) 5999 5992 { 6000 5993 /* single Section */ 6001 5994 ret = 6002 5995 rl2_export_section_jpeg_from_dbms (sqlite, max_threads, path, 6003 - coverage, section_id, 6004 - horz_res, vert_res, minx, 6005 - miny, maxx, maxy, width, 6006 - height, quality, 5996 + coverage, section_id, horz_res, 5997 + vert_res, minx, miny, maxx, 5998 + maxy, width, height, quality, 6007 5999 with_worldfile); 6008 6000 } 6009 6001 else 6010 6002 { 6011 6003 /* whole Coverage */ 6012 6004 ret = 6013 6005 rl2_export_jpeg_from_dbms (sqlite, max_threads, path, coverage, ................................................................................ 6374 6366 double ext_x = (double) width * horz_res; 6375 6367 double ext_y = (double) height * vert_res; 6376 6368 minx = pt_x - ext_x / 2.0; 6377 6369 maxx = minx + ext_x; 6378 6370 miny = pt_y - ext_y / 2.0; 6379 6371 maxy = miny + ext_y; 6380 6372 } 6381 - else if (rl2_parse_bbox 6382 - (sqlite, blob, blob_sz, &minx, &miny, &maxx, &maxy) != RL2_OK) 6373 + else if (rl2_parse_bbox (sqlite, blob, blob_sz, &minx, &miny, &maxx, &maxy) 6374 + != RL2_OK) 6383 6375 { 6384 6376 errcode = -1; 6385 6377 goto error; 6386 6378 } 6387 6379 6388 6380 /* attempting to load the Coverage definitions from the DBMS */ 6389 6381 coverage = rl2_create_coverage_from_dbms (sqlite, cvg_name); ................................................................................ 6405 6397 minx, miny, maxx, maxy, width, height, red_band, 6406 6398 green_band, blue_band, compression, tile_sz); 6407 6399 } 6408 6400 else 6409 6401 { 6410 6402 /* plain TIFF, no Worldfile */ 6411 6403 ret = 6412 - rl2_export_section_triple_band_tiff_from_dbms (sqlite, 6413 - path, 6404 + rl2_export_section_triple_band_tiff_from_dbms (sqlite, path, 6414 6405 coverage, 6415 6406 section_id, 6416 6407 horz_res, 6417 6408 vert_res, 6418 6409 minx, miny, 6419 6410 maxx, maxy, 6420 6411 width, ................................................................................ 6434 6425 /* TIFF + Worldfile */ 6435 6426 ret = 6436 6427 rl2_export_triple_band_tiff_worldfile_from_dbms (sqlite, 6437 6428 path, 6438 6429 coverage, 6439 6430 horz_res, 6440 6431 vert_res, 6441 - minx, 6442 - miny, 6443 - maxx, 6444 - maxy, 6432 + minx, miny, 6433 + maxx, maxy, 6445 6434 width, 6446 6435 height, 6447 6436 red_band, 6448 6437 green_band, 6449 6438 blue_band, 6450 6439 compression, 6451 6440 tile_sz); ................................................................................ 6452 6441 } 6453 6442 else 6454 6443 { 6455 6444 /* plain TIFF, no Worldfile */ 6456 6445 ret = 6457 6446 rl2_export_triple_band_tiff_from_dbms (sqlite, path, 6458 6447 coverage, horz_res, 6459 - vert_res, minx, 6460 - miny, maxx, maxy, 6461 - width, height, 6462 - red_band, 6448 + vert_res, minx, miny, 6449 + maxx, maxy, width, 6450 + height, red_band, 6463 6451 green_band, 6464 6452 blue_band, 6465 6453 compression, 6466 6454 tile_sz); 6467 6455 } 6468 6456 } 6469 6457 if (ret != RL2_OK) ................................................................................ 6827 6815 double ext_x = (double) width * horz_res; 6828 6816 double ext_y = (double) height * vert_res; 6829 6817 minx = pt_x - ext_x / 2.0; 6830 6818 maxx = minx + ext_x; 6831 6819 miny = pt_y - ext_y / 2.0; 6832 6820 maxy = miny + ext_y; 6833 6821 } 6834 - else if (rl2_parse_bbox 6835 - (sqlite, blob, blob_sz, &minx, &miny, &maxx, &maxy) != RL2_OK) 6822 + else if (rl2_parse_bbox (sqlite, blob, blob_sz, &minx, &miny, &maxx, &maxy) 6823 + != RL2_OK) 6836 6824 { 6837 6825 errcode = -1; 6838 6826 goto error; 6839 6827 } 6840 6828 6841 6829 /* attempting to load the Coverage definitions from the DBMS */ 6842 6830 coverage = rl2_create_coverage_from_dbms (sqlite, cvg_name); ................................................................................ 6862 6850 { 6863 6851 /* plain TIFF, no Worldfile */ 6864 6852 ret = 6865 6853 rl2_export_section_mono_band_tiff_from_dbms (sqlite, path, 6866 6854 coverage, 6867 6855 section_id, 6868 6856 horz_res, 6869 - vert_res, 6870 - minx, miny, 6871 - maxx, maxy, 6872 - width, 6857 + vert_res, minx, 6858 + miny, maxx, 6859 + maxy, width, 6873 6860 height, 6874 6861 mono_band, 6875 6862 compression, 6876 6863 tile_sz); 6877 6864 } 6878 6865 } 6879 6866 else 6880 6867 { 6881 6868 /* whole Coverage */ 6882 6869 if (with_worldfile) 6883 6870 { 6884 6871 /* TIFF + Worldfile */ 6885 6872 ret = 6886 - rl2_export_mono_band_tiff_worldfile_from_dbms (sqlite, 6887 - path, 6873 + rl2_export_mono_band_tiff_worldfile_from_dbms (sqlite, path, 6888 6874 coverage, 6889 6875 horz_res, 6890 6876 vert_res, 6891 6877 minx, miny, 6892 6878 maxx, maxy, 6893 6879 width, 6894 6880 height, ................................................................................ 6896 6882 compression, 6897 6883 tile_sz); 6898 6884 } 6899 6885 else 6900 6886 { 6901 6887 /* plain TIFF, no Worldfile */ 6902 6888 ret = 6903 - rl2_export_mono_band_tiff_from_dbms (sqlite, path, 6904 - coverage, horz_res, 6905 - vert_res, minx, miny, 6906 - maxx, maxy, width, 6907 - height, mono_band, 6908 - compression, tile_sz); 6889 + rl2_export_mono_band_tiff_from_dbms (sqlite, path, coverage, 6890 + horz_res, vert_res, 6891 + minx, miny, maxx, maxy, 6892 + width, height, 6893 + mono_band, compression, 6894 + tile_sz); 6909 6895 } 6910 6896 } 6911 6897 if (ret != RL2_OK) 6912 6898 { 6913 6899 errcode = 0; 6914 6900 goto error; 6915 6901 } ................................................................................ 7202 7188 double ext_x = (double) width * resolution; 7203 7189 double ext_y = (double) height * resolution; 7204 7190 minx = pt_x - ext_x / 2.0; 7205 7191 maxx = minx + ext_x; 7206 7192 miny = pt_y - ext_y / 2.0; 7207 7193 maxy = miny + ext_y; 7208 7194 } 7209 - else if (rl2_parse_bbox 7210 - (sqlite, blob, blob_sz, &minx, &miny, &maxx, &maxy) != RL2_OK) 7195 + else if (rl2_parse_bbox (sqlite, blob, blob_sz, &minx, &miny, &maxx, &maxy) 7196 + != RL2_OK) 7211 7197 { 7212 7198 errcode = -1; 7213 7199 goto error; 7214 7200 } 7215 7201 7216 7202 /* attempting to load the Coverage definitions from the DBMS */ 7217 7203 coverage = rl2_create_coverage_from_dbms (sqlite, cvg_name); ................................................................................ 7234 7220 decimal_digits); 7235 7221 } 7236 7222 else 7237 7223 { 7238 7224 /* whole Coverage */ 7239 7225 ret = 7240 7226 rl2_export_ascii_grid_from_dbms (sqlite, max_threads, path, 7241 - coverage, resolution, minx, 7242 - miny, maxx, maxy, width, 7243 - height, is_centered, 7244 - decimal_digits); 7227 + coverage, resolution, minx, miny, 7228 + maxx, maxy, width, height, 7229 + is_centered, decimal_digits); 7245 7230 } 7246 7231 if (ret != RL2_OK) 7247 7232 { 7248 7233 errcode = 0; 7249 7234 goto error; 7250 7235 } 7251 7236 rl2_destroy_coverage (coverage); ................................................................................ 7492 7477 double ext_x = (double) width * resolution; 7493 7478 double ext_y = (double) height * resolution; 7494 7479 minx = pt_x - ext_x / 2.0; 7495 7480 maxx = minx + ext_x; 7496 7481 miny = pt_y - ext_y / 2.0; 7497 7482 maxy = miny + ext_y; 7498 7483 } 7499 - else if (rl2_parse_bbox 7500 - (sqlite, blob, blob_sz, &minx, &miny, &maxx, &maxy) != RL2_OK) 7484 + else if (rl2_parse_bbox (sqlite, blob, blob_sz, &minx, &miny, &maxx, &maxy) 7485 + != RL2_OK) 7501 7486 { 7502 7487 errcode = -1; 7503 7488 goto error; 7504 7489 } 7505 7490 7506 7491 /* attempting to load the Coverage definitions from the DBMS */ 7507 7492 coverage = rl2_create_coverage_from_dbms (sqlite, cvg_name); ................................................................................ 7511 7496 return; 7512 7497 } 7513 7498 7514 7499 if (by_section) 7515 7500 { 7516 7501 /* single Section */ 7517 7502 ret = 7518 - rl2_export_section_ndvi_ascii_grid_from_dbms (sqlite, 7519 - max_threads, path, 7520 - coverage, 7503 + rl2_export_section_ndvi_ascii_grid_from_dbms (sqlite, max_threads, 7504 + path, coverage, 7521 7505 section_id, 7522 7506 resolution, minx, 7523 7507 miny, maxx, maxy, 7524 7508 width, height, 7525 - red_band, 7526 - nir_band, 7509 + red_band, nir_band, 7527 7510 is_centered, 7528 7511 decimal_digits); 7529 7512 } 7530 7513 else 7531 7514 { 7532 7515 /* whole Coverage */ 7533 7516 ret = 7534 7517 rl2_export_ndvi_ascii_grid_from_dbms (sqlite, max_threads, path, 7535 - coverage, resolution, 7536 - minx, miny, maxx, maxy, 7537 - width, height, red_band, 7538 - nir_band, is_centered, 7518 + coverage, resolution, minx, 7519 + miny, maxx, maxy, width, 7520 + height, red_band, nir_band, 7521 + is_centered, 7539 7522 decimal_digits); 7540 7523 } 7541 7524 if (ret != RL2_OK) 7542 7525 { 7543 7526 errcode = 0; 7544 7527 goto error; 7545 7528 } ................................................................................ 7597 7580 / will return 1 (TRUE, success) or 0 (FALSE, failure) 7598 7581 / or -1 (INVALID ARGS) 7599 7582 / 7600 7583 */ 7601 7584 common_write_ndvi_ascii_grid (1, context, argc, argv); 7602 7585 } 7603 7586 7604 -static int 7605 -test_geographic_srid (sqlite3 * handle, int srid) 7606 -{ 7607 -/* testing if some SRID is of the Geographic type */ 7608 - int ret; 7609 - int is_geographic = 0; 7610 - sqlite3_stmt *stmt = NULL; 7611 - const char *sql; 7612 - 7613 - sql = "SELECT SridIsGeographic(?)"; 7614 - ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); 7615 - if (ret != SQLITE_OK) 7616 - return 0; 7617 - 7618 - sqlite3_reset (stmt); 7619 - sqlite3_clear_bindings (stmt); 7620 - sqlite3_bind_int (stmt, 1, srid); 7621 - while (1) 7622 - { 7623 - /* scrolling the result set rows */ 7624 - ret = sqlite3_step (stmt); 7625 - if (ret == SQLITE_DONE) 7626 - break; /* end of result set */ 7627 - if (ret == SQLITE_ROW) 7628 - is_geographic = sqlite3_column_int (stmt, 0); 7629 - } 7630 - sqlite3_finalize (stmt); 7631 - return is_geographic; 7632 -} 7633 - 7634 -static double 7635 -standard_scale (sqlite3 * handle, int srid, int width, int height, 7636 - double ext_x, double ext_y) 7637 -{ 7638 -/* computing the standard (normalized) scale */ 7639 - double linear_res; 7640 - double factor; 7641 - int is_geographic = test_geographic_srid (handle, srid); 7642 - if (is_geographic) 7643 - { 7644 - /* geographic (long/lat) CRS */ 7645 - double metres = ext_x * (6378137.0 * 2.0 * 3.141592653589793) / 360.0; 7646 - linear_res = metres / (double) width; 7647 - } 7648 - else 7649 - { 7650 - /* planar (projected) CRS */ 7651 - double x_res = ext_x / (double) width; 7652 - double y_res = ext_y / (double) height; 7653 - linear_res = sqrt (x_res * y_res); 7654 - } 7655 - factor = linear_res / 0.000254; 7656 - return factor * (0.28 / 0.254); 7657 -} 7658 - 7659 7587 static void 7660 7588 fnct_GetMapImageFromRaster (sqlite3_context * context, int argc, 7661 7589 sqlite3_value ** argv) 7662 7590 { 7663 7591 /* SQL function: 7664 7592 / GetMapImageFromRaster(text coverage, BLOB geom, int width, int height) 7665 7593 / GetMapImageFromRaster(text coverage, BLOB geom, int width, int height, ................................................................................ 7713 7641 double ext_y; 7714 7642 double x_res; 7715 7643 double y_res; 7716 7644 int srid; 7717 7645 int level_id; 7718 7646 int scale; 7719 7647 int xscale; 7720 - double map_scale; 7721 7648 double xx_res; 7722 7649 double yy_res; 7723 7650 double aspect_org; 7724 7651 double aspect_dst; 7725 7652 int ok_style; 7726 7653 int ok_format; 7727 7654 unsigned char *outbuf = NULL; ................................................................................ 7863 7790 aux.reaspect = reaspect; 7864 7791 rl2_aux_group_renderer (&aux); 7865 7792 return; 7866 7793 } 7867 7794 7868 7795 x_res = ext_x / (double) width; 7869 7796 y_res = ext_y / (double) height; 7870 - map_scale = standard_scale (sqlite, out_srid, width, height, ext_x, ext_y); 7871 7797 /* validating the style */ 7872 7798 ok_style = 0; 7873 7799 if (strcasecmp (style, "default") == 0) 7874 7800 ok_style = 1; 7875 7801 else 7876 7802 { 7877 7803 /* attempting to get a Coverage Style */ 7878 7804 cvg_stl = 7879 7805 rl2_create_coverage_style_from_dbms (sqlite, cvg_name, style); 7880 7806 if (cvg_stl == NULL) 7881 7807 goto error; 7882 - symbolizer = 7883 - rl2_get_symbolizer_from_coverage_style (cvg_stl, map_scale); 7808 + symbolizer = rl2_get_symbolizer_from_coverage_style (cvg_stl, 1.0); 7884 7809 if (symbolizer == NULL) 7885 - { 7886 - /* invisible at the currect scale */ 7887 - if (!rl2_aux_default_image 7888 - (width, height, bg_red, bg_green, bg_blue, format_id, 7889 - transparent, quality, &image, &image_size)) 7890 - goto error; 7891 - goto done; 7892 - } 7810 + goto error; 7893 7811 stats = rl2_create_raster_statistics_from_dbms (sqlite, cvg_name); 7894 7812 if (stats == NULL) 7895 7813 goto error; 7896 7814 ok_style = 1; 7897 7815 } 7898 7816 if (!ok_style) 7899 7817 goto error; ................................................................................ 8058 7976 } 8059 7977 else 8060 7978 { 8061 7979 /* ordinary Coverage */ 8062 7980 by_section = 0; 8063 7981 /* retrieving the optimal resolution level */ 8064 7982 if (!rl2_find_best_resolution_level 8065 - (sqlite, cvg_name, 0, 0, x_res, y_res, &level_id, &scale, 8066 - &xscale, &xx_res, &yy_res)) 7983 + (sqlite, cvg_name, 0, 0, x_res, y_res, &level_id, &scale, &xscale, 7984 + &xx_res, &yy_res)) 8067 7985 goto error; 8068 7986 } 8069 7987 base_width = (int) (ext_x / xx_res); 8070 7988 base_height = (int) (ext_y / yy_res); 8071 7989 if ((base_width <= 0 && base_width >= USHRT_MAX) 8072 7990 || (base_height <= 0 && base_height >= USHRT_MAX)) 8073 7991 goto error; ................................................................................ 8178 8096 aux.symbolizer = symbolizer; 8179 8097 aux.stats = stats; 8180 8098 aux.outbuf = outbuf; 8181 8099 aux.palette = palette; 8182 8100 aux.out_pixel = out_pixel; 8183 8101 if (!rl2_aux_render_image (&aux, &image, &image_size)) 8184 8102 goto error; 8185 - 8186 - done: 8187 8103 sqlite3_result_blob (context, image, image_size, free); 8188 8104 rl2_destroy_coverage (coverage); 8189 8105 if (palette != NULL) 8190 8106 rl2_destroy_palette (palette); 8191 8107 if (cvg_stl != NULL) 8192 8108 rl2_destroy_coverage_style (cvg_stl); 8193 8109 if (stats != NULL) ................................................................................ 8201 8117 rl2_destroy_palette (palette); 8202 8118 if (cvg_stl != NULL) 8203 8119 rl2_destroy_coverage_style (cvg_stl); 8204 8120 if (stats != NULL) 8205 8121 rl2_destroy_raster_statistics (stats); 8206 8122 sqlite3_result_null (context); 8207 8123 } 8124 + 8125 +static int 8126 +test_geographic_srid (sqlite3 * handle, int srid) 8127 +{ 8128 +/* testing if some SRID is of the Geographic type */ 8129 + int ret; 8130 + int is_geographic = 0; 8131 + sqlite3_stmt *stmt = NULL; 8132 + const char *sql; 8133 + 8134 + sql = "SELECT SridIsGeographic(?)"; 8135 + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); 8136 + if (ret != SQLITE_OK) 8137 + return 0; 8138 + 8139 + sqlite3_reset (stmt); 8140 + sqlite3_clear_bindings (stmt); 8141 + sqlite3_bind_int (stmt, 1, srid); 8142 + while (1) 8143 + { 8144 + /* scrolling the result set rows */ 8145 + ret = sqlite3_step (stmt); 8146 + if (ret == SQLITE_DONE) 8147 + break; /* end of result set */ 8148 + if (ret == SQLITE_ROW) 8149 + is_geographic = sqlite3_column_int (stmt, 0); 8150 + } 8151 + sqlite3_finalize (stmt); 8152 + return is_geographic; 8153 +} 8154 + 8155 +static double 8156 +standard_scale (sqlite3 * handle, int srid, int width, int height, double ext_x, 8157 + double ext_y) 8158 +{ 8159 +/* computing the standard (normalized) scale */ 8160 + double linear_res; 8161 + double factor; 8162 + int is_geographic = test_geographic_srid (handle, srid); 8163 + if (is_geographic) 8164 + { 8165 + /* geographic (long/lat) CRS */ 8166 + double metres = ext_x * (6378137.0 * 2.0 * 3.141592653589793) / 360.0; 8167 + linear_res = metres / (double) width; 8168 + } 8169 + else 8170 + { 8171 + /* planar (projected) CRS */ 8172 + double x_res = ext_x / (double) width; 8173 + double y_res = ext_y / (double) height; 8174 + linear_res = sqrt (x_res * y_res); 8175 + } 8176 + factor = linear_res / 0.000254; 8177 + return factor * (0.28 / 0.254); 8178 +} 8208 8179 8209 8180 static void 8210 8181 fnct_GetMapImageFromVector (sqlite3_context * context, int argc, 8211 8182 sqlite3_value ** argv) 8212 8183 { 8213 8184 /* SQL function: 8214 8185 / GetMapImageFromVector(text coverage, BLOB geom, int width, int height) ................................................................................ 8248 8219 unsigned char bg_green; 8249 8220 unsigned char bg_blue; 8250 8221 int transparent = 0; 8251 8222 int quality = 80; 8252 8223 int reaspect = 0; 8253 8224 sqlite3 *sqlite; 8254 8225 sqlite3_stmt *stmt = NULL; 8255 - const void *data; 8256 8226 double minx; 8257 8227 double maxx; 8258 8228 double miny; 8259 8229 double maxy; 8260 8230 double ext_x; 8261 8231 double ext_y; 8262 8232 double x_res; ................................................................................ 8330 8300 if (argc > 8) 8331 8301 quality = sqlite3_value_int (argv[8]); 8332 8302 if (argc > 9) 8333 8303 reaspect = sqlite3_value_int (argv[9]); 8334 8304 8335 8305 /* coarse args validation */ 8336 8306 sqlite = sqlite3_context_db_handle (context); 8337 - data = sqlite3_user_data (context); 8338 8307 if (width < 64) 8339 8308 goto error; 8340 8309 if (height < 64) 8341 8310 goto error; 8342 8311 /* validating the format */ 8343 8312 ok_format = 0; 8344 8313 if (strcmp (format, "image/png") == 0) ................................................................................ 8532 8501 { 8533 8502 case SQLITE_INTEGER: 8534 8503 rl2_set_variant_int (variant, i, col_name, 8535 8504 sqlite3_column_int64 8536 8505 (stmt, i + 1)); 8537 8506 break; 8538 8507 case SQLITE_FLOAT: 8539 - rl2_set_variant_double (variant, i, 8540 - col_name, 8508 + rl2_set_variant_double (variant, i, col_name, 8541 8509 sqlite3_column_double 8542 8510 (stmt, i + 1)); 8543 8511 break; 8544 8512 case SQLITE_TEXT: 8545 8513 rl2_set_variant_text (variant, i, col_name, 8546 8514 (const char *) 8547 8515 sqlite3_column_text ................................................................................ 8561 8529 break; 8562 8530 }; 8563 8531 } 8564 8532 } 8565 8533 if (geom != NULL) 8566 8534 { 8567 8535 /* drawing a styled Feature */ 8568 - int scale_forbidden = 0; 8536 + int scale_forbidden; 8569 8537 symbolizer = NULL; 8570 8538 if (lyr_stl != NULL) 8571 8539 symbolizer = 8572 8540 rl2_get_symbolizer_from_feature_type_style 8573 8541 (lyr_stl, scale, variant, &scale_forbidden); 8574 8542 if (!scale_forbidden) 8575 - rl2_draw_vector_feature (ctx, sqlite, data, 8576 - symbolizer, height, minx, 8577 - miny, maxx, maxy, x_res, 8543 + rl2_draw_vector_feature (ctx, sqlite, symbolizer, 8544 + height, minx, miny, x_res, 8578 8545 y_res, geom, variant); 8579 8546 rl2_destroy_geometry (geom); 8580 8547 } 8581 8548 } 8582 8549 } 8583 8550 sqlite3_finalize (stmt); 8584 8551 ................................................................................ 8838 8805 *p_rgba++ = 0; /* transparent */ 8839 8806 } 8840 8807 } 8841 8808 switch (pixel_type) 8842 8809 { 8843 8810 case RL2_PIXEL_MONOCHROME: 8844 8811 ret = 8845 - get_rgba_from_monochrome_mask (width, height, 8846 - buffer, mask, 8847 - no_data, rgba); 8812 + get_rgba_from_monochrome_mask (width, height, buffer, 8813 + mask, no_data, rgba); 8848 8814 buffer = NULL; 8849 8815 mask = NULL; 8850 8816 if (!ret) 8851 8817 goto error; 8852 8818 if (!build_rgb_alpha 8853 - (width, height, rgba, &rgb, &alpha, bg_red, 8854 - bg_green, bg_blue)) 8819 + (width, height, rgba, &rgb, &alpha, bg_red, bg_green, 8820 + bg_blue)) 8855 8821 goto error; 8856 8822 free (rgba); 8857 8823 rgba = NULL; 8858 8824 if (transparent) 8859 8825 { 8860 8826 if (!get_payload_from_gray_rgba_transparent 8861 8827 (width, height, rgb, alpha, ................................................................................ 8881 8847 mask, palette, no_data, 8882 8848 rgba); 8883 8849 buffer = NULL; 8884 8850 mask = NULL; 8885 8851 if (!ret) 8886 8852 goto error; 8887 8853 if (!build_rgb_alpha 8888 - (width, height, rgba, &rgb, &alpha, bg_red, 8889 - bg_green, bg_blue)) 8854 + (width, height, rgba, &rgb, &alpha, bg_red, bg_green, 8855 + bg_blue)) 8890 8856 goto error; 8891 8857 free (rgba); 8892 8858 rgba = NULL; 8893 8859 if (transparent) 8894 8860 { 8895 8861 if (!get_payload_from_rgb_rgba_transparent 8896 8862 (width, height, rgb, alpha, ................................................................................ 8915 8881 get_rgba_from_grayscale_mask (width, height, buffer, 8916 8882 mask, no_data, rgba); 8917 8883 buffer = NULL; 8918 8884 mask = NULL; 8919 8885 if (!ret) 8920 8886 goto error; 8921 8887 if (!build_rgb_alpha 8922 - (width, height, rgba, &rgb, &alpha, bg_red, 8923 - bg_green, bg_blue)) 8888 + (width, height, rgba, &rgb, &alpha, bg_red, bg_green, 8889 + bg_blue)) 8924 8890 goto error; 8925 8891 free (rgba); 8926 8892 rgba = NULL; 8927 8893 if (transparent) 8928 8894 { 8929 8895 if (!get_payload_from_gray_rgba_transparent 8930 8896 (width, height, rgb, alpha, ................................................................................ 8950 8916 sample_type, buffer, 8951 8917 mask, no_data, rgba); 8952 8918 buffer = NULL; 8953 8919 mask = NULL; 8954 8920 if (!ret) 8955 8921 goto error; 8956 8922 if (!build_rgb_alpha 8957 - (width, height, rgba, &rgb, &alpha, bg_red, 8958 - bg_green, bg_blue)) 8923 + (width, height, rgba, &rgb, &alpha, bg_red, bg_green, 8924 + bg_blue)) 8959 8925 goto error; 8960 8926 free (rgba); 8961 8927 rgba = NULL; 8962 8928 if (transparent) 8963 8929 { 8964 8930 if (!get_payload_from_gray_rgba_transparent 8965 8931 (width, height, rgb, alpha, ................................................................................ 8979 8945 } 8980 8946 sqlite3_result_blob (context, image, image_size, free); 8981 8947 break; 8982 8948 case RL2_PIXEL_RGB: 8983 8949 if (sample_type == RL2_SAMPLE_UINT16) 8984 8950 { 8985 8951 ret = 8986 - get_rgba_from_multiband16 (width, height, 0, 8987 - 1, 2, 3, 8952 + get_rgba_from_multiband16 (width, height, 0, 1, 8953 + 2, 3, 8988 8954 (unsigned short *) 8989 8955 buffer, mask, 8990 8956 no_data, rgba); 8991 8957 } 8992 8958 else 8993 8959 { 8994 8960 ret = ................................................................................ 8996 8962 mask, no_data, rgba); 8997 8963 } 8998 8964 buffer = NULL; 8999 8965 mask = NULL; 9000 8966 if (!ret) 9001 8967 goto error; 9002 8968 if (!build_rgb_alpha 9003 - (width, height, rgba, &rgb, &alpha, bg_red, 9004 - bg_green, bg_blue)) 8969 + (width, height, rgba, &rgb, &alpha, bg_red, bg_green, 8970 + bg_blue)) 9005 8971 goto error; 9006 8972 free (rgba); 9007 8973 rgba = NULL; 9008 8974 if (transparent) 9009 8975 { 9010 8976 if (!get_payload_from_rgb_rgba_transparent 9011 8977 (width, height, rgb, alpha, ................................................................................ 9024 8990 goto error; 9025 8991 } 9026 8992 sqlite3_result_blob (context, image, image_size, free); 9027 8993 break; 9028 8994 case RL2_PIXEL_MULTIBAND: 9029 8995 ret = 9030 8996 get_rgba_from_multiband_mask (width, height, 9031 - sample_type, 9032 - num_bands, buffer, 9033 - mask, no_data, rgba); 8997 + sample_type, num_bands, 8998 + buffer, mask, no_data, 8999 + rgba); 9034 9000 buffer = NULL; 9035 9001 mask = NULL; 9036 9002 if (!ret) 9037 9003 goto error; 9038 9004 if (!build_rgb_alpha 9039 - (width, height, rgba, &rgb, &alpha, bg_red, 9040 - bg_green, bg_blue)) 9005 + (width, height, rgba, &rgb, &alpha, bg_red, bg_green, 9006 + bg_blue)) 9041 9007 goto error; 9042 9008 free (rgba); 9043 9009 rgba = NULL; 9044 9010 if (transparent) 9045 9011 { 9046 9012 if (!get_payload_from_gray_rgba_transparent 9047 9013 (width, height, rgb, alpha, ................................................................................ 9272 9238 num_bands, buffer, mask, 9273 9239 no_data, rgba); 9274 9240 buffer = NULL; 9275 9241 mask = NULL; 9276 9242 if (!ret) 9277 9243 goto error; 9278 9244 if (!build_rgb_alpha 9279 - (width, height, rgba, &rgb, &alpha, bg_red, 9280 - bg_green, bg_blue)) 9245 + (width, height, rgba, &rgb, &alpha, bg_red, bg_green, 9246 + bg_blue)) 9281 9247 goto error; 9282 9248 free (rgba); 9283 9249 rgba = NULL; 9284 9250 if (transparent) 9285 9251 { 9286 9252 if (!get_payload_from_rgb_rgba_transparent 9287 9253 (width, height, rgb, alpha, ................................................................................ 9302 9268 sqlite3_result_blob (context, image, image_size, free); 9303 9269 break; 9304 9270 case RL2_SAMPLE_UINT16: 9305 9271 ret = 9306 9272 get_rgba_from_multiband16 (width, height, red_band, 9307 9273 green_band, blue_band, 9308 9274 num_bands, 9309 - (unsigned short *) 9310 - buffer, mask, no_data, 9311 - rgba); 9275 + (unsigned short *) buffer, 9276 + mask, no_data, rgba); 9312 9277 if (!build_rgb_alpha 9313 - (width, height, rgba, &rgb, &alpha, bg_red, 9314 - bg_green, bg_blue)) 9278 + (width, height, rgba, &rgb, &alpha, bg_red, bg_green, 9279 + bg_blue)) 9315 9280 goto error; 9316 9281 free (rgba); 9317 9282 rgba = NULL; 9318 9283 if (transparent) 9319 9284 { 9320 9285 if (!get_payload_from_rgb_rgba_transparent 9321 9286 (width, height, rgb, alpha, ................................................................................ 9696 9661 double ext_x = (double) width * horz_res; 9697 9662 double ext_y = (double) height * vert_res; 9698 9663 minx = pt_x - ext_x / 2.0; 9699 9664 maxx = minx + ext_x; 9700 9665 miny = pt_y - ext_y / 2.0; 9701 9666 maxy = miny + ext_y; 9702 9667 } 9703 - else if (rl2_parse_bbox 9704 - (sqlite, blob, blob_sz, &minx, &miny, &maxx, &maxy) != RL2_OK) 9668 + else if (rl2_parse_bbox (sqlite, blob, blob_sz, &minx, &miny, &maxx, &maxy) 9669 + != RL2_OK) 9705 9670 goto error; 9706 9671 9707 9672 /* attempting to load the Coverage definitions from the DBMS */ 9708 9673 coverage = rl2_create_coverage_from_dbms (sqlite, cvg_name); 9709 9674 if (coverage == NULL) 9710 9675 goto error; 9711 9676 if (by_section) 9712 9677 { 9713 9678 /* only a single Section */ 9714 9679 ret = 9715 9680 rl2_export_section_raw_pixels_from_dbms (sqlite, max_threads, 9716 9681 coverage, section_id, 9717 - horz_res, vert_res, 9718 - minx, miny, maxx, maxy, 9719 - width, height, 9720 - big_endian, &xblob, 9721 - &xblob_sz); 9682 + horz_res, vert_res, minx, 9683 + miny, maxx, maxy, width, 9684 + height, big_endian, 9685 + &xblob, &xblob_sz); 9722 9686 } 9723 9687 else 9724 9688 { 9725 9689 /* whole Coverage */ 9726 9690 ret = 9727 9691 rl2_export_raw_pixels_from_dbms (sqlite, max_threads, coverage, 9728 9692 horz_res, vert_res, minx, miny, ................................................................................ 9914 9878 if (rl2_parse_bbox_srid 9915 9879 (sqlite, blob, blob_sz, &srid, &minx, &miny, &maxx, &maxy) != RL2_OK) 9916 9880 { 9917 9881 errcode = -1; 9918 9882 goto error; 9919 9883 } 9920 9884 9921 - if (rl2_get_coverage_type 9922 - (coverage, &sample_type, &pixel_type, &num_bands) != RL2_OK) 9885 + if (rl2_get_coverage_type (coverage, &sample_type, &pixel_type, &num_bands) 9886 + != RL2_OK) 9923 9887 { 9924 9888 errcode = -1; 9925 9889 goto error; 9926 9890 } 9927 9891 if (rl2_get_coverage_srid (coverage, &cov_srid) != RL2_OK) 9928 9892 { 9929 9893 errcode = -1; ................................................................................ 9983 9947 no_data = NULL; 9984 9948 if (raster == NULL) 9985 9949 { 9986 9950 errcode = -1; 9987 9951 goto error; 9988 9952 } 9989 9953 /* georeferencing the raster */ 9990 - if (rl2_raster_georeference_frame (raster, srid, minx, miny, maxx, maxy) 9991 - != RL2_OK) 9954 + if (rl2_raster_georeference_frame (raster, srid, minx, miny, maxx, maxy) != 9955 + RL2_OK) 9992 9956 { 9993 9957 errcode = -1; 9994 9958 goto error; 9995 9959 } 9996 9960 9997 9961 /* attempting to load the Raster into the DBMS */ 9998 9962 if (transaction) ................................................................................ 10003 9967 { 10004 9968 rl2_destroy_coverage (coverage); 10005 9969 sqlite3_result_int (context, -1); 10006 9970 return; 10007 9971 } 10008 9972 } 10009 9973 ret = 10010 - rl2_load_raw_raster_into_dbms (sqlite, max_threads, coverage, 10011 - sctn_name, raster, pyramidize); 9974 + rl2_load_raw_raster_into_dbms (sqlite, max_threads, coverage, sctn_name, 9975 + raster, pyramidize); 10012 9976 rl2_destroy_coverage (coverage); 10013 9977 rl2_destroy_raster (raster); 10014 9978 if (ret != RL2_OK) 10015 9979 { 10016 9980 if (transaction) 10017 9981 { 10018 9982 /* invalidating the pending transaction */ ................................................................................ 10173 10137 SQLITE_UTF8, 0, fnct_DropRasterCoverage, 0, 0); 10174 10138 sqlite3_create_function (db, "DropRasterCoverage", 2, 10175 10139 SQLITE_UTF8, 0, fnct_DropRasterCoverage, 0, 0); 10176 10140 sqlite3_create_function (db, "RL2_DropRasterCoverage", 2, 10177 10141 SQLITE_UTF8, 0, fnct_DropRasterCoverage, 0, 0); 10178 10142 sqlite3_create_function (db, "SetRasterCoverageInfos", 3, 10179 10143 SQLITE_UTF8, 0, fnct_SetRasterCoverageInfos, 0, 0); 10180 - sqlite3_create_function (db, "RL2_SetRasterCoverageInfos", 3, SQLITE_UTF8, 10181 - 0, fnct_SetRasterCoverageInfos, 0, 0); 10144 + sqlite3_create_function (db, "RL2_SetRasterCoverageInfos", 3, 10145 + SQLITE_UTF8, 0, fnct_SetRasterCoverageInfos, 0, 0); 10182 10146 sqlite3_create_function (db, "SetRasterCoverageDefaultBands", 5, 10183 - SQLITE_UTF8, 0, 10184 - fnct_SetRasterCoverageDefaultBands, 0, 0); 10147 + SQLITE_UTF8, 0, fnct_SetRasterCoverageDefaultBands, 10148 + 0, 0); 10185 10149 sqlite3_create_function (db, "RL2_SetRasterCoverageDefaultBands", 5, 10186 - SQLITE_UTF8, 0, 10187 - fnct_SetRasterCoverageDefaultBands, 0, 0); 10150 + SQLITE_UTF8, 0, fnct_SetRasterCoverageDefaultBands, 10151 + 0, 0); 10188 10152 sqlite3_create_function (db, "EnableRasterCoverageAutoNDVI", 2, 10189 - SQLITE_UTF8, 0, 10190 - fnct_EnableRasterCoverageAutoNDVI, 0, 0); 10153 + SQLITE_UTF8, 0, fnct_EnableRasterCoverageAutoNDVI, 10154 + 0, 0); 10191 10155 sqlite3_create_function (db, "RL2_EnableRasterCoverageAutoNDVI", 2, 10192 - SQLITE_UTF8, 0, 10193 - fnct_EnableRasterCoverageAutoNDVI, 0, 0); 10156 + SQLITE_UTF8, 0, fnct_EnableRasterCoverageAutoNDVI, 10157 + 0, 0); 10194 10158 sqlite3_create_function (db, "IsRasterCoverageAutoNdviEnabled", 1, 10195 10159 SQLITE_UTF8, 0, 10196 10160 fnct_IsRasterCoverageAutoNdviEnabled, 0, 0); 10197 10161 sqlite3_create_function (db, "RL2_IsRasterCoverageAutoNdviEnabled", 1, 10198 10162 SQLITE_UTF8, 0, 10199 10163 fnct_IsRasterCoverageAutoNdviEnabled, 0, 0); 10200 10164 sqlite3_create_function (db, "GetPaletteNumEntries", 1, ................................................................................ 10322 10286 fnct_IsFontItalic, 0, 0); 10323 10287 sqlite3_create_function (db, "RL2_IsFontItalic", 1, 10324 10288 SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10325 10289 fnct_IsFontItalic, 0, 0); 10326 10290 sqlite3_create_function (db, "GetRasterStatistics_NoDataPixelsCount", 1, 10327 10291 SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10328 10292 fnct_GetRasterStatistics_NoDataPixelsCount, 0, 0); 10329 - sqlite3_create_function (db, "RL2_GetRasterStatistics_NoDataPixelsCount", 10330 - 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10293 + sqlite3_create_function (db, "RL2_GetRasterStatistics_NoDataPixelsCount", 1, 10294 + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10331 10295 fnct_GetRasterStatistics_NoDataPixelsCount, 0, 0); 10332 10296 sqlite3_create_function (db, "GetRasterStatistics_ValidPixelsCount", 1, 10333 10297 SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10334 10298 fnct_GetRasterStatistics_ValidPixelsCount, 0, 0); 10335 - sqlite3_create_function (db, "RL2_GetRasterStatistics_ValidPixelsCount", 10336 - 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10299 + sqlite3_create_function (db, "RL2_GetRasterStatistics_ValidPixelsCount", 1, 10300 + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10337 10301 fnct_GetRasterStatistics_ValidPixelsCount, 0, 0); 10338 10302 sqlite3_create_function (db, "GetRasterStatistics_SampleType", 1, 10339 10303 SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10340 10304 fnct_GetRasterStatistics_SampleType, 0, 0); 10341 10305 sqlite3_create_function (db, "RL2_GetRasterStatistics_SampleType", 1, 10342 10306 SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10343 10307 fnct_GetRasterStatistics_SampleType, 0, 0); ................................................................................ 10404 10368 fnct_Pyramidize, 0, 0); 10405 10369 sqlite3_create_function (db, "Pyramidize", 4, SQLITE_UTF8, priv_data, 10406 10370 fnct_Pyramidize, 0, 0); 10407 10371 sqlite3_create_function (db, "RL2_Pyramidize", 4, SQLITE_UTF8, priv_data, 10408 10372 fnct_Pyramidize, 0, 0); 10409 10373 sqlite3_create_function (db, "PyramidizeMonolithic", 1, SQLITE_UTF8, 0, 10410 10374 fnct_PyramidizeMonolithic, 0, 0); 10411 - sqlite3_create_function (db, "RL2_PyramidizeMonolithic", 1, SQLITE_UTF8, 10412 - 0, fnct_PyramidizeMonolithic, 0, 0); 10375 + sqlite3_create_function (db, "RL2_PyramidizeMonolithic", 1, SQLITE_UTF8, 0, 10376 + fnct_PyramidizeMonolithic, 0, 0); 10413 10377 sqlite3_create_function (db, "PyramidizeMonolithic", 2, SQLITE_UTF8, 0, 10414 10378 fnct_PyramidizeMonolithic, 0, 0); 10415 - sqlite3_create_function (db, "RL2_PyramidizeMonolithic", 2, SQLITE_UTF8, 10416 - 0, fnct_PyramidizeMonolithic, 0, 0); 10379 + sqlite3_create_function (db, "RL2_PyramidizeMonolithic", 2, SQLITE_UTF8, 0, 10380 + fnct_PyramidizeMonolithic, 0, 0); 10417 10381 sqlite3_create_function (db, "PyramidizeMonolithic", 3, SQLITE_UTF8, 0, 10418 10382 fnct_PyramidizeMonolithic, 0, 0); 10419 - sqlite3_create_function (db, "RL2_PyramidizeMonolithic", 3, SQLITE_UTF8, 10420 - 0, fnct_PyramidizeMonolithic, 0, 0); 10383 + sqlite3_create_function (db, "RL2_PyramidizeMonolithic", 3, SQLITE_UTF8, 0, 10384 + fnct_PyramidizeMonolithic, 0, 0); 10421 10385 sqlite3_create_function (db, "DePyramidize", 1, SQLITE_UTF8, 0, 10422 10386 fnct_DePyramidize, 0, 0); 10423 10387 sqlite3_create_function (db, "RL2_DePyramidize", 1, SQLITE_UTF8, 0, 10424 10388 fnct_DePyramidize, 0, 0); 10425 10389 sqlite3_create_function (db, "DePyramidize", 2, SQLITE_UTF8, 0, 10426 10390 fnct_DePyramidize, 0, 0); 10427 10391 sqlite3_create_function (db, "RL2_DePyramidize", 2, SQLITE_UTF8, 0, ................................................................................ 10475 10439 sqlite3_create_function (db, "GetMapImageFromRaster", 11, 10476 10440 SQLITE_UTF8 | SQLITE_DETERMINISTIC, priv_data, 10477 10441 fnct_GetMapImageFromRaster, 0, 0); 10478 10442 sqlite3_create_function (db, "RL2_GetMapImageFromRaster", 11, 10479 10443 SQLITE_UTF8 | SQLITE_DETERMINISTIC, priv_data, 10480 10444 fnct_GetMapImageFromRaster, 0, 0); 10481 10445 sqlite3_create_function (db, "GetMapImageFromVector", 4, 10482 - SQLITE_UTF8 | SQLITE_DETERMINISTIC, priv_data, 10446 + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10483 10447 fnct_GetMapImageFromVector, 0, 0); 10484 10448 sqlite3_create_function (db, "RL2_GetMapImageFromVector", 4, 10485 - SQLITE_UTF8 | SQLITE_DETERMINISTIC, priv_data, 10449 + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10486 10450 fnct_GetMapImageFromVector, 0, 0); 10487 10451 sqlite3_create_function (db, "GetMapImageFromVector", 5, 10488 - SQLITE_UTF8 | SQLITE_DETERMINISTIC, priv_data, 10452 + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10489 10453 fnct_GetMapImageFromVector, 0, 0); 10490 10454 sqlite3_create_function (db, "RL2_GetMapImageFromVector", 5, 10491 - SQLITE_UTF8 | SQLITE_DETERMINISTIC, priv_data, 10455 + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10492 10456 fnct_GetMapImageFromVector, 0, 0); 10493 10457 sqlite3_create_function (db, "GetMapImageFromVector", 6, 10494 - SQLITE_UTF8 | SQLITE_DETERMINISTIC, priv_data, 10458 + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10495 10459 fnct_GetMapImageFromVector, 0, 0); 10496 10460 sqlite3_create_function (db, "RL2_GetMapImageFromVector", 6, 10497 - SQLITE_UTF8 | SQLITE_DETERMINISTIC, priv_data, 10461 + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10498 10462 fnct_GetMapImageFromVector, 0, 0); 10499 10463 sqlite3_create_function (db, "GetMapImageFromVector", 7, 10500 - SQLITE_UTF8 | SQLITE_DETERMINISTIC, priv_data, 10464 + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10501 10465 fnct_GetMapImageFromVector, 0, 0); 10502 10466 sqlite3_create_function (db, "RL2_GetMapImageFromVector", 7, 10503 - SQLITE_UTF8 | SQLITE_DETERMINISTIC, priv_data, 10467 + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10504 10468 fnct_GetMapImageFromVector, 0, 0); 10505 10469 sqlite3_create_function (db, "GetMapImageFromVector", 8, 10506 - SQLITE_UTF8 | SQLITE_DETERMINISTIC, priv_data, 10470 + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10507 10471 fnct_GetMapImageFromVector, 0, 0); 10508 10472 sqlite3_create_function (db, "RL2_GetMapImageFromVector", 8, 10509 - SQLITE_UTF8 | SQLITE_DETERMINISTIC, priv_data, 10473 + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10510 10474 fnct_GetMapImageFromVector, 0, 0); 10511 10475 sqlite3_create_function (db, "GetMapImageFromVector", 9, 10512 - SQLITE_UTF8 | SQLITE_DETERMINISTIC, priv_data, 10476 + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10513 10477 fnct_GetMapImageFromVector, 0, 0); 10514 10478 sqlite3_create_function (db, "RL2_GetMapImageFromVector", 9, 10515 - SQLITE_UTF8 | SQLITE_DETERMINISTIC, priv_data, 10479 + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10516 10480 fnct_GetMapImageFromVector, 0, 0); 10517 10481 sqlite3_create_function (db, "GetMapImageFromVector", 10, 10518 - SQLITE_UTF8 | SQLITE_DETERMINISTIC, priv_data, 10482 + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10519 10483 fnct_GetMapImageFromVector, 0, 0); 10520 10484 sqlite3_create_function (db, "RL2_GetMapImageFromVector", 10, 10521 - SQLITE_UTF8 | SQLITE_DETERMINISTIC, priv_data, 10485 + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10522 10486 fnct_GetMapImageFromVector, 0, 0); 10523 10487 sqlite3_create_function (db, "GetMapImageFromVector", 11, 10524 - SQLITE_UTF8 | SQLITE_DETERMINISTIC, priv_data, 10488 + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10525 10489 fnct_GetMapImageFromVector, 0, 0); 10526 10490 sqlite3_create_function (db, "RL2_GetMapImageFromVector", 11, 10527 - SQLITE_UTF8 | SQLITE_DETERMINISTIC, priv_data, 10491 + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 10528 10492 fnct_GetMapImageFromVector, 0, 0); 10529 10493 sqlite3_create_function (db, "GetTileImage", 2, 10530 10494 SQLITE_UTF8 | SQLITE_DETERMINISTIC, priv_data, 10531 10495 fnct_GetTileImage, 0, 0); 10532 10496 sqlite3_create_function (db, "RL2_GetTileImage", 2, 10533 10497 SQLITE_UTF8 | SQLITE_DETERMINISTIC, priv_data, 10534 10498 fnct_GetTileImage, 0, 0); ................................................................................ 10671 10635 fnct_LoadFontFromFile, 0, 0); 10672 10636 sqlite3_create_function (db, "RL2_LoadFontFromFile", 1, SQLITE_UTF8, 10673 10637 0, fnct_LoadFontFromFile, 0, 0); 10674 10638 sqlite3_create_function (db, "ExportFontToFile", 2, SQLITE_UTF8, 0, 10675 10639 fnct_ExportFontToFile, 0, 0); 10676 10640 sqlite3_create_function (db, "RL2_ExportFontToFile", 2, SQLITE_UTF8, 10677 10641 0, fnct_ExportFontToFile, 0, 0); 10678 - sqlite3_create_function (db, "LoadRaster", 2, SQLITE_UTF8, 10679 - priv_data, fnct_LoadRaster, 0, 0); 10680 - sqlite3_create_function (db, "LoadRaster", 3, SQLITE_UTF8, 10681 - priv_data, fnct_LoadRaster, 0, 0); 10682 - sqlite3_create_function (db, "LoadRaster", 4, SQLITE_UTF8, 10683 - priv_data, fnct_LoadRaster, 0, 0); 10684 - sqlite3_create_function (db, "LoadRaster", 5, SQLITE_UTF8, 10685 - priv_data, fnct_LoadRaster, 0, 0); 10686 - sqlite3_create_function (db, "LoadRaster", 6, SQLITE_UTF8, 10687 - priv_data, fnct_LoadRaster, 0, 0); 10642 + sqlite3_create_function (db, "LoadRaster", 2, SQLITE_UTF8, priv_data, 10643 + fnct_LoadRaster, 0, 0); 10644 + sqlite3_create_function (db, "LoadRaster", 3, SQLITE_UTF8, priv_data, 10645 + fnct_LoadRaster, 0, 0); 10646 + sqlite3_create_function (db, "LoadRaster", 4, SQLITE_UTF8, priv_data, 10647 + fnct_LoadRaster, 0, 0); 10648 + sqlite3_create_function (db, "LoadRaster", 5, SQLITE_UTF8, priv_data, 10649 + fnct_LoadRaster, 0, 0); 10650 + sqlite3_create_function (db, "LoadRaster", 6, SQLITE_UTF8, priv_data, 10651 + fnct_LoadRaster, 0, 0); 10688 10652 sqlite3_create_function (db, "RL2_LoadRaster", 2, SQLITE_UTF8, 10689 10653 priv_data, fnct_LoadRaster, 0, 0); 10690 10654 sqlite3_create_function (db, "RL2_LoadRaster", 3, SQLITE_UTF8, 10691 10655 priv_data, fnct_LoadRaster, 0, 0); 10692 10656 sqlite3_create_function (db, "RL2_LoadRaster", 4, SQLITE_UTF8, 10693 10657 priv_data, fnct_LoadRaster, 0, 0); 10694 10658 sqlite3_create_function (db, "RL2_LoadRaster", 5, SQLITE_UTF8, ................................................................................ 10703 10667 priv_data, fnct_LoadRastersFromDir, 0, 0); 10704 10668 sqlite3_create_function (db, "LoadRastersFromDir", 5, SQLITE_UTF8, 10705 10669 priv_data, fnct_LoadRastersFromDir, 0, 0); 10706 10670 sqlite3_create_function (db, "LoadRastersFromDir", 6, SQLITE_UTF8, 10707 10671 priv_data, fnct_LoadRastersFromDir, 0, 0); 10708 10672 sqlite3_create_function (db, "LoadRastersFromDir", 7, SQLITE_UTF8, 10709 10673 priv_data, fnct_LoadRastersFromDir, 0, 0); 10710 - sqlite3_create_function (db, "RL2_LoadRastersFromDir", 2, 10711 - SQLITE_UTF8, priv_data, 10712 - fnct_LoadRastersFromDir, 0, 0); 10713 - sqlite3_create_function (db, "RL2_LoadRastersFromDir", 3, 10714 - SQLITE_UTF8, priv_data, 10715 - fnct_LoadRastersFromDir, 0, 0); 10716 - sqlite3_create_function (db, "RL2_LoadRastersFromDir", 4, 10717 - SQLITE_UTF8, priv_data, 10718 - fnct_LoadRastersFromDir, 0, 0); 10719 - sqlite3_create_function (db, "RL2_LoadRastersFromDir", 5, 10720 - SQLITE_UTF8, priv_data, 10721 - fnct_LoadRastersFromDir, 0, 0); 10722 - sqlite3_create_function (db, "RL2_LoadRastersFromDir", 6, 10723 - SQLITE_UTF8, priv_data, 10724 - fnct_LoadRastersFromDir, 0, 0); 10725 - sqlite3_create_function (db, "RL2_LoadRastersFromDir", 7, 10726 - SQLITE_UTF8, priv_data, 10727 - fnct_LoadRastersFromDir, 0, 0); 10674 + sqlite3_create_function (db, "RL2_LoadRastersFromDir", 2, SQLITE_UTF8, 10675 + priv_data, fnct_LoadRastersFromDir, 0, 0); 10676 + sqlite3_create_function (db, "RL2_LoadRastersFromDir", 3, SQLITE_UTF8, 10677 + priv_data, fnct_LoadRastersFromDir, 0, 0); 10678 + sqlite3_create_function (db, "RL2_LoadRastersFromDir", 4, SQLITE_UTF8, 10679 + priv_data, fnct_LoadRastersFromDir, 0, 0); 10680 + sqlite3_create_function (db, "RL2_LoadRastersFromDir", 5, SQLITE_UTF8, 10681 + priv_data, fnct_LoadRastersFromDir, 0, 0); 10682 + sqlite3_create_function (db, "RL2_LoadRastersFromDir", 6, SQLITE_UTF8, 10683 + priv_data, fnct_LoadRastersFromDir, 0, 0); 10684 + sqlite3_create_function (db, "RL2_LoadRastersFromDir", 7, SQLITE_UTF8, 10685 + priv_data, fnct_LoadRastersFromDir, 0, 0); 10728 10686 sqlite3_create_function (db, "LoadRasterFromWMS", 9, SQLITE_UTF8, 10729 10687 priv_data, fnct_LoadRasterFromWMS, 0, 0); 10730 - sqlite3_create_function (db, "RL2_LoadRasterFromWMS", 9, 10731 - SQLITE_UTF8, priv_data, 10732 - fnct_LoadRasterFromWMS, 0, 0); 10688 + sqlite3_create_function (db, "RL2_LoadRasterFromWMS", 9, SQLITE_UTF8, 10689 + priv_data, fnct_LoadRasterFromWMS, 0, 0); 10733 10690 sqlite3_create_function (db, "LoadRasterFromWMS", 10, SQLITE_UTF8, 10734 10691 priv_data, fnct_LoadRasterFromWMS, 0, 0); 10735 - sqlite3_create_function (db, "RL2_LoadRasterFromWMS", 10, 10736 - SQLITE_UTF8, priv_data, 10737 - fnct_LoadRasterFromWMS, 0, 0); 10692 + sqlite3_create_function (db, "RL2_LoadRasterFromWMS", 10, SQLITE_UTF8, 10693 + priv_data, fnct_LoadRasterFromWMS, 0, 0); 10738 10694 sqlite3_create_function (db, "LoadRasterFromWMS", 11, SQLITE_UTF8, 10739 10695 priv_data, fnct_LoadRasterFromWMS, 0, 0); 10740 - sqlite3_create_function (db, "RL2_LoadRasterFromWMS", 11, 10741 - SQLITE_UTF8, priv_data, 10742 - fnct_LoadRasterFromWMS, 0, 0); 10696 + sqlite3_create_function (db, "RL2_LoadRasterFromWMS", 11, SQLITE_UTF8, 10697 + priv_data, fnct_LoadRasterFromWMS, 0, 0); 10743 10698 sqlite3_create_function (db, "LoadRasterFromWMS", 12, SQLITE_UTF8, 10744 10699 priv_data, fnct_LoadRasterFromWMS, 0, 0); 10745 - sqlite3_create_function (db, "RL2_LoadRasterFromWMS", 12, 10746 - SQLITE_UTF8, priv_data, 10747 - fnct_LoadRasterFromWMS, 0, 0); 10700 + sqlite3_create_function (db, "RL2_LoadRasterFromWMS", 12, SQLITE_UTF8, 10701 + priv_data, fnct_LoadRasterFromWMS, 0, 0); 10748 10702 sqlite3_create_function (db, "LoadRasterFromWMS", 13, SQLITE_UTF8, 10749 10703 priv_data, fnct_LoadRasterFromWMS, 0, 0); 10750 - sqlite3_create_function (db, "RL2_LoadRasterFromWMS", 13, 10751 - SQLITE_UTF8, priv_data, 10752 - fnct_LoadRasterFromWMS, 0, 0); 10704 + sqlite3_create_function (db, "RL2_LoadRasterFromWMS", 13, SQLITE_UTF8, 10705 + priv_data, fnct_LoadRasterFromWMS, 0, 0); 10753 10706 sqlite3_create_function (db, "LoadRasterFromWMS", 14, SQLITE_UTF8, 10754 10707 priv_data, fnct_LoadRasterFromWMS, 0, 0); 10755 - sqlite3_create_function (db, "RL2_LoadRasterFromWMS", 14, 10756 - SQLITE_UTF8, 0, fnct_LoadRasterFromWMS, 0, 10757 - 0); 10708 + sqlite3_create_function (db, "RL2_LoadRasterFromWMS", 14, SQLITE_UTF8, 10709 + 0, fnct_LoadRasterFromWMS, 0, 0); 10758 10710 sqlite3_create_function (db, "WriteGeoTiff", 6, SQLITE_UTF8, 10759 10711 priv_data, fnct_WriteGeoTiff, 0, 0); 10760 10712 sqlite3_create_function (db, "RL2_WriteGeoTiff", 6, SQLITE_UTF8, 10761 10713 priv_data, fnct_WriteGeoTiff, 0, 0); 10762 10714 sqlite3_create_function (db, "WriteGeoTiff", 7, SQLITE_UTF8, 10763 10715 priv_data, fnct_WriteGeoTiff, 0, 0); 10764 10716 sqlite3_create_function (db, "RL2_WriteGeoTiff", 7, SQLITE_UTF8, ................................................................................ 10861 10813 priv_data, fnct_WriteSectionTiff, 0, 0); 10862 10814 sqlite3_create_function (db, "WriteSectionTiff", 9, SQLITE_UTF8, 10863 10815 priv_data, fnct_WriteSectionTiff, 0, 0); 10864 10816 sqlite3_create_function (db, "RL2_WriteSectionTiff", 9, SQLITE_UTF8, 10865 10817 priv_data, fnct_WriteSectionTiff, 0, 0); 10866 10818 sqlite3_create_function (db, "WriteSectionTiff", 10, SQLITE_UTF8, 10867 10819 priv_data, fnct_WriteSectionTiff, 0, 0); 10868 - sqlite3_create_function (db, "RL2_WriteSectionTiff", 10, 10869 - SQLITE_UTF8, priv_data, 10870 - fnct_WriteSectionTiff, 0, 0); 10820 + sqlite3_create_function (db, "RL2_WriteSectionTiff", 10, SQLITE_UTF8, 10821 + priv_data, fnct_WriteSectionTiff, 0, 0); 10871 10822 sqlite3_create_function (db, "WriteJpegJgw", 6, SQLITE_UTF8, 10872 10823 priv_data, fnct_WriteJpegJgw, 0, 0); 10873 10824 sqlite3_create_function (db, "RL2_WriteJpegJgw", 6, SQLITE_UTF8, 10874 10825 priv_data, fnct_WriteJpegJgw, 0, 0); 10875 10826 sqlite3_create_function (db, "WriteJpegJgw", 7, SQLITE_UTF8, 10876 10827 priv_data, fnct_WriteJpegJgw, 0, 0); 10877 10828 sqlite3_create_function (db, "RL2_WriteJpegJgw", 7, SQLITE_UTF8, ................................................................................ 10915 10866 priv_data, fnct_WriteSectionJpeg, 0, 0); 10916 10867 sqlite3_create_function (db, "RL2_WriteSectionJpeg", 8, SQLITE_UTF8, 10917 10868 priv_data, fnct_WriteSectionJpeg, 0, 0); 10918 10869 sqlite3_create_function (db, "WriteSectionJpeg", 9, SQLITE_UTF8, 10919 10870 priv_data, fnct_WriteSectionJpeg, 0, 0); 10920 10871 sqlite3_create_function (db, "RL2_WriteSectionJpeg", 9, SQLITE_UTF8, 10921 10872 priv_data, fnct_WriteSectionJpeg, 0, 0); 10922 - sqlite3_create_function (db, "WriteTripleBandGeoTiff", 9, 10923 - SQLITE_UTF8, priv_data, 10924 - fnct_WriteTripleBandGeoTiff, 0, 0); 10873 + sqlite3_create_function (db, "WriteTripleBandGeoTiff", 9, SQLITE_UTF8, 10874 + priv_data, fnct_WriteTripleBandGeoTiff, 0, 10875 + 0); 10925 10876 sqlite3_create_function (db, "RL2_WriteTripleBandGeoTiff", 9, 10926 10877 SQLITE_UTF8, priv_data, 10927 10878 fnct_WriteTripleBandGeoTiff, 0, 0); 10928 10879 sqlite3_create_function (db, "WriteTripleBandGeoTiff", 10, 10929 10880 SQLITE_UTF8, priv_data, 10930 10881 fnct_WriteTripleBandGeoTiff, 0, 0); 10931 10882 sqlite3_create_function (db, "RL2_WriteTripleBandGeoTiff", 10, ................................................................................ 10948 10899 fnct_WriteTripleBandGeoTiff, 0, 0); 10949 10900 sqlite3_create_function (db, "RL2_WriteTripleBandGeoTiff", 13, 10950 10901 SQLITE_UTF8, priv_data, 10951 10902 fnct_WriteTripleBandGeoTiff, 0, 0); 10952 10903 sqlite3_create_function (db, "WriteSectionTripleBandGeoTiff", 10, 10953 10904 SQLITE_UTF8, 0, 10954 10905 fnct_WriteSectionTripleBandGeoTiff, 0, 0); 10955 - sqlite3_create_function (db, "RL2_WriteSectionTripleBandGeoTiff", 10956 - 10, SQLITE_UTF8, priv_data, 10906 + sqlite3_create_function (db, "RL2_WriteSectionTripleBandGeoTiff", 10, 10907 + SQLITE_UTF8, priv_data, 10957 10908 fnct_WriteSectionTripleBandGeoTiff, 0, 0); 10958 10909 sqlite3_create_function (db, "WriteSectionTripleBandGeoTiff", 11, 10959 10910 SQLITE_UTF8, priv_data, 10960 10911 fnct_WriteSectionTripleBandGeoTiff, 0, 0); 10961 - sqlite3_create_function (db, "RL2_WriteSectionTripleBandGeoTiff", 10962 - 11, SQLITE_UTF8, priv_data, 10912 + sqlite3_create_function (db, "RL2_WriteSectionTripleBandGeoTiff", 11, 10913 + SQLITE_UTF8, priv_data, 10963 10914 fnct_WriteSectionTripleBandGeoTiff, 0, 0); 10964 10915 sqlite3_create_function (db, "WriteSectionTripleBandGeoTiff", 12, 10965 10916 SQLITE_UTF8, priv_data, 10966 10917 fnct_WriteSectionTripleBandGeoTiff, 0, 0); 10967 - sqlite3_create_function (db, "RL2_WriteSectionTripleBandGeoTiff", 10968 - 12, SQLITE_UTF8, priv_data, 10918 + sqlite3_create_function (db, "RL2_WriteSectionTripleBandGeoTiff", 12, 10919 + SQLITE_UTF8, priv_data, 10969 10920 fnct_WriteSectionTripleBandGeoTiff, 0, 0); 10970 10921 sqlite3_create_function (db, "WriteSectionTripleBandGeoTiff", 13, 10971 10922 SQLITE_UTF8, priv_data, 10972 10923 fnct_WriteSectionTripleBandGeoTiff, 0, 0); 10973 - sqlite3_create_function (db, "RL2_WriteSectionTripleBandGeoTiff", 10974 - 13, SQLITE_UTF8, priv_data, 10924 + sqlite3_create_function (db, "RL2_WriteSectionTripleBandGeoTiff", 13, 10925 + SQLITE_UTF8, priv_data, 10975 10926 fnct_WriteSectionTripleBandGeoTiff, 0, 0); 10976 10927 sqlite3_create_function (db, "WriteSectionTripleBandGeoTiff", 14, 10977 10928 SQLITE_UTF8, priv_data, 10978 10929 fnct_WriteSectionTripleBandGeoTiff, 0, 0); 10979 - sqlite3_create_function (db, "RL2_WriteSectionTripleBandGeoTiff", 10980 - 14, SQLITE_UTF8, priv_data, 10930 + sqlite3_create_function (db, "RL2_WriteSectionTripleBandGeoTiff", 14, 10931 + SQLITE_UTF8, priv_data, 10981 10932 fnct_WriteSectionTripleBandGeoTiff, 0, 0); 10982 10933 sqlite3_create_function (db, "WriteMonoBandGeoTiff", 7, SQLITE_UTF8, 10983 10934 0, fnct_WriteMonoBandGeoTiff, 0, 0); 10984 10935 sqlite3_create_function (db, "RL2_WriteMonoBandGeoTiff", 7, 10985 10936 SQLITE_UTF8, priv_data, 10986 10937 fnct_WriteMonoBandGeoTiff, 0, 0); 10987 10938 sqlite3_create_function (db, "WriteMonoBandGeoTiff", 8, SQLITE_UTF8, ................................................................................ 10990 10941 SQLITE_UTF8, priv_data, 10991 10942 fnct_WriteMonoBandGeoTiff, 0, 0); 10992 10943 sqlite3_create_function (db, "WriteMonoBandGeoTiff", 9, SQLITE_UTF8, 10993 10944 0, fnct_WriteMonoBandGeoTiff, 0, 0); 10994 10945 sqlite3_create_function (db, "RL2_WriteMonoBandGeoTiff", 9, 10995 10946 SQLITE_UTF8, priv_data, 10996 10947 fnct_WriteMonoBandGeoTiff, 0, 0); 10997 - sqlite3_create_function (db, "WriteMonoBandGeoTiff", 10, 10998 - SQLITE_UTF8, 0, fnct_WriteMonoBandGeoTiff, 10999 - 0, 0); 10948 + sqlite3_create_function (db, "WriteMonoBandGeoTiff", 10, SQLITE_UTF8, 10949 + 0, fnct_WriteMonoBandGeoTiff, 0, 0); 11000 10950 sqlite3_create_function (db, "RL2_WriteMonoBandGeoTiff", 10, 11001 10951 SQLITE_UTF8, priv_data, 11002 10952 fnct_WriteMonoBandGeoTiff, 0, 0); 11003 - sqlite3_create_function (db, "WriteMonoBandGeoTiff", 11, 11004 - SQLITE_UTF8, 0, fnct_WriteMonoBandGeoTiff, 11005 - 0, 0); 10953 + sqlite3_create_function (db, "WriteMonoBandGeoTiff", 11, SQLITE_UTF8, 10954 + 0, fnct_WriteMonoBandGeoTiff, 0, 0); 11006 10955 sqlite3_create_function (db, "RL2_WriteMonoBandGeoTiff", 11, 11007 10956 SQLITE_UTF8, priv_data, 11008 10957 fnct_WriteMonoBandGeoTiff, 0, 0); 11009 10958 sqlite3_create_function (db, "WriteSectionMonoBandGeoTiff", 8, 11010 10959 SQLITE_UTF8, priv_data, 11011 10960 fnct_WriteSectionMonoBandGeoTiff, 0, 0); 11012 10961 sqlite3_create_function (db, "RL2_WriteSectionMonoBandGeoTiff", 8, ................................................................................ 11032 10981 fnct_WriteSectionMonoBandGeoTiff, 0, 0); 11033 10982 sqlite3_create_function (db, "WriteSectionMonoBandGeoTiff", 12, 11034 10983 SQLITE_UTF8, priv_data, 11035 10984 fnct_WriteSectionMonoBandGeoTiff, 0, 0); 11036 10985 sqlite3_create_function (db, "RL2_WriteSectionMonoBandGeoTiff", 12, 11037 10986 SQLITE_UTF8, priv_data, 11038 10987 fnct_WriteSectionMonoBandGeoTiff, 0, 0); 11039 - sqlite3_create_function (db, "WriteTripleBandTiffTfw", 9, 11040 - SQLITE_UTF8, priv_data, 11041 - fnct_WriteTripleBandTiffTfw, 0, 0); 10988 + sqlite3_create_function (db, "WriteTripleBandTiffTfw", 9, SQLITE_UTF8, 10989 + priv_data, fnct_WriteTripleBandTiffTfw, 0, 10990 + 0); 11042 10991 sqlite3_create_function (db, "RL2_WriteTripleBandTiffTfw", 9, 11043 10992 SQLITE_UTF8, priv_data, 11044 10993 fnct_WriteTripleBandTiffTfw, 0, 0); 11045 10994 sqlite3_create_function (db, "WriteTripleBandTiffTfw", 10, 11046 10995 SQLITE_UTF8, priv_data, 11047 10996 fnct_WriteTripleBandTiffTfw, 0, 0); 11048 10997 sqlite3_create_function (db, "RL2_WriteTripleBandTiffTfw", 10, ................................................................................ 11059 11008 fnct_WriteTripleBandTiffTfw, 0, 0); 11060 11009 sqlite3_create_function (db, "RL2_WriteTripleBandTiffTfw", 12, 11061 11010 SQLITE_UTF8, priv_data, 11062 11011 fnct_WriteTripleBandTiffTfw, 0, 0); 11063 11012 sqlite3_create_function (db, "WriteSectionTripleBandTiffTfw", 10, 11064 11013 SQLITE_UTF8, priv_data, 11065 11014 fnct_WriteSectionTripleBandTiffTfw, 0, 0); 11066 - sqlite3_create_function (db, "RL2_WriteSectionTripleBandTiffTfw", 11067 - 10, SQLITE_UTF8, priv_data, 11015 + sqlite3_create_function (db, "RL2_WriteSectionTripleBandTiffTfw", 10, 11016 + SQLITE_UTF8, priv_data, 11068 11017 fnct_WriteSectionTripleBandTiffTfw, 0, 0); 11069 11018 sqlite3_create_function (db, "WriteSectionTripleBandTiffTfw", 11, 11070 11019 SQLITE_UTF8, priv_data, 11071 11020 fnct_WriteSectionTripleBandTiffTfw, 0, 0); 11072 - sqlite3_create_function (db, "RL2_WriteSectionTripleBandTiffTfw", 11073 - 11, SQLITE_UTF8, priv_data, 11021 + sqlite3_create_function (db, "RL2_WriteSectionTripleBandTiffTfw", 11, 11022 + SQLITE_UTF8, priv_data, 11074 11023 fnct_WriteSectionTripleBandTiffTfw, 0, 0); 11075 11024 sqlite3_create_function (db, "WriteSectionTripleBandTiffTfw", 12, 11076 11025 SQLITE_UTF8, priv_data, 11077 11026 fnct_WriteSectionTripleBandTiffTfw, 0, 0); 11078 - sqlite3_create_function (db, "RL2_WriteSectionTripleBandTiffTfw", 11079 - 12, SQLITE_UTF8, priv_data, 11027 + sqlite3_create_function (db, "RL2_WriteSectionTripleBandTiffTfw", 12, 11028 + SQLITE_UTF8, priv_data, 11080 11029 fnct_WriteSectionTripleBandTiffTfw, 0, 0); 11081 11030 sqlite3_create_function (db, "WriteSectionTripleBandTiffTfw", 13, 11082 11031 SQLITE_UTF8, priv_data, 11083 11032 fnct_WriteSectionTripleBandTiffTfw, 0, 0); 11084 - sqlite3_create_function (db, "RL2_WriteSectionTripleBandTiffTfw", 11085 - 13, SQLITE_UTF8, priv_data, 11033 + sqlite3_create_function (db, "RL2_WriteSectionTripleBandTiffTfw", 13, 11034 + SQLITE_UTF8, priv_data, 11086 11035 fnct_WriteSectionTripleBandTiffTfw, 0, 0); 11087 11036 sqlite3_create_function (db, "WriteSectionMonoBandTiffTfw", 8, 11088 11037 SQLITE_UTF8, priv_data, 11089 11038 fnct_WriteSectionMonoBandTiffTfw, 0, 0); 11090 11039 sqlite3_create_function (db, "RL2_WriteSectionMonoBandTiffTfw", 8, 11091 11040 SQLITE_UTF8, priv_data, 11092 11041 fnct_WriteSectionMonoBandTiffTfw, 0, 0); ................................................................................ 11119 11068 SQLITE_UTF8, priv_data, 11120 11069 fnct_WriteMonoBandTiffTfw, 0, 0); 11121 11070 sqlite3_create_function (db, "WriteMonoBandTiffTfw", 9, SQLITE_UTF8, 11122 11071 priv_data, fnct_WriteMonoBandTiffTfw, 0, 0); 11123 11072 sqlite3_create_function (db, "RL2_WriteMonoBandTiffTfw", 9, 11124 11073 SQLITE_UTF8, priv_data, 11125 11074 fnct_WriteMonoBandTiffTfw, 0, 0); 11126 - sqlite3_create_function (db, "WriteMonoBandTiffTfw", 10, 11127 - SQLITE_UTF8, priv_data, 11128 - fnct_WriteMonoBandTiffTfw, 0, 0); 11075 + sqlite3_create_function (db, "WriteMonoBandTiffTfw", 10, SQLITE_UTF8, 11076 + priv_data, fnct_WriteMonoBandTiffTfw, 0, 0); 11129 11077 sqlite3_create_function (db, "RL2_WriteMonoBandTiffTfw", 10, 11130 11078 SQLITE_UTF8, priv_data, 11131 11079 fnct_WriteMonoBandTiffTfw, 0, 0); 11132 - sqlite3_create_function (db, "WriteTripleBandTiff", 9, SQLITE_UTF8, 11133 - 0, fnct_WriteTripleBandTiff, 0, 0); 11080 + sqlite3_create_function (db, "WriteTripleBandTiff", 9, SQLITE_UTF8, 0, 11081 + fnct_WriteTripleBandTiff, 0, 0); 11134 11082 sqlite3_create_function (db, "RL2_WriteTripleBandTiff", 9, 11135 11083 SQLITE_UTF8, priv_data, 11136 11084 fnct_WriteTripleBandTiff, 0, 0); 11137 11085 sqlite3_create_function (db, "WriteTripleBandTiff", 10, SQLITE_UTF8, 11138 11086 0, fnct_WriteTripleBandTiff, 0, 0); 11139 11087 sqlite3_create_function (db, "RL2_WriteTripleBandTiff", 10, 11140 11088 SQLITE_UTF8, priv_data, ................................................................................ 11171 11119 SQLITE_UTF8, priv_data, 11172 11120 fnct_WriteSectionTripleBandTiff, 0, 0); 11173 11121 sqlite3_create_function (db, "RL2_WriteSectionTripleBandTiff", 13, 11174 11122 SQLITE_UTF8, priv_data, 11175 11123 fnct_WriteSectionTripleBandTiff, 0, 0); 11176 11124 sqlite3_create_function (db, "WriteMonoBandTiff", 7, SQLITE_UTF8, 0, 11177 11125 fnct_WriteMonoBandTiff, 0, 0); 11178 - sqlite3_create_function (db, "RL2_WriteMonoBandTiff", 7, 11179 - SQLITE_UTF8, priv_data, 11180 - fnct_WriteMonoBandTiff, 0, 0); 11126 + sqlite3_create_function (db, "RL2_WriteMonoBandTiff", 7, SQLITE_UTF8, 11127 + priv_data, fnct_WriteMonoBandTiff, 0, 0); 11181 11128 sqlite3_create_function (db, "WriteMonoBandTiff", 8, SQLITE_UTF8, 0, 11182 11129 fnct_WriteMonoBandTiff, 0, 0); 11183 - sqlite3_create_function (db, "RL2_WriteMonoBandTiff", 8, 11184 - SQLITE_UTF8, priv_data, 11185 - fnct_WriteMonoBandTiff, 0, 0); 11130 + sqlite3_create_function (db, "RL2_WriteMonoBandTiff", 8, SQLITE_UTF8, 11131 + priv_data, fnct_WriteMonoBandTiff, 0, 0); 11186 11132 sqlite3_create_function (db, "WriteMonoBandTiff", 9, SQLITE_UTF8, 11187 11133 priv_data, fnct_WriteMonoBandTiff, 0, 0); 11188 - sqlite3_create_function (db, "RL2_WriteMonoBandTiff", 9, 11189 - SQLITE_UTF8, priv_data, 11190 - fnct_WriteMonoBandTiff, 0, 0); 11134 + sqlite3_create_function (db, "RL2_WriteMonoBandTiff", 9, SQLITE_UTF8, 11135 + priv_data, fnct_WriteMonoBandTiff, 0, 0); 11191 11136 sqlite3_create_function (db, "WriteMonoBandTiff", 10, SQLITE_UTF8, 11192 11137 priv_data, fnct_WriteMonoBandTiff, 0, 0); 11193 - sqlite3_create_function (db, "RL2_WriteMonoBandTiff", 10, 11194 - SQLITE_UTF8, priv_data, 11195 - fnct_WriteMonoBandTiff, 0, 0); 11138 + sqlite3_create_function (db, "RL2_WriteMonoBandTiff", 10, SQLITE_UTF8, 11139 + priv_data, fnct_WriteMonoBandTiff, 0, 0); 11196 11140 sqlite3_create_function (db, "WriteSectionMonoBandTiff", 8, 11197 11141 SQLITE_UTF8, priv_data, 11198 11142 fnct_WriteSectionMonoBandTiff, 0, 0); 11199 11143 sqlite3_create_function (db, "RL2_WriteSectionMonoBandTiff", 8, 11200 11144 SQLITE_UTF8, priv_data, 11201 11145 fnct_WriteSectionMonoBandTiff, 0, 0); 11202 11146 sqlite3_create_function (db, "WriteSectionMonoBandTiff", 9, ................................................................................ 11225 11169 priv_data, fnct_WriteAsciiGrid, 0, 0); 11226 11170 sqlite3_create_function (db, "RL2_WriteAsciiGrid", 7, SQLITE_UTF8, 11227 11171 priv_data, fnct_WriteAsciiGrid, 0, 0); 11228 11172 sqlite3_create_function (db, "WriteAsciiGrid", 8, SQLITE_UTF8, 11229 11173 priv_data, fnct_WriteAsciiGrid, 0, 0); 11230 11174 sqlite3_create_function (db, "RL2_WriteAsciiGrid", 8, SQLITE_UTF8, 11231 11175 priv_data, fnct_WriteAsciiGrid, 0, 0); 11232 - sqlite3_create_function (db, "WriteSectionAsciiGrid", 7, 11233 - SQLITE_UTF8, priv_data, 11234 - fnct_WriteSectionAsciiGrid, 0, 0); 11176 + sqlite3_create_function (db, "WriteSectionAsciiGrid", 7, SQLITE_UTF8, 11177 + priv_data, fnct_WriteSectionAsciiGrid, 0, 0); 11235 11178 sqlite3_create_function (db, "RL2_WriteSectionAsciiGrid", 7, 11236 11179 SQLITE_UTF8, priv_data, 11237 11180 fnct_WriteSectionAsciiGrid, 0, 0); 11238 - sqlite3_create_function (db, "WriteSectionAsciiGrid", 8, 11239 - SQLITE_UTF8, 0, fnct_WriteSectionAsciiGrid, 11240 - 0, 0); 11181 + sqlite3_create_function (db, "WriteSectionAsciiGrid", 8, SQLITE_UTF8, 11182 + 0, fnct_WriteSectionAsciiGrid, 0, 0); 11241 11183 sqlite3_create_function (db, "RL2_WriteSectionAsciiGrid", 8, 11242 11184 SQLITE_UTF8, priv_data, 11243 11185 fnct_WriteSectionAsciiGrid, 0, 0); 11244 - sqlite3_create_function (db, "WriteSectionAsciiGrid", 9, 11245 - SQLITE_UTF8, 0, fnct_WriteSectionAsciiGrid, 11246 - 0, 0); 11186 + sqlite3_create_function (db, "WriteSectionAsciiGrid", 9, SQLITE_UTF8, 11187 + 0, fnct_WriteSectionAsciiGrid, 0, 0); 11247 11188 sqlite3_create_function (db, "RL2_WriteSectionAsciiGrid", 9, 11248 11189 SQLITE_UTF8, priv_data, 11249 11190 fnct_WriteSectionAsciiGrid, 0, 0); 11250 11191 sqlite3_create_function (db, "WriteNdviAsciiGrid", 8, SQLITE_UTF8, 11251 11192 priv_data, fnct_WriteNdviAsciiGrid, 0, 0); 11252 - sqlite3_create_function (db, "RL2_WriteNdviAsciiGrid", 8, 11253 - SQLITE_UTF8, priv_data, 11254 - fnct_WriteNdviAsciiGrid, 0, 0); 11193 + sqlite3_create_function (db, "RL2_WriteNdviAsciiGrid", 8, SQLITE_UTF8, 11194 + priv_data, fnct_WriteNdviAsciiGrid, 0, 0); 11255 11195 sqlite3_create_function (db, "WriteNdviAsciiGrid", 9, SQLITE_UTF8, 11256 11196 priv_data, fnct_WriteNdviAsciiGrid, 0, 0); 11257 - sqlite3_create_function (db, "RL2_WriteNdviAsciiGrid", 9, 11258 - SQLITE_UTF8, priv_data, 11259 - fnct_WriteNdviAsciiGrid, 0, 0); 11197 + sqlite3_create_function (db, "RL2_WriteNdviAsciiGrid", 9, SQLITE_UTF8, 11198 + priv_data, fnct_WriteNdviAsciiGrid, 0, 0); 11260 11199 sqlite3_create_function (db, "WriteNdviAsciiGrid", 10, SQLITE_UTF8, 11261 11200 priv_data, fnct_WriteNdviAsciiGrid, 0, 0); 11262 11201 sqlite3_create_function (db, "RL2_WriteNdviAsciiGrid", 10, 11263 11202 SQLITE_UTF8, priv_data, 11264 11203 fnct_WriteNdviAsciiGrid, 0, 0); 11265 11204 sqlite3_create_function (db, "WriteSectionNdviAsciiGrid", 9, 11266 11205 SQLITE_UTF8, priv_data,
Changes to src/rl2sqlaux.c.
81 81 int ret; 82 82 const char *sample; 83 83 int bands; 84 84 unsigned char xsample_type = RL2_SAMPLE_UNKNOWN; 85 85 unsigned char xnum_bands = RL2_BANDS_UNKNOWN; 86 86 87 87 sql = 88 - sqlite3_mprintf 89 - ("SELECT sample_type, num_bands FROM raster_coverages " 90 - "WHERE Lower(coverage_name) = Lower(%Q)", coverage); 88 + sqlite3_mprintf ("SELECT sample_type, num_bands FROM raster_coverages " 89 + "WHERE Lower(coverage_name) = Lower(%Q)", coverage); 91 90 ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL); 92 91 sqlite3_free (sql); 93 92 if (ret != SQLITE_OK) 94 93 return 0; 95 94 if (rows < 1) 96 95 ; 97 96 else ................................................................................ 735 734 error: 736 735 if (stmt != NULL) 737 736 sqlite3_finalize (stmt); 738 737 return RL2_ERROR; 739 738 } 740 739 741 740 static int 742 -do_insert_wms_tile (sqlite3 * handle, unsigned char *blob_odd, 743 - int blob_odd_sz, unsigned char *blob_even, 744 - int blob_even_sz, sqlite3_int64 section_id, int srid, 745 - double res_x, double res_y, unsigned int tile_w, 746 - unsigned int tile_h, double miny, double maxx, 747 - double tile_minx, double tile_miny, double tile_maxx, 748 - double tile_maxy, rl2PalettePtr aux_palette, 749 - rl2PixelPtr no_data, sqlite3_stmt * stmt_tils, 750 - sqlite3_stmt * stmt_data, 741 +do_insert_wms_tile (sqlite3 * handle, unsigned char *blob_odd, int blob_odd_sz, 742 + unsigned char *blob_even, int blob_even_sz, 743 + sqlite3_int64 section_id, int srid, double res_x, 744 + double res_y, unsigned int tile_w, unsigned int tile_h, 745 + double miny, double maxx, double tile_minx, 746 + double tile_miny, double tile_maxx, double tile_maxy, 747 + rl2PalettePtr aux_palette, rl2PixelPtr no_data, 748 + sqlite3_stmt * stmt_tils, sqlite3_stmt * stmt_data, 751 749 rl2RasterStatisticsPtr section_stats) 752 750 { 753 751 /* INSERTing the tile */ 754 752 int ret; 755 753 sqlite3_int64 tile_id; 756 754 rl2RasterStatisticsPtr stats = NULL; 757 755 ................................................................................ 1001 999 } 1002 1000 1003 1001 RL2_PRIVATE int 1004 1002 rl2_do_insert_section (sqlite3 * handle, const char *src_path, 1005 1003 const char *section, int srid, unsigned int width, 1006 1004 unsigned int height, double minx, double miny, 1007 1005 double maxx, double maxy, char *xml_summary, 1008 - int section_paths, int section_md5, 1009 - int section_summary, sqlite3_stmt * stmt_sect, 1010 - sqlite3_int64 * id) 1006 + int section_paths, int section_md5, int section_summary, 1007 + sqlite3_stmt * stmt_sect, sqlite3_int64 * id) 1011 1008 { 1012 1009 /* INSERTing the section */ 1013 1010 int ret; 1014 1011 unsigned char *blob; 1015 1012 int blob_size; 1016 1013 sqlite3_int64 section_id; 1017 1014 ................................................................................ 1054 1051 { 1055 1052 sqlite3_bind_null (stmt_sect, 4); 1056 1053 if (xml_summary != NULL) 1057 1054 free (xml_summary); 1058 1055 } 1059 1056 sqlite3_bind_int (stmt_sect, 5, width); 1060 1057 sqlite3_bind_int (stmt_sect, 6, height); 1061 - if (rl2_build_bbox 1062 - (handle, srid, minx, miny, maxx, maxy, &blob, &blob_size) != RL2_OK) 1058 + if (rl2_build_bbox (handle, srid, minx, miny, maxx, maxy, &blob, &blob_size) 1059 + != RL2_OK) 1063 1060 goto error; 1064 1061 sqlite3_bind_blob (stmt_sect, 7, blob, blob_size, free); 1065 1062 ret = sqlite3_step (stmt_sect); 1066 1063 if (ret == SQLITE_DONE || ret == SQLITE_ROW) 1067 1064 section_id = sqlite3_last_insert_rowid (handle); 1068 1065 else 1069 1066 { ................................................................................ 1216 1213 int blob_odd_sz; 1217 1214 unsigned char *blob_even; 1218 1215 int blob_even_sz; 1219 1216 rl2RasterPtr raster = NULL; 1220 1217 double base_res_x; 1221 1218 double base_res_y; 1222 1219 1223 - if (rl2_get_coverage_resolution (ptr->coverage, &base_res_x, &base_res_y) 1224 - != RL2_OK) 1220 + if (rl2_get_coverage_resolution (ptr->coverage, &base_res_x, &base_res_y) != 1221 + RL2_OK) 1225 1222 goto error; 1226 1223 if (*first) 1227 1224 { 1228 1225 /* INSERTing the section */ 1229 1226 *first = 0; 1230 1227 if (!rl2_do_insert_section 1231 1228 (ptr->sqlite, "WMS Service", ptr->sect_name, ptr->srid, 1232 1229 ptr->width, ptr->height, ptr->minx, ptr->miny, ptr->maxx, 1233 - ptr->maxy, ptr->xml_summary, ptr->sectionPaths, 1234 - ptr->sectionMD5, ptr->sectionSummary, ptr->stmt_sect, 1235 - section_id)) 1230 + ptr->maxy, ptr->xml_summary, ptr->sectionPaths, ptr->sectionMD5, 1231 + ptr->sectionSummary, ptr->stmt_sect, section_id)) 1236 1232 goto error; 1237 1233 *section_stats = 1238 1234 rl2_create_raster_statistics (ptr->sample_type, ptr->num_bands); 1239 1235 if (*section_stats == NULL) 1240 1236 goto error; 1241 1237 /* INSERTing the base-levels */ 1242 1238 if (ptr->mixedResolutions) ................................................................................ 1275 1271 /* INSERTing the tile */ 1276 1272 tile_minx = ptr->x; 1277 1273 tile_maxx = tile_minx + ptr->tilew; 1278 1274 tile_maxy = ptr->y; 1279 1275 tile_miny = tile_maxy - ptr->tileh; 1280 1276 if (!do_insert_wms_tile 1281 1277 (ptr->sqlite, blob_odd, blob_odd_sz, blob_even, blob_even_sz, 1282 - *section_id, ptr->srid, ptr->horz_res, ptr->vert_res, 1283 - ptr->tile_width, ptr->tile_height, ptr->miny, ptr->maxx, tile_minx, 1284 - tile_miny, tile_maxx, tile_maxy, NULL, ptr->no_data, ptr->stmt_tils, 1278 + *section_id, ptr->srid, ptr->horz_res, ptr->vert_res, ptr->tile_width, 1279 + ptr->tile_height, ptr->miny, ptr->maxx, tile_minx, tile_miny, 1280 + tile_maxx, tile_maxy, NULL, ptr->no_data, ptr->stmt_tils, 1285 1281 ptr->stmt_data, *section_stats)) 1286 1282 goto error; 1287 1283 blob_odd = NULL; 1288 1284 blob_even = NULL; 1289 1285 rl2_destroy_raster (raster); 1290 1286 free (ptr->rgba_tile); 1291 1287 ptr->rgba_tile = NULL; ................................................................................ 1405 1401 xxcoverage = rl2_double_quoted_sql (xcoverage); 1406 1402 sqlite3_free (xcoverage); 1407 1403 sql = 1408 1404 sqlite3_mprintf 1409 1405 ("SELECT pyramid_level, x_resolution_1_8, y_resolution_1_8, " 1410 1406 "x_resolution_1_4, y_resolution_1_4, x_resolution_1_2, y_resolution_1_2, " 1411 1407 "x_resolution_1_1, y_resolution_1_1 FROM \"%s\" " 1412 - "WHERE section_id = %s ORDER BY pyramid_level DESC", 1413 - xxcoverage, sctn); 1408 + "WHERE section_id = %s ORDER BY pyramid_level DESC", xxcoverage, 1409 + sctn); 1414 1410 } 1415 1411 else 1416 1412 { 1417 1413 /* ordinary Coverage */ 1418 1414 xcoverage = sqlite3_mprintf ("%s_levels", coverage); 1419 1415 xxcoverage = rl2_double_quoted_sql (xcoverage); 1420 1416 sqlite3_free (xcoverage); ................................................................................ 1616 1612 } 1617 1613 } 1618 1614 return rgba; 1619 1615 } 1620 1616 1621 1617 RL2_PRIVATE int 1622 1618 get_payload_from_monochrome_opaque (unsigned int width, unsigned int height, 1623 - sqlite3 * handle, double minx, 1624 - double miny, double maxx, double maxy, 1625 - int srid, unsigned char *pixels, 1626 - unsigned char format, int quality, 1627 - unsigned char **image, int *image_sz) 1619 + sqlite3 * handle, double minx, double miny, 1620 + double maxx, double maxy, int srid, 1621 + unsigned char *pixels, unsigned char format, 1622 + int quality, unsigned char **image, 1623 + int *image_sz) 1628 1624 { 1629 1625 /* input: Monochrome output: Grayscale */ 1630 1626 int ret; 1631 1627 unsigned char *p_in; 1632 1628 unsigned char *p_out; 1633 1629 unsigned char *gray = NULL; 1634 1630 unsigned int row; ................................................................................ 1664 1660 goto error; 1665 1661 } 1666 1662 else if (format == RL2_OUTPUT_FORMAT_TIFF) 1667 1663 { 1668 1664 if (srid > 0) 1669 1665 { 1670 1666 if (rl2_gray_to_geotiff 1671 - (width, height, handle, minx, miny, maxx, maxy, srid, 1672 - gray, image, image_sz) != RL2_OK) 1667 + (width, height, handle, minx, miny, maxx, maxy, srid, gray, 1668 + image, image_sz) != RL2_OK) 1673 1669 goto error; 1674 1670 } 1675 1671 else 1676 1672 { 1677 1673 if (rl2_gray_to_tiff (width, height, gray, image, image_sz) != 1678 1674 RL2_OK) 1679 1675 goto error; ................................................................................ 1833 1829 goto error; 1834 1830 } 1835 1831 else if (format == RL2_OUTPUT_FORMAT_TIFF) 1836 1832 { 1837 1833 if (srid > 0) 1838 1834 { 1839 1835 if (rl2_rgb_to_geotiff 1840 - (width, height, handle, minx, miny, maxx, maxy, 1841 - srid, rgb, image, image_sz) != RL2_OK) 1836 + (width, height, handle, minx, miny, maxx, maxy, srid, 1837 + rgb, image, image_sz) != RL2_OK) 1842 1838 goto error; 1843 1839 } 1844 1840 else 1845 1841 { 1846 - if (rl2_rgb_to_tiff 1847 - (width, height, rgb, image, image_sz) != RL2_OK) 1842 + if (rl2_rgb_to_tiff (width, height, rgb, image, image_sz) 1843 + != RL2_OK) 1848 1844 goto error; 1849 1845 } 1850 1846 } 1851 1847 else if (format == RL2_OUTPUT_FORMAT_PDF) 1852 1848 { 1853 1849 rgba = rgb_to_rgba (width, height, rgb); 1854 1850 if (rgba == NULL) ................................................................................ 1896 1892 goto error; 1897 1893 } 1898 1894 else if (format == RL2_OUTPUT_FORMAT_TIFF) 1899 1895 { 1900 1896 if (srid > 0) 1901 1897 { 1902 1898 if (rl2_gray_to_geotiff 1903 - (width, height, handle, minx, miny, maxx, maxy, 1904 - srid, gray, image, image_sz) != RL2_OK) 1899 + (width, height, handle, minx, miny, maxx, maxy, srid, 1900 + gray, image, image_sz) != RL2_OK) 1905 1901 goto error; 1906 1902 } 1907 1903 else 1908 1904 { 1909 1905 if (rl2_gray_to_tiff 1910 1906 (width, height, gray, image, image_sz) != RL2_OK) 1911 1907 goto error; ................................................................................ 2074 2070 return 0; 2075 2071 } 2076 2072 2077 2073 RL2_PRIVATE int 2078 2074 get_payload_from_grayscale_opaque (unsigned int width, unsigned int height, 2079 2075 sqlite3 * handle, double minx, double miny, 2080 2076 double maxx, double maxy, int srid, 2081 - unsigned char *pixels, 2082 - unsigned char format, int quality, 2083 - unsigned char **image, int *image_sz) 2077 + unsigned char *pixels, unsigned char format, 2078 + int quality, unsigned char **image, 2079 + int *image_sz) 2084 2080 { 2085 2081 /* input: Grayscale output: Grayscale */ 2086 2082 int ret; 2087 2083 unsigned char *rgba = NULL; 2088 2084 2089 2085 if (format == RL2_OUTPUT_FORMAT_JPEG) 2090 2086 { 2091 - if (rl2_gray_to_jpeg 2092 - (width, height, pixels, quality, image, image_sz) != RL2_OK) 2087 + if (rl2_gray_to_jpeg (width, height, pixels, quality, image, image_sz) 2088 + != RL2_OK) 2093 2089 goto error; 2094 2090 } 2095 2091 else if (format == RL2_OUTPUT_FORMAT_PNG) 2096 2092 { 2097 2093 if (rl2_gray_to_png (width, height, pixels, image, image_sz) != 2098 2094 RL2_OK) 2099 2095 goto error; ................................................................................ 2105 2101 if (rl2_gray_to_geotiff 2106 2102 (width, height, handle, minx, miny, maxx, maxy, srid, 2107 2103 pixels, image, image_sz) != RL2_OK) 2108 2104 goto error; 2109 2105 } 2110 2106 else 2111 2107 { 2112 - if (rl2_gray_to_tiff (width, height, pixels, image, image_sz) 2113 - != RL2_OK) 2108 + if (rl2_gray_to_tiff (width, height, pixels, image, image_sz) != 2109 + RL2_OK) 2114 2110 goto error; 2115 2111 } 2116 2112 } 2117 2113 else if (format == RL2_OUTPUT_FORMAT_PDF) 2118 2114 { 2119 2115 rgba = gray_to_rgba (width, height, pixels); 2120 2116 if (rgba == NULL) ................................................................................ 2196 2192 { 2197 2193 /* input: RGB output: RGB */ 2198 2194 int ret; 2199 2195 unsigned char *rgba = NULL; 2200 2196 2201 2197 if (format == RL2_OUTPUT_FORMAT_JPEG) 2202 2198 { 2203 - if (rl2_rgb_to_jpeg 2204 - (width, height, pixels, quality, image, image_sz) != RL2_OK) 2199 + if (rl2_rgb_to_jpeg (width, height, pixels, quality, image, image_sz) 2200 + != RL2_OK) 2205 2201 goto error; 2206 2202 } 2207 2203 else if (format == RL2_OUTPUT_FORMAT_PNG) 2208 2204 { 2209 2205 if (rl2_rgb_to_png (width, height, pixels, image, image_sz) != RL2_OK) 2210 2206 goto error; 2211 2207 } ................................................................................ 2216 2212 if (rl2_rgb_to_geotiff 2217 2213 (width, height, handle, minx, miny, maxx, maxy, srid, 2218 2214 pixels, image, image_sz) != RL2_OK) 2219 2215 goto error; 2220 2216 } 2221 2217 else 2222 2218 { 2223 - if (rl2_rgb_to_tiff (width, height, pixels, image, image_sz) 2224 - != RL2_OK) 2219 + if (rl2_rgb_to_tiff (width, height, pixels, image, image_sz) != 2220 + RL2_OK) 2225 2221 goto error; 2226 2222 } 2227 2223 } 2228 2224 else if (format == RL2_OUTPUT_FORMAT_PDF) 2229 2225 { 2230 2226 rgba = rgb_to_rgba (width, height, pixels); 2231 2227 if (rgba == NULL) ................................................................................ 2248 2244 } 2249 2245 2250 2246 RL2_PRIVATE int 2251 2247 get_payload_from_rgb_transparent (unsigned int width, unsigned int height, 2252 2248 unsigned char *pixels, unsigned char format, 2253 2249 int quality, unsigned char **image, 2254 2250 int *image_sz, unsigned char bg_red, 2255 - unsigned char bg_green, 2256 - unsigned char bg_blue, double opacity) 2251 + unsigned char bg_green, unsigned char bg_blue, 2252 + double opacity) 2257 2253 { 2258 2254 /* input: RGB output: RGB */ 2259 2255 unsigned char *p_in; 2260 2256 unsigned char *p_msk; 2261 2257 unsigned char *mask = NULL; 2262 2258 unsigned int row; 2263 2259 unsigned int col; ................................................................................ 2772 2768 error: 2773 2769 free (pixels); 2774 2770 return 0; 2775 2771 } 2776 2772 2777 2773 RL2_PRIVATE int 2778 2774 get_rgba_from_palette_transparent (unsigned int width, unsigned int height, 2779 - unsigned char *pixels, 2780 - rl2PalettePtr palette, unsigned char *rgba, 2781 - unsigned char bg_red, 2775 + unsigned char *pixels, rl2PalettePtr palette, 2776 + unsigned char *rgba, unsigned char bg_red, 2782 2777 unsigned char bg_green, 2783 2778 unsigned char bg_blue) 2784 2779 { 2785 2780 /* input: Palette output: Grayscale or RGB */ 2786 2781 rl2PrivPalettePtr plt = (rl2PrivPalettePtr) palette; 2787 2782 unsigned char *p_in; 2788 2783 unsigned char *p_out; ................................................................................ 2930 2925 free (pixels); 2931 2926 return 1; 2932 2927 } 2933 2928 2934 2929 RL2_PRIVATE int 2935 2930 get_rgba_from_grayscale_transparent (unsigned int width, 2936 2931 unsigned int height, 2937 - unsigned char *pixels, 2938 - unsigned char *rgba, unsigned char bg_gray) 2932 + unsigned char *pixels, unsigned char *rgba, 2933 + unsigned char bg_gray) 2939 2934 { 2940 2935 /* input: Grayscale output: Grayscale */ 2941 2936 unsigned char *p_in; 2942 2937 unsigned char *p_out; 2943 2938 unsigned int row; 2944 2939 unsigned int col; 2945 2940 ................................................................................ 3893 3888 if (mask != NULL) 3894 3889 free (mask); 3895 3890 return 1; 3896 3891 } 3897 3892 3898 3893 RL2_PRIVATE int 3899 3894 rgba_from_double (unsigned int width, unsigned int height, 3900 - double *pixels, unsigned char *mask, 3901 - rl2PrivPixelPtr no_data, unsigned char *rgba) 3895 + double *pixels, unsigned char *mask, rl2PrivPixelPtr no_data, 3896 + unsigned char *rgba) 3902 3897 { 3903 3898 /* input: DataGrid DOUBLE output: Grayscale */ 3904 3899 double *p_in; 3905 3900 unsigned char *p_out; 3906 3901 unsigned char *p_msk; 3907 3902 unsigned int row; 3908 3903 unsigned int col; ................................................................................ 4064 4059 case RL2_SAMPLE_INT16: 4065 4060 ret = 4066 4061 rgba_from_int16 (width, height, (short *) pixels, mask, no_data, 4067 4062 rgba); 4068 4063 break; 4069 4064 case RL2_SAMPLE_UINT16: 4070 4065 ret = 4071 - rgba_from_uint16 (width, height, (unsigned short *) pixels, 4072 - mask, no_data, rgba); 4066 + rgba_from_uint16 (width, height, (unsigned short *) pixels, mask, 4067 + no_data, rgba); 4073 4068 break; 4074 4069 case RL2_SAMPLE_INT32: 4075 4070 ret = 4076 4071 rgba_from_int32 (width, height, (int *) pixels, mask, no_data, 4077 4072 rgba); 4078 4073 break; 4079 4074 case RL2_SAMPLE_UINT32: ................................................................................ 4084 4079 case RL2_SAMPLE_FLOAT: 4085 4080 ret = 4086 4081 rgba_from_float (width, height, (float *) pixels, mask, no_data, 4087 4082 rgba); 4088 4083 break; 4089 4084 case RL2_SAMPLE_DOUBLE: 4090 4085 ret = 4091 - rgba_from_double (width, height, (double *) pixels, mask, 4092 - no_data, rgba); 4086 + rgba_from_double (width, height, (double *) pixels, mask, no_data, 4087 + rgba); 4093 4088 break; 4094 4089 }; 4095 4090 return ret; 4096 4091 } 4097 4092 4098 4093 RL2_PRIVATE int 4099 4094 rgba_from_multi_uint8 (unsigned int width, unsigned int height, ................................................................................ 4310 4305 rgba_from_multi_uint8 (width, height, num_bands, 4311 4306 (unsigned char *) pixels, mask, no_data, 4312 4307 rgba); 4313 4308 break; 4314 4309 case RL2_SAMPLE_UINT16: 4315 4310 ret = 4316 4311 rgba_from_multi_uint16 (width, height, num_bands, 4317 - (unsigned short *) pixels, mask, 4318 - no_data, rgba); 4312 + (unsigned short *) pixels, mask, no_data, 4313 + rgba); 4319 4314 break; 4320 4315 }; 4321 4316 return ret; 4322 4317 } 4323 4318 4324 4319 RL2_PRIVATE int 4325 4320 get_payload_from_gray_rgba_opaque (unsigned int width, unsigned int height, ................................................................................ 4362 4357 goto error; 4363 4358 } 4364 4359 else if (format == RL2_OUTPUT_FORMAT_TIFF) 4365 4360 { 4366 4361 if (srid > 0) 4367 4362 { 4368 4363 if (rl2_gray_to_geotiff 4369 - (width, height, handle, minx, miny, maxx, maxy, srid, 4370 - gray, image, image_sz) != RL2_OK) 4364 + (width, height, handle, minx, miny, maxx, maxy, srid, gray, 4365 + image, image_sz) != RL2_OK) 4371 4366 goto error; 4372 4367 } 4373 4368 else 4374 4369 { 4375 4370 if (rl2_gray_to_tiff (width, height, gray, image, image_sz) != 4376 4371 RL2_OK) 4377 4372 goto error; ................................................................................ 4469 4464 { 4470 4465 /* RGB, Opaque */ 4471 4466 int ret; 4472 4467 unsigned char *rgba = NULL; 4473 4468 4474 4469 if (format == RL2_OUTPUT_FORMAT_JPEG) 4475 4470 { 4476 - if (rl2_rgb_to_jpeg (width, height, rgb, quality, image, image_sz) 4477 - != RL2_OK) 4471 + if (rl2_rgb_to_jpeg (width, height, rgb, quality, image, image_sz) != 4472 + RL2_OK) 4478 4473 goto error; 4479 4474 } 4480 4475 else if (format == RL2_OUTPUT_FORMAT_PNG) 4481 4476 { 4482 4477 if (rl2_rgb_to_png (width, height, rgb, image, image_sz) != RL2_OK) 4483 4478 goto error; 4484 4479 } ................................................................................ 4516 4511 free (rgba); 4517 4512 return 0; 4518 4513 } 4519 4514 4520 4515 RL2_PRIVATE int 4521 4516 get_payload_from_rgb_rgba_transparent (unsigned int width, 4522 4517 unsigned int height, 4523 - unsigned char *rgb, 4524 - unsigned char *alpha, 4518 + unsigned char *rgb, unsigned char *alpha, 4525 4519 unsigned char format, int quality, 4526 4520 unsigned char **image, int *image_sz, 4527 4521 double opacity, int half_transparency) 4528 4522 { 4529 4523 /* RGB, Transparent */ 4530 4524 int ret; 4531 4525 unsigned char *p_msk;
Changes to src/rl2svg.c.
227 227 pattern = 228 228 cairo_pattern_create_linear (grad->x1, grad->y1, grad->x2, 229 229 grad->y2); 230 230 svg_apply_gradient_transformations (pattern, grad); 231 231 stop = grad->first_stop; 232 232 while (stop) 233 233 { 234 - cairo_pattern_add_color_stop_rgba (pattern, 235 - stop->offset, 236 - stop->red, 237 - stop->green, 234 + cairo_pattern_add_color_stop_rgba (pattern, stop->offset, 235 + stop->red, stop->green, 238 236 stop->blue, 239 237 stop->opacity * 240 238 style->opacity); 241 239 stop = stop->next; 242 240 } 243 241 cairo_set_source (cairo, pattern); 244 242 cairo_set_line_cap (cairo, style->stroke_linecap); ................................................................................ 259 257 pattern = 260 258 cairo_pattern_create_radial (grad->cx, grad->cy, 0.0, 261 259 grad->fx, grad->fy, grad->r); 262 260 svg_apply_gradient_transformations (pattern, grad); 263 261 stop = grad->first_stop; 264 262 while (stop) 265 263 { 266 - cairo_pattern_add_color_stop_rgba (pattern, 267 - stop->offset, 268 - stop->red, 269 - stop->green, 264 + cairo_pattern_add_color_stop_rgba (pattern, stop->offset, 265 + stop->red, stop->green, 270 266 stop->blue, 271 267 stop->opacity * 272 268 style->opacity); 273 269 stop = stop->next; 274 270 } 275 271 cairo_set_source (cairo, pattern); 276 272 cairo_set_line_cap (cairo, style->stroke_linecap); ................................................................................ 292 288 style->stroke_opacity * style->opacity); 293 289 cairo_set_line_cap (cairo, style->stroke_linecap); 294 290 cairo_set_line_join (cairo, style->stroke_linejoin); 295 291 cairo_set_miter_limit (cairo, style->stroke_miterlimit); 296 292 if (style->stroke_dashitems == 0 || style->stroke_dasharray == NULL) 297 293 cairo_set_dash (cairo, lengths, 0, 0.0); 298 294 else 299 - cairo_set_dash (cairo, style->stroke_dasharray, 300 - style->stroke_dashitems, style->stroke_dashoffset); 295 + cairo_set_dash (cairo, style->stroke_dasharray, style->stroke_dashitems, 296 + style->stroke_dashoffset); 301 297 } 302 298 303 299 static void 304 300 svg_set_brush (cairo_t * cairo, rl2PrivSvgStylePtr style) 305 301 { 306 302 /* setting up a Brush for Cairo */ 307 303 cairo_pattern_t *pattern; ................................................................................ 314 310 pattern = 315 311 cairo_pattern_create_linear (grad->x1, grad->y1, grad->x2, 316 312 grad->y2); 317 313 svg_apply_gradient_transformations (pattern, grad); 318 314 stop = grad->first_stop; 319 315 while (stop) 320 316 { 321 - cairo_pattern_add_color_stop_rgba (pattern, 322 - stop->offset, 323 - stop->red, 324 - stop->green, 317 + cairo_pattern_add_color_stop_rgba (pattern, stop->offset, 318 + stop->red, stop->green, 325 319 stop->blue, 326 320 stop->opacity * 327 321 style->opacity); 328 322 stop = stop->next; 329 323 } 330 324 cairo_set_source (cairo, pattern); 331 325 cairo_pattern_destroy (pattern); ................................................................................ 336 330 pattern = 337 331 cairo_pattern_create_radial (grad->cx, grad->cy, 0.0, 338 332 grad->fx, grad->fy, grad->r); 339 333 svg_apply_gradient_transformations (pattern, grad); 340 334 stop = grad->first_stop; 341 335 while (stop) 342 336 { 343 - cairo_pattern_add_color_stop_rgba (pattern, 344 - stop->offset, 345 - stop->red, 346 - stop->green, 337 + cairo_pattern_add_color_stop_rgba (pattern, stop->offset, 338 + stop->red, stop->green, 347 339 stop->blue, 348 340 stop->opacity * 349 341 style->opacity); 350 342 stop = stop->next; 351 343 } 352 344 cairo_set_source (cairo, pattern); 353 345 cairo_pattern_destroy (pattern); ................................................................................ 854 846 bezier = item->data; 855 847 cairo_curve_to (cairo, bezier->x1, bezier->y1, bezier->x2, 856 848 bezier->y2, bezier->x, bezier->y); 857 849 break; 858 850 case RL2_SVG_CURVE_4: 859 851 bezier = item->data; 860 852 cairo_get_current_point (cairo, &x0, &y0); 861 - cairo_curve_to (cairo, 862 - 2.0 / 3.0 * bezier->x1 + 1.0 / 3.0 * x0, 853 + cairo_curve_to (cairo, 2.0 / 3.0 * bezier->x1 + 1.0 / 3.0 * x0, 863 854 2.0 / 3.0 * bezier->y1 + 1.0 / 3.0 * y0, 864 - 2.0 / 3.0 * bezier->x1 + 865 - 1.0 / 3.0 * bezier->x2, 866 - 2.0 / 3.0 * bezier->y1 + 867 - 1.0 / 3.0 * bezier->y2, bezier->y1, bezier->y2); 855 + 2.0 / 3.0 * bezier->x1 + 1.0 / 3.0 * bezier->x2, 856 + 2.0 / 3.0 * bezier->y1 + 1.0 / 3.0 * bezier->y2, 857 + bezier->y1, bezier->y2); 868 858 break; 869 859 case RL2_SVG_ELLIPT_ARC: 870 860 arc = item->data; 871 861 cairo_get_current_point (cairo, &x0, &y0); 872 862 svg_arc_to_cairo (arc, x0, y0, &xc, &yc, &rx, &rotation, 873 863 &radii_ratio, &angle1, &angle2); 874 864 cairo_save (cairo); ................................................................................ 953 943 bezier = item->data; 954 944 cairo_curve_to (cairo, bezier->x1, bezier->y1, bezier->x2, 955 945 bezier->y2, bezier->x, bezier->y); 956 946 break; 957 947 case RL2_SVG_CURVE_4: 958 948 bezier = item->data; 959 949 cairo_get_current_point (cairo, &x0, &y0); 960 - cairo_curve_to (cairo, 961 - 2.0 / 3.0 * bezier->x1 + 1.0 / 3.0 * x0, 950 + cairo_curve_to (cairo, 2.0 / 3.0 * bezier->x1 + 1.0 / 3.0 * x0, 962 951 2.0 / 3.0 * bezier->y1 + 1.0 / 3.0 * y0, 963 - 2.0 / 3.0 * bezier->x1 + 964 - 1.0 / 3.0 * bezier->x2, 965 - 2.0 / 3.0 * bezier->y1 + 966 - 1.0 / 3.0 * bezier->y2, bezier->y1, bezier->y2); 952 + 2.0 / 3.0 * bezier->x1 + 1.0 / 3.0 * bezier->x2, 953 + 2.0 / 3.0 * bezier->y1 + 1.0 / 3.0 * bezier->y2, 954 + bezier->y1, bezier->y2); 967 955 break; 968 956 case RL2_SVG_ELLIPT_ARC: 969 957 arc = item->data; 970 958 cairo_get_current_point (cairo, &x0, &y0); 971 959 svg_arc_to_cairo (arc, x0, y0, &xc, &yc, &rx, &rotation, 972 960 &radii_ratio, &angle1, &angle2); 973 961 cairo_save (cairo);
Changes to src/rl2symbaux.c.
782 782 783 783 static int 784 784 eval_filter (rl2PrivStyleRulePtr rule, rl2VariantArrayPtr variant) 785 785 { 786 786 /* evaluating a Rule Filter */ 787 787 int i; 788 788 rl2PrivVariantArrayPtr var = (rl2PrivVariantArrayPtr) variant; 789 - if (rule->column_name == NULL) 790 - return 1; /* there is no comparison: surely true */ 791 - if (var == NULL) 792 - return 0; 789 + if (rule == NULL || var == NULL) 790 + return 1; 793 791 for (i = 0; i < var->count; i++) 794 792 { 795 793 rl2PrivVariantValuePtr val = *(var->array + i); 796 794 if (val == NULL) 797 795 return 0; 798 - if (val->column_name == NULL) 796 + if (rule->column_name == NULL || val->column_name == NULL) 799 797 return 0; 800 798 if (strcasecmp (rule->column_name, val->column_name) != 0) 801 799 continue; 802 800 switch (rule->comparison_op) 803 801 { 804 802 case RL2_COMPARISON_EQ: 805 803 return eval_filter_eq (rule, val); ................................................................................ 826 824 } 827 825 return 0; 828 826 } 829 827 830 828 RL2_DECLARE rl2VectorSymbolizerPtr 831 829 rl2_get_symbolizer_from_feature_type_style (rl2FeatureTypeStylePtr style, 832 830 double scale, 833 - rl2VariantArrayPtr variant, 834 - int *scale_forbidden) 831 + rl2VariantArrayPtr variant, int *scale_forbidden) 835 832 { 836 833 /* return the VectorSymbolizer matching a given scale/filter from a FeatureTypeStyle */ 837 834 rl2PrivVectorSymbolizerPtr symbolizer = NULL; 838 835 rl2PrivStyleRulePtr pR; 839 836 rl2PrivFeatureTypeStylePtr stl = (rl2PrivFeatureTypeStylePtr) style; 840 837 *scale_forbidden = 0; 841 838 if (stl == NULL) ................................................................................ 848 845 ; 849 846 else 850 847 { 851 848 /* skipping any invalid rule */ 852 849 pR = pR->next; 853 850 continue; 854 851 } 855 - 856 852 if (eval_filter (pR, variant)) 857 853 { 858 - *scale_forbidden = 0; 859 854 if (pR->min_scale != DBL_MAX && pR->max_scale != DBL_MAX) 860 855 { 861 856 if (scale >= pR->min_scale && scale < pR->max_scale) 862 857 symbolizer = pR->style; 863 858 } 864 859 else if (pR->min_scale != DBL_MAX) 865 860 { ................................................................................ 869 864 else if (pR->max_scale != DBL_MAX) 870 865 { 871 866 if (scale < pR->max_scale) 872 867 symbolizer = pR->style; 873 868 } 874 869 else 875 870 symbolizer = pR->style; 876 - if (symbolizer == NULL) 871 + if (symbolizer == NULL) 877 872 *scale_forbidden = 1; 878 - else 879 - return (rl2VectorSymbolizerPtr) symbolizer; 873 + return (rl2VectorSymbolizerPtr) symbolizer; 880 874 } 881 875 pR = pR->next; 882 876 } 883 877 if (stl->else_rule != NULL) 884 878 { 885 879 /* applyhing the ELSE rule */ 886 - *scale_forbidden = 0; 887 880 pR = stl->else_rule; 888 881 if (pR->min_scale != DBL_MAX && pR->max_scale != DBL_MAX) 889 882 { 890 883 if (scale >= pR->min_scale && scale < pR->max_scale) 891 884 symbolizer = pR->style; 892 885 } 893 886 else if (pR->min_scale != DBL_MAX) ................................................................................ 898 891 else if (pR->max_scale != DBL_MAX) 899 892 { 900 893 if (scale < pR->max_scale) 901 894 symbolizer = pR->style; 902 895 } 903 896 else 904 897 symbolizer = pR->style; 905 - if (symbolizer == NULL) 906 - *scale_forbidden = 1; 898 + if (symbolizer == NULL) 899 + *scale_forbidden = 1; 907 900 } 908 901 return (rl2VectorSymbolizerPtr) symbolizer; 909 902 } 910 903 911 904 RL2_DECLARE int 912 905 rl2_is_visible_style (rl2FeatureTypeStylePtr style, double scale) 913 906 { ................................................................................ 914 907 /* test visibility at a given scale/filter from a FeatureTypeStyle */ 915 908 int count = 0; 916 909 int visible; 917 910 rl2PrivStyleRulePtr pR; 918 911 rl2PrivFeatureTypeStylePtr stl = (rl2PrivFeatureTypeStylePtr) style; 919 912 if (stl == NULL) 920 913 return 0; 921 - if (stl->first_rule == NULL) 922 - { 923 - /* there are no rules: unconditional visibility */ 924 - return 1; 925 - } 926 914 927 915 pR = stl->first_rule; 928 916 while (pR != NULL) 929 917 { 930 918 if (pR->style_type == RL2_VECTOR_STYLE && pR->style != NULL) 931 919 ; 932 920 else ................................................................................ 1114 1102 { 1115 1103 /* Interpolate Color Map */ 1116 1104 *selected = 1; 1117 1105 *categorize = 0; 1118 1106 *interpolate = 1; 1119 1107 return RL2_OK; 1120 1108 } 1121 - if (stl->contrastEnhancement == RL2_CONTRAST_ENHANCEMENT_NORMALIZE 1122 - || stl->contrastEnhancement == 1123 - RL2_CONTRAST_ENHANCEMENT_HISTOGRAM 1124 - || stl->contrastEnhancement == RL2_CONTRAST_ENHANCEMENT_GAMMA) 1109 + if (stl->contrastEnhancement == RL2_CONTRAST_ENHANCEMENT_NORMALIZE || 1110 + stl->contrastEnhancement == RL2_CONTRAST_ENHANCEMENT_HISTOGRAM || 1111 + stl->contrastEnhancement == RL2_CONTRAST_ENHANCEMENT_GAMMA) 1125 1112 { 1126 1113 /* Contrast Enhancement */ 1127 1114 *selected = 1; 1128 1115 *categorize = 0; 1129 1116 *interpolate = 0; 1130 1117 return RL2_OK; 1131 1118 } ................................................................................ 1184 1171 { 1185 1172 /* return if the RasterSymbolizer has a TripleBand selection */ 1186 1173 rl2PrivRasterSymbolizerPtr stl = (rl2PrivRasterSymbolizerPtr) style; 1187 1174 if (stl == NULL) 1188 1175 return RL2_ERROR; 1189 1176 if (stl->bandSelection == NULL) 1190 1177 { 1191 - if (stl->contrastEnhancement == RL2_CONTRAST_ENHANCEMENT_NORMALIZE 1192 - || stl->contrastEnhancement == 1193 - RL2_CONTRAST_ENHANCEMENT_HISTOGRAM 1194 - || stl->contrastEnhancement == RL2_CONTRAST_ENHANCEMENT_GAMMA) 1178 + if (stl->contrastEnhancement == RL2_CONTRAST_ENHANCEMENT_NORMALIZE || 1179 + stl->contrastEnhancement == RL2_CONTRAST_ENHANCEMENT_HISTOGRAM || 1180 + stl->contrastEnhancement == RL2_CONTRAST_ENHANCEMENT_GAMMA) 1195 1181 { 1196 1182 /* Contrast Enhancement */ 1197 1183 *selected = 1; 1198 1184 return RL2_OK; 1199 1185 } 1200 1186 } 1201 1187 if (stl->bandSelection == NULL) ................................................................................ 1215 1201 { 1216 1202 /* return the RasterSymbolizer TripleBand selection */ 1217 1203 rl2PrivRasterSymbolizerPtr stl = (rl2PrivRasterSymbolizerPtr) style; 1218 1204 if (stl == NULL) 1219 1205 return RL2_ERROR; 1220 1206 if (stl->bandSelection == NULL) 1221 1207 { 1222 - if (stl->contrastEnhancement == RL2_CONTRAST_ENHANCEMENT_NORMALIZE 1223 - || stl->contrastEnhancement == 1224 - RL2_CONTRAST_ENHANCEMENT_HISTOGRAM 1225 - || stl->contrastEnhancement == RL2_CONTRAST_ENHANCEMENT_GAMMA) 1208 + if (stl->contrastEnhancement == RL2_CONTRAST_ENHANCEMENT_NORMALIZE || 1209 + stl->contrastEnhancement == RL2_CONTRAST_ENHANCEMENT_HISTOGRAM || 1210 + stl->contrastEnhancement == RL2_CONTRAST_ENHANCEMENT_GAMMA) 1226 1211 { 1227 1212 /* Contrast Enhancement */ 1228 1213 *red_band = 0; 1229 1214 *green_band = 1; 1230 1215 *blue_band = 2; 1231 1216 return RL2_OK; 1232 1217 } ................................................................................ 1257 1242 return RL2_ERROR; 1258 1243 *contrast_enhancement = stl->contrastEnhancement; 1259 1244 *gamma_value = stl->gammaValue; 1260 1245 return RL2_OK; 1261 1246 } 1262 1247 1263 1248 RL2_DECLARE int 1264 - rl2_get_raster_symbolizer_red_band_contrast_enhancement 1265 - (rl2RasterSymbolizerPtr style, unsigned char *contrast_enhancement, 1266 - double *gamma_value) 1249 +rl2_get_raster_symbolizer_red_band_contrast_enhancement (rl2RasterSymbolizerPtr 1250 + style, 1251 + unsigned char 1252 + *contrast_enhancement, 1253 + double *gamma_value) 1267 1254 { 1268 1255 /* return the RasterSymbolizer RedBand ContrastEnhancement */ 1269 1256 rl2PrivRasterSymbolizerPtr stl = (rl2PrivRasterSymbolizerPtr) style; 1270 1257 if (stl == NULL) 1271 1258 return RL2_ERROR; 1272 1259 if (stl->bandSelection == NULL) 1273 1260 return RL2_ERROR; ................................................................................ 1297 1284 *gamma_value = stl->bandSelection->greenGamma; 1298 1285 return RL2_OK; 1299 1286 } 1300 1287 return RL2_ERROR; 1301 1288 } 1302 1289 1303 1290 RL2_DECLARE int 1304 - rl2_get_raster_symbolizer_blue_band_contrast_enhancement 1305 - (rl2RasterSymbolizerPtr style, unsigned char *contrast_enhancement, 1306 - double *gamma_value) 1291 +rl2_get_raster_symbolizer_blue_band_contrast_enhancement (rl2RasterSymbolizerPtr 1292 + style, 1293 + unsigned char 1294 + *contrast_enhancement, 1295 + double *gamma_value) 1307 1296 { 1308 1297 /* return the RasterSymbolizer BlueBand ContrastEnhancement */ 1309 1298 rl2PrivRasterSymbolizerPtr stl = (rl2PrivRasterSymbolizerPtr) style; 1310 1299 if (stl == NULL) 1311 1300 return RL2_ERROR; 1312 1301 if (stl->bandSelection == NULL) 1313 1302 return RL2_ERROR; ................................................................................ 1317 1306 *gamma_value = stl->bandSelection->blueGamma; 1318 1307 return RL2_OK; 1319 1308 } 1320 1309 return RL2_ERROR; 1321 1310 } 1322 1311 1323 1312 RL2_DECLARE int 1324 - rl2_get_raster_symbolizer_gray_band_contrast_enhancement 1325 - (rl2RasterSymbolizerPtr style, unsigned char *contrast_enhancement, 1326 - double *gamma_value) 1313 +rl2_get_raster_symbolizer_gray_band_contrast_enhancement (rl2RasterSymbolizerPtr 1314 + style, 1315 + unsigned char 1316 + *contrast_enhancement, 1317 + double *gamma_value) 1327 1318 { 1328 1319 /* return the RasterSymbolizer GrayBand ContrastEnhancement */ 1329 1320 rl2PrivRasterSymbolizerPtr stl = (rl2PrivRasterSymbolizerPtr) style; 1330 1321 if (stl == NULL) 1331 1322 return RL2_ERROR; 1332 1323 if (stl->bandSelection == NULL) 1333 1324 return RL2_ERROR; ................................................................................ 1367 1358 *relief_factor = stl->reliefFactor; 1368 1359 return RL2_OK; 1369 1360 } 1370 1361 return RL2_ERROR; 1371 1362 } 1372 1363 1373 1364 RL2_DECLARE int 1374 -rl2_has_raster_symbolizer_color_map_interpolated (rl2RasterSymbolizerPtr 1375 - style, int *interpolated) 1365 +rl2_has_raster_symbolizer_color_map_interpolated (rl2RasterSymbolizerPtr style, 1366 + int *interpolated) 1376 1367 { 1377 1368 /* return if the RasterSymbolizer has an Interpolated ColorMap */ 1378 1369 rl2PrivRasterSymbolizerPtr stl = (rl2PrivRasterSymbolizerPtr) style; 1379 1370 if (stl == NULL) 1380 1371 return RL2_ERROR; 1381 1372 if (stl->interpolate != NULL) 1382 1373 *interpolated = 1; ................................................................................ 1424 1415 *blue = stl->categorize->dfltBlue; 1425 1416 return RL2_OK; 1426 1417 } 1427 1418 return RL2_ERROR; 1428 1419 } 1429 1420 1430 1421 RL2_DECLARE int 1431 -rl2_get_raster_symbolizer_color_map_category_base (rl2RasterSymbolizerPtr 1432 - style, unsigned char *red, 1422 +rl2_get_raster_symbolizer_color_map_category_base (rl2RasterSymbolizerPtr style, 1423 + unsigned char *red, 1433 1424 unsigned char *green, 1434 1425 unsigned char *blue) 1435 1426 { 1436 1427 /* return the RasterSymbolizer ColorMap Category base-color */ 1437 1428 rl2PrivRasterSymbolizerPtr stl = (rl2PrivRasterSymbolizerPtr) style; 1438 1429 if (stl == NULL) 1439 1430 return RL2_ERROR; ................................................................................ 1586 1577 /* creating a default Graphic object) */ 1587 1578 rl2PrivGraphicPtr graphic = malloc (sizeof (rl2PrivGraphic)); 1588 1579 graphic->first = NULL; 1589 1580 graphic->last = NULL; 1590 1581 graphic->opacity = 1.0; 1591 1582 graphic->size = 10.0; 1592 1583 graphic->rotation = 0.0; 1593 - graphic->anchor_point_x = 0.5; 1594 - graphic->anchor_point_y = 0.5; 1584 + graphic->anchor_point_x = 0.0; 1585 + graphic->anchor_point_y = 0.0; 1595 1586 graphic->displacement_x = 0.0; 1596 1587 graphic->displacement_y = 0.0; 1597 1588 return graphic; 1598 1589 } 1599 1590 1600 1591 RL2_PRIVATE rl2PrivStrokePtr 1601 1592 rl2_create_default_stroke () ................................................................................ 1617 1608 } 1618 1609 1619 1610 RL2_PRIVATE rl2PrivPointPlacementPtr 1620 1611 rl2_create_default_point_placement () 1621 1612 { 1622 1613 /* creating a default PointPlacement object */ 1623 1614 rl2PrivPointPlacementPtr place = malloc (sizeof (rl2PrivPointPlacement)); 1624 - place->anchor_point_x = 0.5; 1625 - place->anchor_point_y = 0.5; 1615 + place->anchor_point_x = 0.0; 1616 + place->anchor_point_y = 0.0; 1626 1617 place->displacement_x = 0.0; 1627 1618 place->displacement_y = 0.0; 1628 1619 place->rotation = 0.0; 1629 1620 return place; 1630 1621 } 1631 1622 1632 1623 RL2_PRIVATE rl2PrivLinePlacementPtr ................................................................................ 2272 2263 if (sym->stroke->graphic->first->type != RL2_EXTERNAL_GRAPHIC) 2273 2264 return NULL; 2274 2265 ext = (rl2PrivExternalGraphicPtr) (sym->stroke->graphic->first->item); 2275 2266 return ext->xlink_href; 2276 2267 } 2277 2268 2278 2269 RL2_DECLARE int 2279 - rl2_polygon_symbolizer_get_graphic_stroke_recode_count 2280 - (rl2PolygonSymbolizerPtr symbolizer, int *count) 2270 +rl2_polygon_symbolizer_get_graphic_stroke_recode_count (rl2PolygonSymbolizerPtr 2271 + symbolizer, int *count) 2281 2272 { 2282 2273 /* return how many ColorReplacement items are in a Graphic Stroke (PolygonSymbolizer) */ 2283 2274 rl2PrivPolygonSymbolizerPtr sym = (rl2PrivPolygonSymbolizerPtr) symbolizer; 2284 2275 if (sym == NULL) 2285 2276 return RL2_ERROR; 2286 2277 *count = 0; 2287 2278 if (sym->stroke != NULL) ................................................................................ 2310 2301 } 2311 2302 } 2312 2303 } 2313 2304 return RL2_OK; 2314 2305 } 2315 2306 2316 2307 RL2_DECLARE int 2317 - rl2_polygon_symbolizer_get_graphic_stroke_recode_color 2318 - (rl2PolygonSymbolizerPtr symbolizer, int index, int *color_index, 2319 - unsigned char *red, unsigned char *green, unsigned char *blue) 2308 +rl2_polygon_symbolizer_get_graphic_stroke_recode_color (rl2PolygonSymbolizerPtr 2309 + symbolizer, int index, 2310 + int *color_index, 2311 + unsigned char *red, 2312 + unsigned char *green, 2313 + unsigned char *blue) 2320 2314 { 2321 2315 /* return a ColorReplacement item from a Graphic Stroke (PolygonSymbolizer) */ 2322 2316 rl2PrivPolygonSymbolizerPtr sym = (rl2PrivPolygonSymbolizerPtr) symbolizer; 2323 2317 if (sym == NULL) 2324 2318 return RL2_ERROR; 2325 2319 if (sym->stroke != NULL) 2326 2320 { ................................................................................ 2401 2395 if (sym->stroke == NULL) 2402 2396 return RL2_ERROR; 2403 2397 *width = sym->stroke->width; 2404 2398 return RL2_OK; 2405 2399 } 2406 2400 2407 2401 RL2_DECLARE int 2408 -rl2_polygon_symbolizer_get_stroke_linejoin (rl2PolygonSymbolizerPtr 2409 - symbolizer, unsigned char *linejoin) 2402 +rl2_polygon_symbolizer_get_stroke_linejoin (rl2PolygonSymbolizerPtr symbolizer, 2403 + unsigned char *linejoin) 2410 2404 { 2411 2405 /* return the Polygon Symbolizer Stroke Linejoin mode */ 2412 2406 rl2PrivPolygonSymbolizerPtr sym = (rl2PrivPolygonSymbolizerPtr) symbolizer; 2413 2407 if (sym == NULL) 2414 2408 return RL2_ERROR; 2415 2409 if (sym->stroke == NULL) 2416 2410 return RL2_ERROR; ................................................................................ 2443 2437 if (sym->stroke == NULL) 2444 2438 return RL2_ERROR; 2445 2439 *count = sym->stroke->dash_count; 2446 2440 return RL2_OK; 2447 2441 } 2448 2442 2449 2443 RL2_DECLARE int 2450 -rl2_polygon_symbolizer_get_stroke_dash_item (rl2PolygonSymbolizerPtr 2451 - symbolizer, int index, 2452 - double *item) 2444 +rl2_polygon_symbolizer_get_stroke_dash_item (rl2PolygonSymbolizerPtr symbolizer, 2445 + int index, double *item) 2453 2446 { 2454 2447 /* return a Polygon Symbolizer Stroke Dash item */ 2455 2448 rl2PrivPolygonSymbolizerPtr sym = (rl2PrivPolygonSymbolizerPtr) symbolizer; 2456 2449 if (sym == NULL) 2457 2450 return RL2_ERROR; 2458 2451 if (sym->stroke == NULL) 2459 2452 return RL2_ERROR; ................................................................................ 3118 3111 } 3119 3112 return NULL; 3120 3113 } 3121 3114 3122 3115 RL2_DECLARE int 3123 3116 rl2_point_symbolizer_get_graphic_recode_color (rl2PointSymbolizerPtr 3124 3117 symbolizer, int index, 3125 - int repl_index, 3126 - int *color_index, 3118 + int repl_index, int *color_index, 3127 3119 unsigned char *red, 3128 3120 unsigned char *green, 3129 3121 unsigned char *blue) 3130 3122 { 3131 3123 /* return a ColorReplacement item from an External Graphic (PointSymbolizer) */ 3132 3124 int count = 0; 3133 3125 rl2PrivExternalGraphicPtr ext; ................................................................................ 3196 3188 count++; 3197 3189 item = item->next; 3198 3190 } 3199 3191 return RL2_ERROR; 3200 3192 } 3201 3193 3202 3194 RL2_DECLARE int 3203 -rl2_point_symbolizer_mark_get_well_known_type (rl2PointSymbolizerPtr 3204 - symbolizer, int index, 3205 - unsigned char *type) 3195 +rl2_point_symbolizer_mark_get_well_known_type (rl2PointSymbolizerPtr symbolizer, 3196 + int index, unsigned char *type) 3206 3197 { 3207 3198 /* return the Point Symbolizer Mark WellKnownType */ 3208 3199 int count = 0; 3209 3200 rl2PrivMarkPtr mark; 3210 3201 rl2PrivGraphicItemPtr item; 3211 3202 rl2PrivPointSymbolizerPtr sym = (rl2PrivPointSymbolizerPtr) symbolizer; 3212 3203 if (sym == NULL) ................................................................................ 3345 3336 count++; 3346 3337 item = item->next; 3347 3338 } 3348 3339 return RL2_ERROR; 3349 3340 } 3350 3341 3351 3342 RL2_DECLARE int 3352 -rl2_point_symbolizer_mark_get_stroke_linejoin (rl2PointSymbolizerPtr 3353 - symbolizer, int index, 3343 +rl2_point_symbolizer_mark_get_stroke_linejoin (rl2PointSymbolizerPtr symbolizer, 3344 + int index, 3354 3345 unsigned char *linejoin) 3355 3346 { 3356 3347 /* return the Point Symbolizer Mark Stroke Linejoin mode */ 3357 3348 int count = 0; 3358 3349 rl2PrivMarkPtr mark; 3359 3350 rl2PrivGraphicItemPtr item; 3360 3351 rl2PrivPointSymbolizerPtr sym = (rl2PrivPointSymbolizerPtr) symbolizer; ................................................................................ 3379 3370 count++; 3380 3371 item = item->next; 3381 3372 } 3382 3373 return RL2_ERROR; 3383 3374 } 3384 3375 3385 3376 RL2_DECLARE int 3386 -rl2_point_symbolizer_mark_get_stroke_linecap (rl2PointSymbolizerPtr 3387 - symbolizer, int index, 3388 - unsigned char *linecap) 3377 +rl2_point_symbolizer_mark_get_stroke_linecap (rl2PointSymbolizerPtr symbolizer, 3378 + int index, unsigned char *linecap) 3389 3379 { 3390 3380 /* return the Point Symbolizer Stroke Mark Linecap mode */ 3391 3381 int count = 0; 3392 3382 rl2PrivMarkPtr mark; 3393 3383 rl2PrivGraphicItemPtr item; 3394 3384 rl2PrivPointSymbolizerPtr sym = (rl2PrivPointSymbolizerPtr) symbolizer; 3395 3385 if (sym == NULL) ................................................................................ 3521 3511 count++; 3522 3512 itm = itm->next; 3523 3513 } 3524 3514 return RL2_ERROR; 3525 3515 } 3526 3516 3527 3517 RL2_DECLARE int 3528 -rl2_point_symbolizer_mark_has_fill (rl2PointSymbolizerPtr symbolizer, 3529 - int index, int *fill) 3518 +rl2_point_symbolizer_mark_has_fill (rl2PointSymbolizerPtr symbolizer, int index, 3519 + int *fill) 3530 3520 { 3531 3521 /* checks if a Point Symbolizer Mark has a Fill */ 3532 3522 int count = 0; 3533 3523 rl2PrivMarkPtr mark; 3534 3524 rl2PrivGraphicItemPtr item; 3535 3525 rl2PrivPointSymbolizerPtr sym = (rl2PrivPointSymbolizerPtr) symbolizer; 3536 3526 if (sym == NULL) ................................................................................ 4204 4194 if (*(var->array + index) != NULL) 4205 4195 rl2_destroy_variant_value (*(var->array + index)); 4206 4196 *(var->array + index) = val; 4207 4197 return RL2_OK; 4208 4198 } 4209 4199 4210 4200 RL2_DECLARE int 4211 -rl2_set_variant_double (rl2VariantArrayPtr variant, int index, 4212 - const char *name, double value) 4201 +rl2_set_variant_double (rl2VariantArrayPtr variant, int index, const char *name, 4202 + double value) 4213 4203 { 4214 4204 /* setting a DOUBLE VariantValue into a VariantArray object */ 4215 4205 rl2PrivVariantArrayPtr var = (rl2PrivVariantArrayPtr) variant; 4216 4206 rl2PrivVariantValuePtr val; 4217 4207 if (var == NULL) 4218 4208 return RL2_ERROR; 4219 4209 if (index >= 0 && index < var->count)
Changes to src/rl2symbolizer.c.
540 540 break; 541 541 }; 542 542 *val = value; 543 543 return 1; 544 544 } 545 545 546 546 static int 547 -parse_sld_se_color (const char *color, unsigned char *red, 548 - unsigned char *green, unsigned char *blue) 547 +parse_sld_se_color (const char *color, unsigned char *red, unsigned char *green, 548 + unsigned char *blue) 549 549 { 550 550 /* attempting to parse a #RRGGBB hexadecimal color */ 551 551 unsigned char r; 552 552 unsigned char g; 553 553 unsigned char b; 554 554 if (strlen (color) != 7) 555 555 return 0; ................................................................................ 660 660 (color, &red, &green, &blue)) 661 661 { 662 662 if (style->categorize->last == 663 663 NULL) 664 664 { 665 665 style->categorize->baseRed = 666 666 red; 667 - style->categorize->baseGreen 668 - = green; 667 + style-> 668 + categorize->baseGreen = 669 + green; 669 670 style-> 670 671 categorize->baseBlue = 671 672 blue; 672 673 } 673 674 else 674 675 { 675 676 style->categorize-> ................................................................................ 975 976 { 976 977 if (text->type == XML_TEXT_NODE) 977 978 { 978 979 const char *value = 979 980 (const char 980 981 *) (text->content); 981 982 if (value != NULL) 982 - style->brightnessOnly 983 - = atoi (value); 983 + style->brightnessOnly = 984 + atoi (value); 984 985 } 985 986 text = text->next; 986 987 } 987 988 } 988 989 if (strcmp (xmode, "ReliefFactor") == 0) 989 990 { 990 991 text = child->children; ................................................................................ 1055 1056 if (child->type == XML_ELEMENT_NODE) 1056 1057 { 1057 1058 name = (const char *) (child->name); 1058 1059 if (strcmp (name, "RasterSymbolizer") == 0) 1059 1060 { 1060 1061 rl2PrivStyleRulePtr rule = 1061 1062 rl2_create_default_style_rule (); 1062 - rl2PrivRasterSymbolizerPtr symbolizer 1063 - = 1063 + rl2PrivRasterSymbolizerPtr symbolizer = 1064 1064 rl2_create_default_raster_symbolizer 1065 1065 (); 1066 1066 if (symbolizer == NULL || rule == NULL) 1067 1067 { 1068 1068 if (symbolizer != NULL) 1069 1069 rl2_destroy_raster_symbolizer 1070 1070 (symbolizer); ................................................................................ 1372 1372 if (child->type == XML_TEXT_NODE 1373 1373 && child->content != NULL) 1374 1374 { 1375 1375 unsigned char red; 1376 1376 unsigned char green; 1377 1377 unsigned char blue; 1378 1378 if (parse_sld_se_color 1379 - ((const char *) (child->content), &red, 1380 - &green, &blue)) 1379 + ((const char *) (child->content), &red, &green, 1380 + &blue)) 1381 1381 { 1382 1382 repl->red = red; 1383 1383 repl->green = green; 1384 1384 repl->blue = blue; 1385 1385 } 1386 1386 ok_value = 1; 1387 1387 } ................................................................................ 1546 1546 &blue)) 1547 1547 { 1548 1548 mark->stroke->red = red; 1549 1549 mark->stroke->green = green; 1550 1550 mark->stroke->blue = blue; 1551 1551 } 1552 1552 } 1553 - if (strcmp (svg_name, "stroke-width") 1554 - == 0) 1553 + if (strcmp (svg_name, "stroke-width") == 1554 + 0) 1555 1555 mark->stroke->width = 1556 1556 atof ((const char *) svg_value); 1557 - if (strcmp 1558 - (svg_name, "stroke-linejoin") == 0) 1557 + if (strcmp (svg_name, "stroke-linejoin") 1558 + == 0) 1559 1559 { 1560 - if (strcmp (svg_value, "mitre") 1561 - == 0) 1560 + if (strcmp (svg_value, "mitre") == 1561 + 0) 1562 1562 mark->stroke->linejoin = 1563 1563 RL2_STROKE_LINEJOIN_MITRE; 1564 - if (strcmp (svg_value, "round") 1565 - == 0) 1564 + if (strcmp (svg_value, "round") == 1565 + 0) 1566 1566 mark->stroke->linejoin = 1567 1567 RL2_STROKE_LINEJOIN_ROUND; 1568 - if (strcmp (svg_value, "bevel") 1569 - == 0) 1568 + if (strcmp (svg_value, "bevel") == 1569 + 0) 1570 1570 mark->stroke->linejoin = 1571 1571 RL2_STROKE_LINEJOIN_BEVEL; 1572 1572 } 1573 - if (strcmp 1574 - (svg_name, "stroke-linecap") == 0) 1573 + if (strcmp (svg_name, "stroke-linecap") 1574 + == 0) 1575 1575 { 1576 - if (strcmp (svg_value, "butt") 1577 - == 0) 1576 + if (strcmp (svg_value, "butt") == 1577 + 0) 1578 1578 mark->stroke->linecap = 1579 1579 RL2_STROKE_LINECAP_BUTT; 1580 - if (strcmp (svg_value, "round") 1581 - == 0) 1580 + if (strcmp (svg_value, "round") == 1581 + 0) 1582 1582 mark->stroke->linecap = 1583 1583 RL2_STROKE_LINECAP_ROUND; 1584 1584 if (strcmp (svg_value, "square") 1585 1585 == 0) 1586 1586 mark->stroke->linecap = 1587 1587 RL2_STROKE_LINECAP_SQUARE; 1588 1588 } ................................................................................ 1825 1825 &blue)) 1826 1826 { 1827 1827 sym->stroke->red = red; 1828 1828 sym->stroke->green = green; 1829 1829 sym->stroke->blue = blue; 1830 1830 } 1831 1831 } 1832 - if (strcmp 1833 - (svg_name, "stroke-opacity") == 0) 1832 + if (strcmp (svg_name, "stroke-opacity") 1833 + == 0) 1834 1834 sym->stroke->opacity = 1835 1835 atof ((const char *) svg_value); 1836 - if (strcmp (svg_name, "stroke-width") 1837 - == 0) 1836 + if (strcmp (svg_name, "stroke-width") == 1837 + 0) 1838 1838 sym->stroke->width = 1839 1839 atof ((const char *) svg_value); 1840 - if (strcmp 1841 - (svg_name, "stroke-linejoin") == 0) 1840 + if (strcmp (svg_name, "stroke-linejoin") 1841 + == 0) 1842 1842 { 1843 - if (strcmp (svg_value, "mitre") 1844 - == 0) 1843 + if (strcmp (svg_value, "mitre") == 1844 + 0) 1845 1845 sym->stroke->linejoin = 1846 1846 RL2_STROKE_LINEJOIN_MITRE; 1847 - if (strcmp (svg_value, "round") 1848 - == 0) 1847 + if (strcmp (svg_value, "round") == 1848 + 0) 1849 1849 sym->stroke->linejoin = 1850 1850 RL2_STROKE_LINEJOIN_ROUND; 1851 - if (strcmp (svg_value, "bevel") 1852 - == 0) 1851 + if (strcmp (svg_value, "bevel") == 1852 + 0) 1853 1853 sym->stroke->linejoin = 1854 1854 RL2_STROKE_LINEJOIN_BEVEL; 1855 1855 } 1856 - if (strcmp 1857 - (svg_name, "stroke-linecap") == 0) 1856 + if (strcmp (svg_name, "stroke-linecap") 1857 + == 0) 1858 1858 { 1859 - if (strcmp (svg_value, "butt") 1860 - == 0) 1859 + if (strcmp (svg_value, "butt") == 1860 + 0) 1861 1861 sym->stroke->linecap = 1862 1862 RL2_STROKE_LINECAP_BUTT; 1863 - if (strcmp (svg_value, "round") 1864 - == 0) 1863 + if (strcmp (svg_value, "round") == 1864 + 0) 1865 1865 sym->stroke->linecap = 1866 1866 RL2_STROKE_LINECAP_ROUND; 1867 1867 if (strcmp (svg_value, "square") 1868 1868 == 0) 1869 1869 sym->stroke->linecap = 1870 1870 RL2_STROKE_LINECAP_SQUARE; 1871 1871 } ................................................................................ 2024 2024 &blue)) 2025 2025 { 2026 2026 sym->stroke->red = red; 2027 2027 sym->stroke->green = green; 2028 2028 sym->stroke->blue = blue; 2029 2029 } 2030 2030 } 2031 - if (strcmp 2032 - (svg_name, "stroke-opacity") == 0) 2031 + if (strcmp (svg_name, "stroke-opacity") 2032 + == 0) 2033 2033 sym->stroke->opacity = 2034 2034 atof ((const char *) svg_value); 2035 - if (strcmp (svg_name, "stroke-width") 2036 - == 0) 2035 + if (strcmp (svg_name, "stroke-width") == 2036 + 0) 2037 2037 sym->stroke->width = 2038 2038 atof ((const char *) svg_value); 2039 - if (strcmp 2040 - (svg_name, "stroke-linejoin") == 0) 2039 + if (strcmp (svg_name, "stroke-linejoin") 2040 + == 0) 2041 2041 { 2042 - if (strcmp (svg_value, "mitre") 2043 - == 0) 2042 + if (strcmp (svg_value, "mitre") == 2043 + 0) 2044 2044 sym->stroke->linejoin = 2045 2045 RL2_STROKE_LINEJOIN_MITRE; 2046 - if (strcmp (svg_value, "round") 2047 - == 0) 2046 + if (strcmp (svg_value, "round") == 2047 + 0) 2048 2048 sym->stroke->linejoin = 2049 2049 RL2_STROKE_LINEJOIN_ROUND; 2050 - if (strcmp (svg_value, "bevel") 2051 - == 0) 2050 + if (strcmp (svg_value, "bevel") == 2051 + 0) 2052 2052 sym->stroke->linejoin = 2053 2053 RL2_STROKE_LINEJOIN_BEVEL; 2054 2054 } 2055 - if (strcmp 2056 - (svg_name, "stroke-linecap") == 0) 2055 + if (strcmp (svg_name, "stroke-linecap") 2056 + == 0) 2057 2057 { 2058 - if (strcmp (svg_value, "butt") 2059 - == 0) 2058 + if (strcmp (svg_value, "butt") == 2059 + 0) 2060 2060 sym->stroke->linecap = 2061 2061 RL2_STROKE_LINECAP_BUTT; 2062 - if (strcmp (svg_value, "round") 2063 - == 0) 2062 + if (strcmp (svg_value, "round") == 2063 + 0) 2064 2064 sym->stroke->linecap = 2065 2065 RL2_STROKE_LINECAP_ROUND; 2066 2066 if (strcmp (svg_value, "square") 2067 2067 == 0) 2068 2068 sym->stroke->linecap = 2069 2069 RL2_STROKE_LINECAP_SQUARE; 2070 2070 } ................................................................................ 2166 2166 &blue)) 2167 2167 { 2168 2168 sym->fill->red = red; 2169 2169 sym->fill->green = green; 2170 2170 sym->fill->blue = blue; 2171 2171 } 2172 2172 } 2173 - if (strcmp (svg_name, "fill-opacity") 2174 - == 0) 2173 + if (strcmp (svg_name, "fill-opacity") == 2174 + 0) 2175 2175 sym->fill->opacity = 2176 2176 atof (svg_value); 2177 2177 } 2178 2178 } 2179 2179 child = child->next; 2180 2180 } 2181 2181 } ................................................................................ 2617 2617 const char *svg_value; 2618 2618 if (!svg_parameter_name 2619 2619 (child, &svg_name, &svg_value)) 2620 2620 { 2621 2621 child = child->next; 2622 2622 continue; 2623 2623 } 2624 - if (strcmp (svg_name, "font-family") 2625 - == 0) 2624 + if (strcmp (svg_name, "font-family") == 2625 + 0) 2626 2626 { 2627 2627 if (sym->font_families_count < 2628 2628 RL2_MAX_FONT_FAMILIES) 2629 2629 { 2630 2630 int idx = 2631 2631 sym->font_families_count++; 2632 2632 int len = ................................................................................ 2650 2650 sym->font_style = 2651 2651 RL2_FONT_STYLE_ITALIC; 2652 2652 if (strcasecmp 2653 2653 (svg_value, "oblique") == 0) 2654 2654 sym->font_style = 2655 2655 RL2_FONT_STYLE_OBLIQUE; 2656 2656 } 2657 - if (strcmp (svg_name, "font-weight") 2658 - == 0) 2657 + if (strcmp (svg_name, "font-weight") == 2658 + 0) 2659 2659 { 2660 2660 if (strcasecmp 2661 2661 (svg_value, "normal") == 0) 2662 2662 sym->font_weight = 2663 2663 RL2_FONT_WEIGHT_NORMAL; 2664 - if (strcasecmp 2665 - (svg_value, "bold") == 0) 2664 + if (strcasecmp (svg_value, "bold") 2665 + == 0) 2666 2666 sym->font_weight = 2667 2667 RL2_FONT_WEIGHT_BOLD; 2668 2668 } 2669 2669 if (strcmp (svg_name, "font-size") == 0) 2670 2670 sym->font_size = atof (svg_value); 2671 2671 } 2672 2672 } ................................................................................ 3016 3016 { 3017 3017 if (node->type == XML_ELEMENT_NODE) 3018 3018 { 3019 3019 const char *name = (const char *) (node->name); 3020 3020 if (strcmp (name, "LabelPlacement") == 0) 3021 3021 { 3022 3022 xmlNodePtr child = node->children; 3023 - if (sym->label_placement_type == 3024 - RL2_LABEL_PLACEMENT_POINT 3023 + if (sym->label_placement_type == RL2_LABEL_PLACEMENT_POINT 3025 3024 && sym->label_placement != NULL) 3026 3025 rl2_destroy_point_placement ((rl2PrivPointPlacementPtr) (sym->label_placement)); 3027 - if (sym->label_placement_type == 3028 - RL2_LABEL_PLACEMENT_LINE 3026 + if (sym->label_placement_type == RL2_LABEL_PLACEMENT_LINE 3029 3027 && sym->label_placement != NULL) 3030 3028 rl2_destroy_line_placement ((rl2PrivLinePlacementPtr) 3031 3029 (sym->label_placement)); 3032 3030 sym->label_placement_type = RL2_LABEL_PLACEMENT_UNKNOWN; 3033 3031 sym->label_placement = NULL; 3034 3032 while (child) 3035 3033 { ................................................................................ 3995 3993 rl2PrivTextSymbolizerPtr text; 3996 3994 3997 3995 pR = style->first_rule; 3998 3996 while (pR != NULL) 3999 3997 { 4000 3998 /* counting max column names */ 4001 3999 if (pR->column_name != NULL) 4002 - count++; 4003 - if (pR->style_type == RL2_VECTOR_STYLE && pR->style != NULL) 4004 4000 { 4005 - pV = (rl2PrivVectorSymbolizerPtr) (pR->style); 4006 - item = pV->first; 4007 - while (item != NULL) 4001 + count++; 4002 + if (pR->style_type == RL2_VECTOR_STYLE && pR->style != NULL) 4008 4003 { 4009 - if (item->symbolizer_type == RL2_TEXT_SYMBOLIZER 4010 - && item->symbolizer != NULL) 4004 + pV = (rl2PrivVectorSymbolizerPtr) (pR->style); 4005 + item = pV->first; 4006 + while (item != NULL) 4011 4007 { 4012 - text = 4013 - (rl2PrivTextSymbolizerPtr) (item->symbolizer); 4014 - if (text->label != NULL) 4015 - count++; 4008 + if (item->symbolizer_type == RL2_TEXT_SYMBOLIZER 4009 + && item->symbolizer != NULL) 4010 + { 4011 + text = 4012 + (rl2PrivTextSymbolizerPtr) 4013 + (item->symbolizer); 4014 + if (text->label != NULL) 4015 + count++; 4016 + } 4017 + item = item->next; 4016 4018 } 4017 - item = item->next; 4018 4019 } 4019 4020 } 4020 4021 pR = pR->next; 4021 4022 } 4022 4023 pR = style->else_rule; 4023 4024 if (pR != NULL) 4024 4025 { 4025 4026 if (pR->column_name != NULL) 4026 - count++; 4027 - if (pR->style_type == RL2_VECTOR_STYLE && pR->style != NULL) 4028 4027 { 4029 - pV = (rl2PrivVectorSymbolizerPtr) (pR->style); 4030 - item = pV->first; 4031 - while (item != NULL) 4028 + count++; 4029 + if (pR->style_type == RL2_VECTOR_STYLE && pR->style != NULL) 4032 4030 { 4033 - if (item->symbolizer_type == RL2_TEXT_SYMBOLIZER 4034 - && item->symbolizer != NULL) 4031 + pV = (rl2PrivVectorSymbolizerPtr) (pR->style); 4032 + item = pV->first; 4033 + while (item != NULL) 4035 4034 { 4036 - text = 4037 - (rl2PrivTextSymbolizerPtr) (item->symbolizer); 4038 - if (text->label != NULL) 4039 - count++; 4035 + if (item->symbolizer_type == RL2_TEXT_SYMBOLIZER 4036 + && item->symbolizer != NULL) 4037 + { 4038 + text = 4039 + (rl2PrivTextSymbolizerPtr) 4040 + (item->symbolizer); 4041 + if (text->label != NULL) 4042 + count++; 4043 + } 4044 + item = item->next; 4040 4045 } 4041 - item = item->next; 4042 4046 } 4043 4047 } 4044 4048 } 4045 4049 if (count == 0) 4046 4050 return; 4047 4051 4048 4052 strings = malloc (sizeof (char *) * count); ................................................................................ 4055 4059 if (pR->column_name != NULL) 4056 4060 { 4057 4061 len = strlen (pR->column_name); 4058 4062 *(strings + i) = malloc (len + 1); 4059 4063 strcpy (*(strings + i), pR->column_name); 4060 4064 *(dupl + i) = 'N'; 4061 4065 i++; 4062 - } 4063 - if (pR->style_type == RL2_VECTOR_STYLE && pR->style != NULL) 4064 - { 4065 - pV = (rl2PrivVectorSymbolizerPtr) (pR->style); 4066 - item = pV->first; 4067 - while (item != NULL) 4066 + if (pR->style_type == RL2_VECTOR_STYLE && pR->style != NULL) 4068 4067 { 4069 - if (item->symbolizer_type == RL2_TEXT_SYMBOLIZER 4070 - && item->symbolizer != NULL) 4068 + pV = (rl2PrivVectorSymbolizerPtr) (pR->style); 4069 + item = pV->first; 4070 + while (item != NULL) 4071 4071 { 4072 - text = 4073 - (rl2PrivTextSymbolizerPtr) (item->symbolizer); 4074 - if (text->label != NULL) 4072 + if (item->symbolizer_type == RL2_TEXT_SYMBOLIZER 4073 + && item->symbolizer != NULL) 4075 4074 { 4076 - len = strlen (text->label); 4077 - *(strings + i) = malloc (len + 1); 4078 - strcpy (*(strings + i), text->label); 4079 - *(dupl + i) = 'N'; 4080 - i++; 4075 + text = 4076 + (rl2PrivTextSymbolizerPtr) 4077 + (item->symbolizer); 4078 + if (text->label != NULL) 4079 + { 4080 + len = strlen (text->label); 4081 + *(strings + i) = malloc (len + 1); 4082 + strcpy (*(strings + i), text->label); 4083 + *(dupl + i) = 'N'; 4084 + i++; 4085 + } 4081 4086 } 4087 + item = item->next; 4082 4088 } 4083 - item = item->next; 4084 4089 } 4085 4090 } 4086 4091 pR = pR->next; 4087 4092 } 4088 4093 pR = style->else_rule; 4089 4094 if (pR != NULL) 4090 4095 { ................................................................................ 4091 4096 if (pR->column_name != NULL) 4092 4097 { 4093 4098 len = strlen (pR->column_name); 4094 4099 *(strings + i) = malloc (len + 1); 4095 4100 strcpy (*(strings + i), pR->column_name); 4096 4101 *(dupl + i) = 'N'; 4097 4102 i++; 4098 - } 4099 - if (pR->style_type == RL2_VECTOR_STYLE && pR->style != NULL) 4100 - { 4101 - pV = (rl2PrivVectorSymbolizerPtr) (pR->style); 4102 - item = pV->first; 4103 - while (item != NULL) 4103 + if (pR->style_type == RL2_VECTOR_STYLE && pR->style != NULL) 4104 4104 { 4105 - if (item->symbolizer_type == RL2_TEXT_SYMBOLIZER 4106 - && item->symbolizer != NULL) 4105 + pV = (rl2PrivVectorSymbolizerPtr) (pR->style); 4106 + item = pV->first; 4107 + while (item != NULL) 4107 4108 { 4108 - text = 4109 - (rl2PrivTextSymbolizerPtr) (item->symbolizer); 4110 - if (text->label != NULL) 4109 + if (item->symbolizer_type == RL2_TEXT_SYMBOLIZER 4110 + && item->symbolizer != NULL) 4111 4111 { 4112 - len = strlen (text->label); 4113 - *(strings + i) = malloc (len + 1); 4114 - strcpy (*(strings + i), text->label); 4115 - *(dupl + i) = 'N'; 4116 - i++; 4112 + text = 4113 + (rl2PrivTextSymbolizerPtr) 4114 + (item->symbolizer); 4115 + if (text->label != NULL) 4116 + { 4117 + len = strlen (text->label); 4118 + *(strings + i) = malloc (len + 1); 4119 + strcpy (*(strings + i), text->label); 4120 + *(dupl + i) = 'N'; 4121 + i++; 4122 + } 4117 4123 } 4124 + item = item->next; 4118 4125 } 4119 - item = item->next; 4120 4126 } 4121 4127 } 4122 4128 } 4123 4129 4124 4130 for (i = 0; i < count; i++) 4125 4131 { 4126 4132 /* identifying all duplicates */ ................................................................................ 4428 4434 lyr->raster_stats = NULL; 4429 4435 } 4430 4436 return ptr; 4431 4437 } 4432 4438 4433 4439 static int 4434 4440 rl2_group_renderer_set_raster (rl2PrivGroupRendererPtr group, int index, 4435 - const char *layer_name, 4436 - rl2CoveragePtr coverage, 4441 + const char *layer_name, rl2CoveragePtr coverage, 4437 4442 sqlite3_int64 style_id, 4438 4443 rl2RasterSymbolizerPtr symbolizer, 4439 4444 rl2RasterStatisticsPtr stats) 4440 4445 { 4441 4446 /* setting up one of the Layers within the Group */ 4442 4447 int len; 4443 4448 rl2PrivGroupRendererLayerPtr lyr;
Changes to src/rl2tiff.c.
1415 1415 { 1416 1416 /* attempting to recover badly formatted TIFFs */ 1417 1417 origin->planarConfig = PLANARCONFIG_CONTIG; 1418 1418 } 1419 1419 else 1420 1420 origin->planarConfig = value16; 1421 1421 1422 - if (origin->bitsPerSample == 16 1423 - && origin->sampleFormat == SAMPLEFORMAT_UINT 1422 + if (origin->bitsPerSample == 16 && origin->sampleFormat == SAMPLEFORMAT_UINT 1424 1423 && origin->planarConfig == PLANARCONFIG_SEPARATE) 1425 1424 ; 1426 1425 else if (origin->bitsPerSample == 8 1427 1426 && origin->sampleFormat == SAMPLEFORMAT_UINT 1428 1427 && origin->planarConfig == PLANARCONFIG_SEPARATE) 1429 1428 ; 1430 1429 else if (origin->planarConfig != PLANARCONFIG_CONTIG) ................................................................................ 2733 2732 if (tiff_max_x < startCol) 2734 2733 skip = 1; 2735 2734 if (skip) 2736 2735 { 2737 2736 /* skipping any not required tile */ 2738 2737 continue; 2739 2738 } 2740 - if (TIFFReadTile (origin->in, tiff_tile, tile_x, tile_y, 0, 0) 2741 - < 0) 2739 + if (TIFFReadTile (origin->in, tiff_tile, tile_x, tile_y, 0, 0) < 2740 + 0) 2742 2741 goto error; 2743 2742 if (convert != RL2_CONVERT_NO) 2744 2743 { 2745 2744 /* applying some format conversion */ 2746 2745 copy_convert_tile (origin, tiff_tile, pixels, startRow, 2747 2746 startCol, width, height, tile_y, 2748 2747 tile_x, convert); ................................................................................ 2763 2762 { 2764 2763 case RL2_SAMPLE_INT8: 2765 2764 p_in_8 = (char *) tiff_tile; 2766 2765 p_in_8 += y * origin->tileWidth; 2767 2766 p_in_8 += x; 2768 2767 p_out_8 = (char *) pixels; 2769 2768 p_out_8 += 2770 - ((dest_y - startRow) * width) + 2771 - (dest_x - startCol); 2769 + ((dest_y - startRow) * width) + (dest_x - 2770 + startCol); 2772 2771 break; 2773 2772 case RL2_SAMPLE_UINT8: 2774 2773 p_in_u8 = (unsigned char *) tiff_tile; 2775 2774 p_in_u8 += y * origin->tileWidth * num_bands; 2776 2775 p_in_u8 += x * num_bands; 2777 2776 p_out_u8 = (unsigned char *) pixels; 2778 2777 p_out_u8 += ................................................................................ 2782 2781 break; 2783 2782 case RL2_SAMPLE_INT16: 2784 2783 p_in_16 = (short *) tiff_tile; 2785 2784 p_in_16 += y * origin->tileWidth; 2786 2785 p_in_16 += x; 2787 2786 p_out_16 = (short *) pixels; 2788 2787 p_out_16 += 2789 - ((dest_y - startRow) * width) + 2790 - (dest_x - startCol); 2788 + ((dest_y - startRow) * width) + (dest_x - 2789 + startCol); 2791 2790 break; 2792 2791 case RL2_SAMPLE_UINT16: 2793 2792 p_in_u16 = (unsigned short *) tiff_tile; 2794 2793 p_in_u16 += y * origin->tileWidth * num_bands; 2795 2794 p_in_u16 += x * num_bands; 2796 2795 p_out_u16 = (unsigned short *) pixels; 2797 2796 p_out_u16 += ................................................................................ 2801 2800 break; 2802 2801 case RL2_SAMPLE_INT32: 2803 2802 p_in_32 = (int *) tiff_tile; 2804 2803 p_in_32 += y * origin->tileWidth; 2805 2804 p_in_32 += x; 2806 2805 p_out_32 = (int *) pixels; 2807 2806 p_out_32 += 2808 - ((dest_y - startRow) * width) + 2809 - (dest_x - startCol); 2807 + ((dest_y - startRow) * width) + (dest_x - 2808 + startCol); 2810 2809 break; 2811 2810 case RL2_SAMPLE_UINT32: 2812 2811 p_in_u32 = (unsigned int *) tiff_tile; 2813 2812 p_in_u32 += y * origin->tileWidth; 2814 2813 p_in_u32 += x; 2815 2814 p_out_u32 = (unsigned int *) pixels; 2816 2815 p_out_u32 += 2817 - ((dest_y - startRow) * width) + 2818 - (dest_x - startCol); 2816 + ((dest_y - startRow) * width) + (dest_x - 2817 + startCol); 2819 2818 break; 2820 2819 case RL2_SAMPLE_FLOAT: 2821 2820 p_in_flt = (float *) tiff_tile; 2822 2821 p_in_flt += y * origin->tileWidth; 2823 2822 p_in_flt += x; 2824 2823 p_out_flt = (float *) pixels; 2825 2824 p_out_flt += 2826 - ((dest_y - startRow) * width) + 2827 - (dest_x - startCol); 2825 + ((dest_y - startRow) * width) + (dest_x - 2826 + startCol); 2828 2827 break; 2829 2828 case RL2_SAMPLE_DOUBLE: 2830 2829 p_in_dbl = (double *) tiff_tile; 2831 2830 p_in_dbl += y * origin->tileWidth; 2832 2831 p_in_dbl += x; 2833 2832 p_out_dbl = (double *) pixels; 2834 2833 p_out_dbl += 2835 - ((dest_y - startRow) * width) + 2836 - (dest_x - startCol); 2834 + ((dest_y - startRow) * width) + (dest_x - 2835 + startCol); 2837 2836 break; 2838 2837 }; 2839 2838 for (bnd = 0; bnd < num_bands; bnd++) 2840 2839 { 2841 2840 switch (sample_type) 2842 2841 { 2843 2842 case RL2_SAMPLE_INT8: ................................................................................ 3642 3641 p_in_u16 = (unsigned short *) tiff_tile; 3643 3642 p_in_u16 += y * origin->tileWidth; 3644 3643 p_in_u16 += x; 3645 3644 p_out_u16 = (unsigned short *) pixels; 3646 3645 p_out_u16 += 3647 3646 ((dest_y - 3648 3647 startRow) * width * num_bands) + 3649 - ((dest_x - 3650 - startCol) * num_bands) + band; 3648 + ((dest_x - startCol) * num_bands) + 3649 + band; 3651 3650 *p_out_u16 = *p_in_u16; 3652 3651 } 3653 3652 if (sample_type == RL2_SAMPLE_UINT8) 3654 3653 { 3655 3654 p_in_u8 = (unsigned char *) tiff_tile; 3656 3655 p_in_u8 += y * origin->tileWidth; 3657 3656 p_in_u8 += x; 3658 3657 p_out_u8 = (unsigned char *) pixels; 3659 3658 p_out_u8 += 3660 3659 ((dest_y - 3661 3660 startRow) * width * num_bands) + 3662 - ((dest_x - 3663 - startCol) * num_bands) + band; 3661 + ((dest_x - startCol) * num_bands) + 3662 + band; 3664 3663 *p_out_u8 = *p_in_u8; 3665 3664 } 3666 3665 } 3667 3666 } 3668 3667 } 3669 3668 } 3670 3669 } ................................................................................ 3674 3673 error: 3675 3674 if (tiff_tile != NULL) 3676 3675 free (tiff_tile); 3677 3676 return RL2_ERROR; 3678 3677 } 3679 3678 3680 3679 static int 3681 -read_raw_separate_scanlines (rl2PrivTiffOriginPtr origin, 3682 - unsigned short width, unsigned short height, 3683 - unsigned char sample_type, 3680 +read_raw_separate_scanlines (rl2PrivTiffOriginPtr origin, unsigned short width, 3681 + unsigned short height, unsigned char sample_type, 3684 3682 unsigned char num_bands, unsigned int startRow, 3685 3683 unsigned int startCol, void *pixels) 3686 3684 { 3687 3685 /* reading TIFF raw strips - separate planes */ 3688 3686 uint32 line_no; 3689 3687 uint32 x; 3690 3688 uint32 y; ................................................................................ 4174 4172 goto error; 4175 4173 } 4176 4174 else 4177 4175 { 4178 4176 /* contiguous planar configuration */ 4179 4177 if (origin->bitsPerSample <= 8 4180 4178 && origin->sampleFormat == SAMPLEFORMAT_UINT 4181 - && (origin->samplesPerPixel == 1 4182 - || origin->samplesPerPixel == 3) 4179 + && (origin->samplesPerPixel == 1 || origin->samplesPerPixel == 3) 4183 4180 && (pixel_type == RL2_PIXEL_MONOCHROME 4184 4181 || pixel_type == RL2_PIXEL_PALETTE 4185 4182 || pixel_type == RL2_PIXEL_GRAYSCALE 4186 4183 || pixel_type == RL2_PIXEL_RGB)) 4187 4184 { 4188 4185 /* using the TIFF RGBA methods */ 4189 4186 if (origin->isTiled) ................................................................................ 4205 4202 if (origin->isTiled) 4206 4203 ret = 4207 4204 read_raw_tiles (origin, width, height, sample_type, 4208 4205 num_bands, startRow, startCol, 4209 4206 bufPixels); 4210 4207 else 4211 4208 ret = 4212 - read_raw_scanlines (origin, width, height, 4213 - sample_type, num_bands, startRow, 4214 - startCol, bufPixels); 4209 + read_raw_scanlines (origin, width, height, sample_type, 4210 + num_bands, startRow, startCol, 4211 + bufPixels); 4215 4212 if (ret != RL2_OK) 4216 4213 goto error; 4217 4214 } 4218 4215 } 4219 4216 4220 4217 *pixels = bufPixels; 4221 4218 *pixels_sz = bufPixelsSz; ................................................................................ 4385 4382 } 4386 4383 } 4387 4384 } 4388 4385 4389 4386 /* attempting to create the tile */ 4390 4387 if (read_from_tiff 4391 4388 (origin, coverage->tileWidth, coverage->tileHeight, 4392 - coverage->sampleType, coverage->pixelType, coverage->nBands, 4393 - startRow, startCol, &pixels, &pixels_sz, palette) != RL2_OK) 4389 + coverage->sampleType, coverage->pixelType, coverage->nBands, startRow, 4390 + startCol, &pixels, &pixels_sz, palette) != RL2_OK) 4394 4391 goto error; 4395 4392 if (startCol + coverage->tileWidth > origin->width) 4396 4393 unused_width = (startCol + coverage->tileWidth) - origin->width; 4397 4394 if (startRow + coverage->tileHeight > origin->height) 4398 4395 unused_height = (startRow + coverage->tileHeight) - origin->height; 4399 4396 if (unused_width || unused_height) 4400 4397 { ................................................................................ 5081 5078 error: 5082 5079 return 0; 5083 5080 } 5084 5081 5085 5082 RL2_DECLARE rl2TiffDestinationPtr 5086 5083 rl2_create_tiff_destination (const char *path, unsigned int width, 5087 5084 unsigned int height, unsigned char sample_type, 5088 - unsigned char pixel_type, 5089 - unsigned char num_bands, rl2PalettePtr plt, 5090 - unsigned char tiff_compression, int tiled, 5091 - unsigned int tile_size) 5085 + unsigned char pixel_type, unsigned char num_bands, 5086 + rl2PalettePtr plt, unsigned char tiff_compression, 5087 + int tiled, unsigned int tile_size) 5092 5088 { 5093 5089 /* attempting to create a file-based TIFF destination (no georeferencing) */ 5094 5090 rl2PrivTiffDestinationPtr destination = NULL; 5095 5091 if (!check_color_model 5096 5092 (sample_type, pixel_type, num_bands, plt, tiff_compression)) 5097 5093 { 5098 5094 fprintf (stderr, "RL2-TIFF writer: unsupported pixel format\n"); ................................................................................ 5764 5760 } 5765 5761 if (TIFFWriteScanline (tiff->out, tiff->tiffBuffer, row, 0) < 0) 5766 5762 return 0; 5767 5763 return 1; 5768 5764 } 5769 5765 5770 5766 static int 5771 -tiff_write_strip_gray (rl2PrivTiffDestinationPtr tiff, 5772 - rl2PrivRasterPtr raster, unsigned int row) 5767 +tiff_write_strip_gray (rl2PrivTiffDestinationPtr tiff, rl2PrivRasterPtr raster, 5768 + unsigned int row) 5773 5769 { 5774 5770 /* writing a TIFF Grayscale scanline */ 5775 5771 unsigned int x; 5776 5772 unsigned char *p_in = raster->rasterBuffer; 5777 5773 unsigned char *p_out = tiff->tiffBuffer; 5778 5774 5779 5775 for (x = 0; x < raster->width; x++) ................................................................................ 6167 6163 0) 6168 6164 return 0; 6169 6165 } 6170 6166 return 1; 6171 6167 } 6172 6168 6173 6169 static int 6174 -tiff_write_tile_rgb_u8 (rl2PrivTiffDestinationPtr tiff, 6175 - rl2PrivRasterPtr raster, unsigned int row, 6176 - unsigned int col) 6170 +tiff_write_tile_rgb_u8 (rl2PrivTiffDestinationPtr tiff, rl2PrivRasterPtr raster, 6171 + unsigned int row, unsigned int col) 6177 6172 { 6178 6173 /* writing a TIFF RGB tile - UINT8 */ 6179 6174 unsigned int y; 6180 6175 unsigned int x; 6181 6176 unsigned char *p_in = raster->rasterBuffer; 6182 6177 unsigned char *p_out = tiff->tiffBuffer; 6183 6178 ................................................................................ 6544 6539 && rst->nBands == destination->samplesPerPixel 6545 6540 && destination->tileWidth == rst->width 6546 6541 && destination->tileHeight == rst->height) 6547 6542 ret = 6548 6543 tiff_write_tile_multiband16 (destination, rst, startRow, startCol); 6549 6544 else if (destination->sampleFormat == SAMPLEFORMAT_UINT 6550 6545 && destination->samplesPerPixel == 1 6551 - && destination->photometric < 2 6552 - && destination->bitsPerSample == 8 6546 + && destination->photometric < 2 && destination->bitsPerSample == 8 6553 6547 && rst->sampleType == RL2_SAMPLE_UINT8 6554 6548 && rst->pixelType == RL2_PIXEL_GRAYSCALE && rst->nBands == 1 6555 6549 && destination->tileWidth == rst->width 6556 6550 && destination->tileHeight == rst->height) 6557 6551 ret = tiff_write_tile_gray (destination, rst, startRow, startCol); 6558 6552 else if (destination->sampleFormat == SAMPLEFORMAT_UINT 6559 6553 && destination->samplesPerPixel == 1 ................................................................................ 6664 6658 return RL2_ERROR; 6665 6659 if (destination->tfw_path == NULL) 6666 6660 return RL2_ERROR; 6667 6661 6668 6662 tfw = fopen (destination->tfw_path, "w"); 6669 6663 if (tfw == NULL) 6670 6664 { 6671 - fprintf (stderr, 6672 - "RL2-TIFF writer: unable to open Worldfile \"%s\"\n", 6665 + fprintf (stderr, "RL2-TIFF writer: unable to open Worldfile \"%s\"\n", 6673 6666 destination->tfw_path); 6674 6667 return RL2_ERROR; 6675 6668 } 6676 6669 fprintf (tfw, " %1.16f\n", destination->hResolution); 6677 6670 fprintf (tfw, " 0.0\n"); 6678 6671 fprintf (tfw, " 0.0\n"); 6679 6672 fprintf (tfw, " -%1.16f\n", destination->vResolution); ................................................................................ 6982 6975 TIFFClose (in); 6983 6976 if (tiff_buffer != NULL) 6984 6977 free (tiff_buffer); 6985 6978 return RL2_ERROR; 6986 6979 } 6987 6980 6988 6981 static int 6989 -rgb_tiff_common (TIFF * out, const unsigned char *buffer, 6990 - unsigned short width, unsigned short height) 6982 +rgb_tiff_common (TIFF * out, const unsigned char *buffer, unsigned short width, 6983 + unsigned short height) 6991 6984 { 6992 6985 /* common implementation of RGB TIFF export */ 6993 6986 tsize_t buf_size; 6994 6987 void *tiff_buffer = NULL; 6995 6988 int y; 6996 6989 int x; 6997 6990 const unsigned char *p_in; ................................................................................ 7265 7258 return 0; 7266 7259 } 7267 7260 7268 7261 static int 7269 7262 output_palette_tiff (const unsigned char *buffer, 7270 7263 unsigned short width, 7271 7264 unsigned short height, unsigned char *red, 7272 - unsigned char *green, unsigned char *blue, 7273 - int max_palette, unsigned char **blob, int *blob_size) 7265 + unsigned char *green, unsigned char *blue, int max_palette, 7266 + unsigned char **blob, int *blob_size) 7274 7267 { 7275 7268 /* generating a PALETTE TIFF - actual work */ 7276 7269 struct memfile clientdata; 7277 7270 TIFF *out = (TIFF *) 0; 7278 7271 7279 7272 /* suppressing TIFF warnings */ 7280 7273 TIFFSetWarningHandler (NULL); ................................................................................ 7514 7507 tiff_size)) 7515 7508 return RL2_ERROR; 7516 7509 } 7517 7510 return RL2_OK; 7518 7511 } 7519 7512 7520 7513 static int 7521 -gray_tiff_common (TIFF * out, const unsigned char *buffer, 7522 - unsigned short width, unsigned short height) 7514 +gray_tiff_common (TIFF * out, const unsigned char *buffer, unsigned short width, 7515 + unsigned short height) 7523 7516 { 7524 7517 /* common implementation of Grayscale TIFF export */ 7525 7518 tsize_t buf_size; 7526 7519 void *tiff_buffer = NULL; 7527 7520 int y; 7528 7521 int x; 7529 7522 const unsigned char *p_in; ................................................................................ 7994 7987 xml = 7995 7988 sqlite3_mprintf ("%s<Compression>%u</Compression>", prev, 7996 7989 org->compression); 7997 7990 sqlite3_free (prev); 7998 7991 prev = xml; 7999 7992 if (org->sampleFormat == SAMPLEFORMAT_UINT) 8000 7993 xml = 8001 - sqlite3_mprintf 8002 - ("%s<SampleFormat>unsigned integer</SampleFormat>", prev); 7994 + sqlite3_mprintf ("%s<SampleFormat>unsigned integer</SampleFormat>", 7995 + prev); 8003 7996 else if (org->sampleFormat == SAMPLEFORMAT_INT) 8004 7997 xml = 8005 7998 sqlite3_mprintf ("%s<SampleFormat>signed integer</SampleFormat>", 8006 7999 prev); 8007 8000 else if (org->sampleFormat == SAMPLEFORMAT_IEEEFP) 8008 8001 xml = 8009 8002 sqlite3_mprintf ("%s<SampleFormat>floating point</SampleFormat>", ................................................................................ 8089 8082 xml = sqlite3_mprintf ("%s</BoundingBox>", prev); 8090 8083 sqlite3_free (prev); 8091 8084 prev = xml; 8092 8085 xml = sqlite3_mprintf ("%s<Extent>", prev); 8093 8086 sqlite3_free (prev); 8094 8087 prev = xml; 8095 8088 xml = 8096 - sqlite3_mprintf 8097 - ("%s<HorizontalExtent>%1.10f</HorizontalExtent>", prev, 8098 - org->maxX - org->minX); 8089 + sqlite3_mprintf ("%s<HorizontalExtent>%1.10f</HorizontalExtent>", 8090 + prev, org->maxX - org->minX); 8099 8091 sqlite3_free (prev); 8100 8092 prev = xml; 8101 8093 xml = 8102 8094 sqlite3_mprintf ("%s<VerticalExtent>%1.10f</VerticalExtent>", 8103 8095 prev, org->maxY - org->minY); 8104 8096 sqlite3_free (prev); 8105 8097 prev = xml;
Changes to src/rl2webp.c.
154 154 else 155 155 return RL2_ERROR; 156 156 } 157 157 return RL2_OK; 158 158 } 159 159 160 160 static void 161 -copy_pixels (unsigned char *out, const unsigned char *in, int width, 162 - int height, int num_bands) 161 +copy_pixels (unsigned char *out, const unsigned char *in, int width, int height, 162 + int num_bands) 163 163 { 164 164 /* copying pixels */ 165 165 int x; 166 166 int y; 167 167 int ib; 168 168 const unsigned char *p_in = in; 169 169 unsigned char *p_out = out; ................................................................................ 293 293 RL2_ERROR) 294 294 return RL2_ERROR; 295 295 if (quality > 100) 296 296 quality = 100; 297 297 if (quality < 0) 298 298 quality = 75; 299 299 size = 300 - WebPEncodeRGBA (rgba, rst->width, rst->height, rst->width * 4, 301 - quality, &output); 300 + WebPEncodeRGBA (rgba, rst->width, rst->height, rst->width * 4, quality, 301 + &output); 302 302 free (rgba); 303 303 if (size == 0) 304 304 return RL2_ERROR; 305 305 *webp = output; 306 306 *webp_size = size; 307 307 return RL2_OK; 308 308 }
Changes to src/rl2wms.c.
534 534 while (pI != NULL) 535 535 { 536 536 /* populating the array */ 537 537 *(cache->SortedByUrl + pos) = pI; 538 538 pos++; 539 539 pI = pI->Next; 540 540 } 541 - qsort (cache->SortedByUrl, cache->NumCachedItems, 542 - sizeof (wmsCachedItemPtr), compare_url); 541 + qsort (cache->SortedByUrl, cache->NumCachedItems, sizeof (wmsCachedItemPtr), 542 + compare_url); 543 543 } 544 544 545 545 static void 546 546 wmsCacheSqueeze (wmsCachePtr cache, int limit) 547 547 { 548 548 /* squeezing the WMS Cache */ 549 549 int i; ................................................................................ 592 592 cache->LastCapab->Next = ptr; 593 593 cache->LastCapab = ptr; 594 594 cache->TotalDownload += (double) size; 595 595 } 596 596 597 597 598 598 static void 599 -wmsAddCachedItem (wmsCachePtr cache, const char *url, 600 - const unsigned char *item, int size, const char *image_format) 599 +wmsAddCachedItem (wmsCachePtr cache, const char *url, const unsigned char *item, 600 + int size, const char *image_format) 601 601 { 602 602 /* adding a new WMS Cached Item */ 603 603 wmsCachedItemPtr ptr; 604 604 if (cache == NULL) 605 605 return; 606 606 if (cache->CurrentSize + size > cache->MaxSize) 607 607 wmsCacheSqueeze (cache, cache->MaxSize - size); ................................................................................ 1099 1099 ptr->first = arg; 1100 1100 if (ptr->last != NULL) 1101 1101 ptr->last->next = arg; 1102 1102 ptr->last = arg; 1103 1103 } 1104 1104 1105 1105 static void 1106 -parse_pattern_bbox (const char *value, double *minx, double *miny, 1107 - double *maxx, double *maxy) 1106 +parse_pattern_bbox (const char *value, double *minx, double *miny, double *maxx, 1107 + double *maxy) 1108 1108 { 1109 1109 /* parsing a BBOX arg [minx,miny,maxx,maxy] */ 1110 1110 int step = 0; 1111 1111 const char *p_start = value; 1112 1112 const char *p_end = value; 1113 1113 *minx = DBL_MAX; 1114 1114 *miny = DBL_MAX; ................................................................................ 2027 2027 outbuf.WriteOffset -= 2; 2028 2028 continue; 2029 2029 } 2030 2030 if (cdata) 2031 2031 { 2032 2032 /* masking XML special characters */ 2033 2033 if (*(p_in + i) == '<') 2034 - wmsMemBufferAppend (&outbuf, 2035 - (const unsigned char *) "<", 4); 2034 + wmsMemBufferAppend (&outbuf, (const unsigned char *) "<", 2035 + 4); 2036 2036 else if (*(p_in + i) == '>') 2037 - wmsMemBufferAppend (&outbuf, 2038 - (const unsigned char *) ">", 4); 2037 + wmsMemBufferAppend (&outbuf, (const unsigned char *) ">", 2038 + 4); 2039 2039 else if (*(p_in + i) == '&') 2040 2040 wmsMemBufferAppend (&outbuf, 2041 2041 (const unsigned char *) "&", 5); 2042 2042 else if (*(p_in + i) == '>') 2043 2043 wmsMemBufferAppend (&outbuf, 2044 2044 (const unsigned char *) """, 6); 2045 2045 else ................................................................................ 2119 2119 outbuf.WriteOffset -= 2; 2120 2120 continue; 2121 2121 } 2122 2122 if (cdata) 2123 2123 { 2124 2124 /* masking XML special characters */ 2125 2125 if (*(p_in + i) == '<') 2126 - wmsMemBufferAppend (&outbuf, 2127 - (const unsigned char *) "<", 4); 2126 + wmsMemBufferAppend (&outbuf, (const unsigned char *) "<", 2127 + 4); 2128 2128 else if (*(p_in + i) == '>') 2129 - wmsMemBufferAppend (&outbuf, 2130 - (const unsigned char *) ">", 4); 2129 + wmsMemBufferAppend (&outbuf, (const unsigned char *) ">", 2130 + 4); 2131 2131 else if (*(p_in + i) == '&') 2132 2132 wmsMemBufferAppend (&outbuf, 2133 2133 (const unsigned char *) "&", 5); 2134 2134 else if (*(p_in + i) == '>') 2135 2135 wmsMemBufferAppend (&outbuf, 2136 2136 (const unsigned char *) """, 6); 2137 2137 else ................................................................................ 2705 2705 if (child_node != NULL) 2706 2706 { 2707 2707 if (child_node->type == XML_TEXT_NODE) 2708 2708 *contact_organization = 2709 2709 (const char *) (child_node->content); 2710 2710 } 2711 2711 } 2712 - if (strcmp ((const char *) (cur_node->name), "ContactPerson") 2713 - == 0) 2712 + if (strcmp ((const char *) (cur_node->name), "ContactPerson") == 2713 + 0) 2714 2714 { 2715 2715 child_node = cur_node->children; 2716 2716 if (child_node != NULL) 2717 2717 { 2718 2718 if (child_node->type == XML_TEXT_NODE) 2719 2719 *contact_person = 2720 2720 (const char *) (child_node->content); ................................................................................ 2752 2752 child_node = cur_node->children; 2753 2753 if (child_node != NULL) 2754 2754 { 2755 2755 if (child_node->type == XML_TEXT_NODE) 2756 2756 *city = (const char *) (child_node->content); 2757 2757 } 2758 2758 } 2759 - if (strcmp 2760 - ((const char *) (cur_node->name), "StateOrProvince") == 0) 2759 + if (strcmp ((const char *) (cur_node->name), "StateOrProvince") 2760 + == 0) 2761 2761 { 2762 2762 child_node = cur_node->children; 2763 2763 if (child_node != NULL) 2764 2764 { 2765 2765 if (child_node->type == XML_TEXT_NODE) 2766 2766 *state_province = 2767 2767 (const char *) (child_node->content); ................................................................................ 2805 2805 xmlNodePtr cur_node = NULL; 2806 2806 xmlNodePtr child_node = NULL; 2807 2807 2808 2808 for (cur_node = node; cur_node; cur_node = cur_node->next) 2809 2809 { 2810 2810 if (cur_node->type == XML_ELEMENT_NODE) 2811 2811 { 2812 - if (strcmp 2813 - ((const char *) (cur_node->name), "ContactPosition") == 0) 2812 + if (strcmp ((const char *) (cur_node->name), "ContactPosition") 2813 + == 0) 2814 2814 { 2815 2815 child_node = cur_node->children; 2816 2816 if (child_node != NULL) 2817 2817 { 2818 2818 if (child_node->type == XML_TEXT_NODE) 2819 2819 *contact_position = 2820 2820 (const char *) (child_node->content); ................................................................................ 2934 2934 ((const char *) (cur_node->name), 2935 2935 "ContactInformation") == 0) 2936 2936 parse_wms_contact_information (cur_node->children, 2937 2937 &contact_person, 2938 2938 &contact_organization, 2939 2939 &contact_position, 2940 2940 &postal_address, &city, 2941 - &state_province, 2942 - &post_code, &country, 2943 - &voice_telephone, 2941 + &state_province, &post_code, 2942 + &country, &voice_telephone, 2944 2943 &fax_telephone, 2945 2944 &email_address); 2946 2945 if (strcmp ((const char *) (cur_node->name), "Fees") == 0) 2947 2946 { 2948 2947 child_node = cur_node->children; 2949 2948 if (child_node != NULL) 2950 2949 { ................................................................................ 3246 3245 cap->GetMapURLGet = NULL; 3247 3246 } 3248 3247 p = (const char 3249 3248 *) (text->content); 3250 3249 len = strlen (p); 3251 3250 cap->GetTileServiceURLGet = 3252 3251 malloc (len + 1); 3253 - strcpy 3254 - (cap->GetTileServiceURLGet, 3255 - p); 3252 + strcpy (cap->GetTileServiceURLGet, 3253 + p); 3256 3254 } 3257 3255 } 3258 3256 } 3259 3257 attr = attr->next; 3260 3258 } 3261 3259 } 3262 3260 } ................................................................................ 3286 3284 if (strcmp 3287 3285 ((const char *) (attr->name), 3288 3286 "href") == 0) 3289 3287 { 3290 3288 xmlNodePtr text = attr->children; 3291 3289 if (text->type == XML_TEXT_NODE) 3292 3290 { 3293 - if (cap->GetTileServiceURLPost 3294 - != NULL) 3291 + if (cap->GetTileServiceURLPost != 3292 + NULL) 3295 3293 { 3296 3294 free (cap-> 3297 3295 GetTileServiceURLPost); 3298 3296 cap->GetTileServiceURLPost = 3299 3297 NULL; 3300 3298 } 3301 3299 p = (const char ................................................................................ 3351 3349 NULL; 3352 3350 } 3353 3351 p = (const char 3354 3352 *) (text->content); 3355 3353 len = strlen (p); 3356 3354 cap->GetFeatureInfoURLGet = 3357 3355 malloc (len + 1); 3358 - strcpy 3359 - (cap->GetFeatureInfoURLGet, 3360 - p); 3356 + strcpy (cap->GetFeatureInfoURLGet, 3357 + p); 3361 3358 } 3362 3359 } 3363 3360 } 3364 3361 attr = attr->next; 3365 3362 } 3366 3363 } 3367 3364 } ................................................................................ 3391 3388 if (strcmp 3392 3389 ((const char *) (attr->name), 3393 3390 "href") == 0) 3394 3391 { 3395 3392 xmlNodePtr text = attr->children; 3396 3393 if (text->type == XML_TEXT_NODE) 3397 3394 { 3398 - if (cap->GetFeatureInfoURLPost 3399 - != NULL) 3395 + if (cap->GetFeatureInfoURLPost != 3396 + NULL) 3400 3397 { 3401 3398 free (cap->GetFeatureInfoURLPost); 3402 3399 cap->GetFeatureInfoURLPost = 3403 3400 NULL; 3404 3401 } 3405 3402 p = (const char 3406 3403 *) (text->content); ................................................................................ 3585 3582 ok = 1; 3586 3583 if (strcmp 3587 3584 (format, 3588 3585 "application/vnd.ogc.gml") == 0) 3589 3586 ok = 1; 3590 3587 if (strcmp 3591 3588 (format, 3592 - "application/vnd.ogc.gml/3.1.1") 3593 - == 0) 3589 + "application/vnd.ogc.gml/3.1.1") == 3590 + 0) 3594 3591 ok = 1; 3595 3592 if (ok) 3596 3593 { 3597 3594 int len = strlen (format); 3598 3595 cap->GmlMimeType = 3599 3596 malloc (len + 1); 3600 3597 strcpy (cap->GmlMimeType, format); ................................................................................ 4380 4377 4381 4378 for (; cur_node; cur_node = cur_node->next) 4382 4379 { 4383 4380 if (cur_node->type == XML_ELEMENT_NODE) 4384 4381 { 4385 4382 if (strcmp ((const char *) (cur_node->name), "Service") == 0) 4386 4383 parse_tile_service_info (cur_node, cap); 4387 - if (strcmp ((const char *) (cur_node->name), "TiledPatterns") 4388 - == 0) 4384 + if (strcmp ((const char *) (cur_node->name), "TiledPatterns") == 4385 + 0) 4389 4386 parse_tiled_patterns (cur_node, cap); 4390 4387 } 4391 4388 } 4392 4389 } 4393 4390 4394 4391 static void 4395 4392 parse_wms_get_tile_service (wmsCapabilitiesPtr capabilities, const char *buf) ................................................................................ 4762 4759 else 4763 4760 return; 4764 4761 4765 4762 for (; cur_node; cur_node = cur_node->next) 4766 4763 { 4767 4764 if (cur_node->type == XML_ELEMENT_NODE) 4768 4765 { 4769 - if (strcmp ((const char *) (cur_node->name), "featureMember") 4770 - == 0) 4766 + if (strcmp ((const char *) (cur_node->name), "featureMember") == 4767 + 0) 4771 4768 parse_wms_feature_member (cur_node->children, coll); 4772 4769 } 4773 4770 } 4774 4771 } 4775 4772 4776 4773 static wmsFeatureCollectionPtr 4777 4774 parse_wms_feature_collection (const char *buf) ................................................................................ 4832 4829 } 4833 4830 } 4834 4831 4835 4832 return coll; 4836 4833 } 4837 4834 4838 4835 static int 4839 -query_TileService (rl2WmsCachePtr cache_handle, 4840 - wmsCapabilitiesPtr capabilities, const char *proxy) 4836 +query_TileService (rl2WmsCachePtr cache_handle, wmsCapabilitiesPtr capabilities, 4837 + const char *proxy) 4841 4838 { 4842 4839 /* attempting to get and parse a WMS GetTileService request */ 4843 4840 CURL *curl = NULL; 4844 4841 CURLcode res; 4845 4842 wmsMemBuffer headerBuf; 4846 4843 wmsMemBuffer bodyBuf; 4847 4844 int http_status; ................................................................................ 6948 6945 attr = attr->next; 6949 6946 } 6950 6947 return NULL; 6951 6948 } 6952 6949 6953 6950 RL2_DECLARE int 6954 6951 get_wms_feature_attribute_blob_geometry (rl2WmsFeatureMemberPtr handle, 6955 - int index, 6956 - const unsigned char **blob, 6952 + int index, const unsigned char **blob, 6957 6953 int *blob_size) 6958 6954 { 6959 6955 /* attempting to get the Nth FeatureAttribute (Geometry) from some WMS-FeatureMember object */ 6960 6956 int count = 0; 6961 6957 wmsFeatureAttributePtr attr; 6962 6958 wmsFeatureMemberPtr ptr = (wmsFeatureMemberPtr) handle; 6963 6959 if (ptr == NULL) ................................................................................ 7067 7063 /* "?" marker not declared */ 7068 7064 if (swap_xy) 7069 7065 request = 7070 7066 sqlite3_mprintf ("%s?SERVICE=WMS&REQUEST=GetMap&VERSION=%s" 7071 7067 "&LAYERS=%s&%s=%s&BBOX=%1.6f,%1.6f,%1.6f,%1.6f" 7072 7068 "&WIDTH=%d&HEIGHT=%d&STYLES=%s&FORMAT=%s" 7073 7069 "&TRANSPARENT=%s&BGCOLOR=0xFFFFFF", url, 7074 - version, layer, crs_prefix, crs, miny, 7075 - minx, maxy, maxx, width, height, style, 7076 - format, (opaque == 0) ? "TRUE" : "FALSE"); 7070 + version, layer, crs_prefix, crs, miny, minx, 7071 + maxy, maxx, width, height, style, format, 7072 + (opaque == 0) ? "TRUE" : "FALSE"); 7077 7073 else 7078 7074 request = 7079 7075 sqlite3_mprintf ("%s?SERVICE=WMS&REQUEST=GetMap&VERSION=%s" 7080 7076 "&LAYERS=%s&%s=%s&BBOX=%1.6f,%1.6f,%1.6f,%1.6f" 7081 7077 "&WIDTH=%d&HEIGHT=%d&STYLES=%s&FORMAT=%s" 7082 7078 "&TRANSPARENT=%s&BGCOLOR=0xFFFFFF", url, 7083 - version, layer, crs_prefix, crs, minx, 7084 - miny, maxx, maxy, width, height, style, 7085 - format, (opaque == 0) ? "TRUE" : "FALSE"); 7079 + version, layer, crs_prefix, crs, minx, miny, 7080 + maxx, maxy, width, height, style, format, 7081 + (opaque == 0) ? "TRUE" : "FALSE"); 7086 7082 } 7087 7083 else 7088 7084 { 7089 7085 /* "?" marker already defined */ 7090 7086 if (swap_xy) 7091 7087 request = 7092 7088 sqlite3_mprintf ("%sSERVICE=WMS&REQUEST=GetMap&VERSION=%s" 7093 7089 "&LAYERS=%s&%s=%s&BBOX=%1.6f,%1.6f,%1.6f,%1.6f" 7094 7090 "&WIDTH=%d&HEIGHT=%d&STYLES=%s&FORMAT=%s" 7095 7091 "&TRANSPARENT=%s&BGCOLOR=0xFFFFFF", url, 7096 - version, layer, crs_prefix, crs, miny, 7097 - minx, maxy, maxx, width, height, style, 7098 - format, (opaque == 0) ? "TRUE" : "FALSE"); 7092 + version, layer, crs_prefix, crs, miny, minx, 7093 + maxy, maxx, width, height, style, format, 7094 + (opaque == 0) ? "TRUE" : "FALSE"); 7099 7095 else 7100 7096 request = 7101 7097 sqlite3_mprintf ("%sSERVICE=WMS&REQUEST=GetMap&VERSION=%s" 7102 7098 "&LAYERS=%s&%s=%s&BBOX=%1.6f,%1.6f,%1.6f,%1.6f" 7103 7099 "&WIDTH=%d&HEIGHT=%d&STYLES=%s&FORMAT=%s" 7104 7100 "&TRANSPARENT=%s&BGCOLOR=0xFFFFFF", url, 7105 - version, layer, crs_prefix, crs, minx, 7106 - miny, maxx, maxy, width, height, style, 7107 - format, (opaque == 0) ? "TRUE" : "FALSE"); 7101 + version, layer, crs_prefix, crs, minx, miny, 7102 + maxx, maxy, width, height, style, format, 7103 + (opaque == 0) ? "TRUE" : "FALSE"); 7108 7104 } 7109 7105 7110 7106 if (cache != NULL) 7111 7107 { 7112 7108 /* checks if it's already stored into the WMS Cache */ 7113 7109 wmsCachedItemPtr cachedItem = getWmsCachedItem (cache, request); 7114 7110 if (cachedItem != NULL) ................................................................................ 7275 7271 double maxx, double maxy, int width, int height, 7276 7272 const char *style, const char *format, int opaque, 7277 7273 int from_cache, char **err_msg) 7278 7274 { 7279 7275 /* attempting to execute a WMS GepMap request [method POST] */ 7280 7276 7281 7277 /* not yet implemented: just a stupid placeholder always returning NULL */ 7282 - if (cache_handle == NULL || url == NULL || proxy == NULL 7283 - || version == NULL || layer == NULL || crs == NULL) 7278 + if (cache_handle == NULL || url == NULL || proxy == NULL || version == NULL 7279 + || layer == NULL || crs == NULL) 7284 7280 return NULL; 7285 - if (minx == miny || maxx == maxy || width == height 7286 - || opaque == from_cache || width == swap_xy) 7281 + if (minx == miny || maxx == maxy || width == height || opaque == from_cache 7282 + || width == swap_xy) 7287 7283 return NULL; 7288 7284 if (style == NULL || format == NULL || err_msg == NULL) 7289 7285 return NULL; 7290 7286 return NULL; 7291 7287 } 7292 7288 7293 7289 RL2_DECLARE unsigned char * ................................................................................ 7533 7529 { 7534 7530 if (swap_xy) 7535 7531 request = 7536 7532 sqlite3_mprintf 7537 7533 ("%s?SERVICE=WMS&REQUEST=GetFeatureInfo&VERSION=%s&LAYERS=%s" 7538 7534 "&QUERY_LAYERS=%s&%s=%s&BBOX=%1.6f,%1.6f,%1.6f,%1.6f" 7539 7535 "&WIDTH=%d&HEIGHT=%d&X=%d&Y=%d&INFO_FORMAT=%s" 7540 - "&FEATURE_COUNT=50", url, version, layer, layer, 7541 - crs_prefix, crs, miny, minx, maxy, maxx, width, height, 7542 - mouse_x, mouse_y, format); 7536 + "&FEATURE_COUNT=50", url, version, layer, layer, crs_prefix, 7537 + crs, miny, minx, maxy, maxx, width, height, mouse_x, 7538 + mouse_y, format); 7543 7539 else 7544 7540 request = 7545 7541 sqlite3_mprintf 7546 7542 ("%s?SERVICE=WMS&REQUEST=GetFeatureInfo&VERSION=%s&LAYERS=%s" 7547 7543 "&QUERY_LAYERS=%s&%s=%s&BBOX=%1.6f,%1.6f,%1.6f,%1.6f" 7548 7544 "&WIDTH=%d&HEIGHT=%d&X=%d&Y=%d&INFO_FORMAT=%s" 7549 - "&FEATURE_COUNT=50", url, version, layer, layer, 7550 - crs_prefix, crs, minx, miny, maxx, maxy, width, height, 7551 - mouse_x, mouse_y, format); 7545 + "&FEATURE_COUNT=50", url, version, layer, layer, crs_prefix, 7546 + crs, minx, miny, maxx, maxy, width, height, mouse_x, 7547 + mouse_y, format); 7552 7548 } 7553 7549 else 7554 7550 { 7555 7551 if (swap_xy) 7556 7552 request = 7557 7553 sqlite3_mprintf 7558 7554 ("%sSERVICE=WMS&REQUEST=GetFeatureInfo&VERSION=%s&LAYERS=%s" 7559 7555 "&QUERY_LAYERS=%s&%s=%s&BBOX=%1.6f,%1.6f,%1.6f,%1.6f" 7560 7556 "&WIDTH=%d&HEIGHT=%d&X=%d&Y=%d&INFO_FORMAT=%s" 7561 - "&FEATURE_COUNT=50", url, version, layer, layer, 7562 - crs_prefix, crs, miny, minx, maxy, maxx, width, height, 7563 - mouse_x, mouse_y, format); 7557 + "&FEATURE_COUNT=50", url, version, layer, layer, crs_prefix, 7558 + crs, miny, minx, maxy, maxx, width, height, mouse_x, 7559 + mouse_y, format); 7564 7560 else 7565 7561 request = 7566 7562 sqlite3_mprintf 7567 7563 ("%sSERVICE=WMS&REQUEST=GetFeatureInfo&VERSION=%s&LAYERS=%s" 7568 7564 "&QUERY_LAYERS=%s&%s=%s&BBOX=%1.6f,%1.6f,%1.6f,%1.6f" 7569 7565 "&WIDTH=%d&HEIGHT=%d&X=%d&Y=%d&INFO_FORMAT=%s" 7570 - "&FEATURE_COUNT=50", url, version, layer, layer, 7571 - crs_prefix, crs, minx, miny, maxx, maxy, width, height, 7572 - mouse_x, mouse_y, format); 7566 + "&FEATURE_COUNT=50", url, version, layer, layer, crs_prefix, 7567 + crs, minx, miny, maxx, maxy, width, height, mouse_x, 7568 + mouse_y, format); 7573 7569 } 7574 7570 7575 7571 curl = curl_easy_init (); 7576 7572 if (curl) 7577 7573 { 7578 7574 /* setting the URL */ 7579 7575 curl_easy_setopt (curl, CURLOPT_URL, request); ................................................................................ 7703 7699 return (rl2WmsFeatureCollectionPtr) coll; 7704 7700 } 7705 7701 7706 7702 RL2_DECLARE rl2WmsFeatureCollectionPtr 7707 7703 do_wms_GetFeatureInfo_post (const char *url, const char *proxy, 7708 7704 const char *version, const char *format, 7709 7705 const char *layer, const char *crs, int swap_xy, 7710 - double minx, double miny, double maxx, 7711 - double maxy, int width, int height, int mouse_x, 7712 - int mouse_y, char **err_msg) 7706 + double minx, double miny, double maxx, double maxy, 7707 + int width, int height, int mouse_x, int mouse_y, 7708 + char **err_msg) 7713 7709 { 7714 7710 /* attempting to execute a WMS GepFeatureInfo request [method POST] */ 7715 7711 7716 7712 /* not yet implemented: just a stupid placeholder always returning NULL */ 7717 7713 if (url == NULL || proxy == NULL || version == NULL || format == NULL 7718 7714 || layer == NULL || crs == NULL) 7719 7715 return NULL;
Changes to test/Makefile.in.
1 -# Makefile.in generated by automake 1.15 from Makefile.am. 1 +# Makefile.in generated by automake 1.14.1 from Makefile.am. 2 2 # @configure_input@ 3 3 4 -# Copyright (C) 1994-2014 Free Software Foundation, Inc. 4 +# Copyright (C) 1994-2013 Free Software Foundation, Inc. 5 5 6 6 # This Makefile.in is free software; the Free Software Foundation 7 7 # gives unlimited permission to copy and/or distribute it, 8 8 # with or without modifications, as long as this notice is preserved. 9 9 10 10 # This program is distributed in the hope that it will be useful, 11 11 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 12 12 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 13 13 # PARTICULAR PURPOSE. 14 14 15 15 @SET_MAKE@ 16 16 VPATH = @srcdir@ 17 -am__is_gnu_make = { \ 18 - if test -z '$(MAKELEVEL)'; then \ 19 - false; \ 20 - elif test -n '$(MAKE_HOST)'; then \ 21 - true; \ 22 - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ 23 - true; \ 24 - else \ 25 - false; \ 26 - fi; \ 27 -} 17 +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 28 18 am__make_running_with_option = \ 29 19 case $${target_option-} in \ 30 20 ?) ;; \ 31 21 *) echo "am__make_running_with_option: internal error: invalid" \ 32 22 "target option '$${target_option-}' specified" >&2; \ 33 23 exit 1;; \ 34 24 esac; \ ................................................................................ 110 100 test_map_orbetello$(EXEEXT) test_raster_symbolizer$(EXEEXT) \ 111 101 test_svg$(EXEEXT) test_raw$(EXEEXT) test_openjpeg$(EXEEXT) \ 112 102 test_line_symbolizer$(EXEEXT) test_polygon_symbolizer$(EXEEXT) \ 113 103 test_point_symbolizer$(EXEEXT) test_text_symbolizer$(EXEEXT) \ 114 104 test_vectors$(EXEEXT) test_font$(EXEEXT) \ 115 105 test_copy_rastercov$(EXEEXT) 116 106 subdir = test 107 +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ 108 + $(top_srcdir)/depcomp $(top_srcdir)/test-driver 117 109 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 118 110 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ 119 111 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ 120 112 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ 121 113 $(top_srcdir)/configure.ac 122 114 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 123 115 $(ACLOCAL_M4) 124 -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 125 116 mkinstalldirs = $(install_sh) -d 126 117 CONFIG_HEADER = $(top_builddir)/config.h 127 118 CONFIG_CLEAN_FILES = 128 119 CONFIG_CLEAN_VPATH_FILES = 129 120 check_sql_stmt_SOURCES = check_sql_stmt.c 130 121 check_sql_stmt_OBJECTS = check_sql_stmt.$(OBJEXT) 131 122 check_sql_stmt_LDADD = $(LDADD) ................................................................................ 627 618 am__test_logs1 = $(TESTS:=.log) 628 619 am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) 629 620 TEST_LOGS = $(am__test_logs2:.test.log=.log) 630 621 TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver 631 622 TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ 632 623 $(TEST_LOG_FLAGS) 633 624 DIST_SUBDIRS = $(SUBDIRS) 634 -am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ 635 - $(top_srcdir)/test-driver 636 625 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 637 626 am__relativize = \ 638 627 dir0=`pwd`; \ 639 628 sed_first='s,^\([^/]*\)/.*$$,\1,'; \ 640 629 sed_rest='s,^[^/]*/*,,'; \ 641 630 sed_last='s,^.*/\([^/]*\)$$,\1,'; \ 642 631 sed_butlast='s,/*[^/]*$$,,'; \ ................................................................................ 896 885 && { if test -f $@; then exit 0; else break; fi; }; \ 897 886 exit 1;; \ 898 887 esac; \ 899 888 done; \ 900 889 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/Makefile'; \ 901 890 $(am__cd) $(top_srcdir) && \ 902 891 $(AUTOMAKE) --gnu test/Makefile 892 +.PRECIOUS: Makefile 903 893 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 904 894 @case '$?' in \ 905 895 *config.status*) \ 906 896 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ 907 897 *) \ 908 898 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ 909 899 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ ................................................................................ 1401 1391 if $(am__make_dryrun); then :; else \ 1402 1392 rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ 1403 1393 fi; \ 1404 1394 fi; \ 1405 1395 if test -n "$$am__remaking_logs"; then \ 1406 1396 echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ 1407 1397 "recursion detected" >&2; \ 1408 - elif test -n "$$redo_logs"; then \ 1398 + else \ 1409 1399 am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ 1410 1400 fi; \ 1411 1401 if $(am__make_dryrun); then :; else \ 1412 1402 st=0; \ 1413 1403 errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ 1414 1404 for i in $$redo_bases; do \ 1415 1405 test -f $$i.trs && test -r $$i.trs \ ................................................................................ 2152 2142 install-pdf install-pdf-am install-ps install-ps-am \ 2153 2143 install-strip installcheck installcheck-am installdirs \ 2154 2144 installdirs-am maintainer-clean maintainer-clean-generic \ 2155 2145 mostlyclean mostlyclean-compile mostlyclean-generic \ 2156 2146 mostlyclean-libtool pdf pdf-am ps ps-am recheck tags tags-am \ 2157 2147 uninstall uninstall-am 2158 2148 2159 -.PRECIOUS: Makefile 2160 - 2161 2149 2162 2150 # Tell versions [3.59,3.63) of GNU make to not export all variables. 2163 2151 # Otherwise a system limit (for SysV at least) may be exceeded. 2164 2152 .NOEXPORT:
Changes to test/sql_stmt_security_tests/Makefile.in.
1 -# Makefile.in generated by automake 1.15 from Makefile.am. 1 +# Makefile.in generated by automake 1.14.1 from Makefile.am. 2 2 # @configure_input@ 3 3 4 -# Copyright (C) 1994-2014 Free Software Foundation, Inc. 4 +# Copyright (C) 1994-2013 Free Software Foundation, Inc. 5 5 6 6 # This Makefile.in is free software; the Free Software Foundation 7 7 # gives unlimited permission to copy and/or distribute it, 8 8 # with or without modifications, as long as this notice is preserved. 9 9 10 10 # This program is distributed in the hope that it will be useful, 11 11 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 12 12 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 13 13 # PARTICULAR PURPOSE. 14 14 15 15 @SET_MAKE@ 16 16 VPATH = @srcdir@ 17 -am__is_gnu_make = { \ 18 - if test -z '$(MAKELEVEL)'; then \ 19 - false; \ 20 - elif test -n '$(MAKE_HOST)'; then \ 21 - true; \ 22 - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ 23 - true; \ 24 - else \ 25 - false; \ 26 - fi; \ 27 -} 17 +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 28 18 am__make_running_with_option = \ 29 19 case $${target_option-} in \ 30 20 ?) ;; \ 31 21 *) echo "am__make_running_with_option: internal error: invalid" \ 32 22 "target option '$${target_option-}' specified" >&2; \ 33 23 exit 1;; \ 34 24 esac; \ ................................................................................ 84 74 POST_INSTALL = : 85 75 NORMAL_UNINSTALL = : 86 76 PRE_UNINSTALL = : 87 77 POST_UNINSTALL = : 88 78 build_triplet = @build@ 89 79 host_triplet = @host@ 90 80 subdir = test/sql_stmt_security_tests 81 +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am 91 82 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 92 83 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ 93 84 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ 94 85 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ 95 86 $(top_srcdir)/configure.ac 96 87 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 97 88 $(ACLOCAL_M4) 98 -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 99 89 mkinstalldirs = $(install_sh) -d 100 90 CONFIG_HEADER = $(top_builddir)/config.h 101 91 CONFIG_CLEAN_FILES = 102 92 CONFIG_CLEAN_VPATH_FILES = 103 93 AM_V_P = $(am__v_P_@AM_V@) 104 94 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) 105 95 am__v_P_0 = false ................................................................................ 116 106 DIST_SOURCES = 117 107 am__can_run_installinfo = \ 118 108 case $$AM_UPDATE_INFO_DIR in \ 119 109 n|no|NO) false;; \ 120 110 *) (install-info --version) >/dev/null 2>&1;; \ 121 111 esac 122 112 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) 123 -am__DIST_COMMON = $(srcdir)/Makefile.in 124 113 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 125 114 ACLOCAL = @ACLOCAL@ 126 115 AMTAR = @AMTAR@ 127 116 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 128 117 AR = @AR@ 129 118 AS = @AS@ 130 119 AUTOCONF = @AUTOCONF@ ................................................................................ 907 896 && { if test -f $@; then exit 0; else break; fi; }; \ 908 897 exit 1;; \ 909 898 esac; \ 910 899 done; \ 911 900 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/sql_stmt_security_tests/Makefile'; \ 912 901 $(am__cd) $(top_srcdir) && \ 913 902 $(AUTOMAKE) --gnu test/sql_stmt_security_tests/Makefile 903 +.PRECIOUS: Makefile 914 904 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 915 905 @case '$?' in \ 916 906 *config.status*) \ 917 907 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ 918 908 *) \ 919 909 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ 920 910 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ ................................................................................ 1081 1071 install-html-am install-info install-info-am install-man \ 1082 1072 install-pdf install-pdf-am install-ps install-ps-am \ 1083 1073 install-strip installcheck installcheck-am installdirs \ 1084 1074 maintainer-clean maintainer-clean-generic mostlyclean \ 1085 1075 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ 1086 1076 tags-am uninstall uninstall-am 1087 1077 1088 -.PRECIOUS: Makefile 1089 - 1090 1078 1091 1079 # Tell versions [3.59,3.63) of GNU make to not export all variables. 1092 1080 # Otherwise a system limit (for SysV at least) may be exceeded. 1093 1081 .NOEXPORT:
Changes to test/sql_stmt_tests/Makefile.in.
1 -# Makefile.in generated by automake 1.15 from Makefile.am. 1 +# Makefile.in generated by automake 1.14.1 from Makefile.am. 2 2 # @configure_input@ 3 3 4 -# Copyright (C) 1994-2014 Free Software Foundation, Inc. 4 +# Copyright (C) 1994-2013 Free Software Foundation, Inc. 5 5 6 6 # This Makefile.in is free software; the Free Software Foundation 7 7 # gives unlimited permission to copy and/or distribute it, 8 8 # with or without modifications, as long as this notice is preserved. 9 9 10 10 # This program is distributed in the hope that it will be useful, 11 11 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 12 12 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 13 13 # PARTICULAR PURPOSE. 14 14 15 15 @SET_MAKE@ 16 16 VPATH = @srcdir@ 17 -am__is_gnu_make = { \ 18 - if test -z '$(MAKELEVEL)'; then \ 19 - false; \ 20 - elif test -n '$(MAKE_HOST)'; then \ 21 - true; \ 22 - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ 23 - true; \ 24 - else \ 25 - false; \ 26 - fi; \ 27 -} 17 +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 28 18 am__make_running_with_option = \ 29 19 case $${target_option-} in \ 30 20 ?) ;; \ 31 21 *) echo "am__make_running_with_option: internal error: invalid" \ 32 22 "target option '$${target_option-}' specified" >&2; \ 33 23 exit 1;; \ 34 24 esac; \ ................................................................................ 84 74 POST_INSTALL = : 85 75 NORMAL_UNINSTALL = : 86 76 PRE_UNINSTALL = : 87 77 POST_UNINSTALL = : 88 78 build_triplet = @build@ 89 79 host_triplet = @host@ 90 80 subdir = test/sql_stmt_tests 81 +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am 91 82 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 92 83 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ 93 84 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ 94 85 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ 95 86 $(top_srcdir)/configure.ac 96 87 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 97 88 $(ACLOCAL_M4) 98 -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 99 89 mkinstalldirs = $(install_sh) -d 100 90 CONFIG_HEADER = $(top_builddir)/config.h 101 91 CONFIG_CLEAN_FILES = 102 92 CONFIG_CLEAN_VPATH_FILES = 103 93 AM_V_P = $(am__v_P_@AM_V@) 104 94 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) 105 95 am__v_P_0 = false ................................................................................ 116 106 DIST_SOURCES = 117 107 am__can_run_installinfo = \ 118 108 case $$AM_UPDATE_INFO_DIR in \ 119 109 n|no|NO) false;; \ 120 110 *) (install-info --version) >/dev/null 2>&1;; \ 121 111 esac 122 112 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) 123 -am__DIST_COMMON = $(srcdir)/Makefile.in 124 113 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 125 114 ACLOCAL = @ACLOCAL@ 126 115 AMTAR = @AMTAR@ 127 116 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 128 117 AR = @AR@ 129 118 AS = @AS@ 130 119 AUTOCONF = @AUTOCONF@ ................................................................................ 879 868 && { if test -f $@; then exit 0; else break; fi; }; \ 880 869 exit 1;; \ 881 870 esac; \ 882 871 done; \ 883 872 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/sql_stmt_tests/Makefile'; \ 884 873 $(am__cd) $(top_srcdir) && \ 885 874 $(AUTOMAKE) --gnu test/sql_stmt_tests/Makefile 875 +.PRECIOUS: Makefile 886 876 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 887 877 @case '$?' in \ 888 878 *config.status*) \ 889 879 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ 890 880 *) \ 891 881 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ 892 882 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ ................................................................................ 1053 1043 install-html-am install-info install-info-am install-man \ 1054 1044 install-pdf install-pdf-am install-ps install-ps-am \ 1055 1045 install-strip installcheck installcheck-am installdirs \ 1056 1046 maintainer-clean maintainer-clean-generic mostlyclean \ 1057 1047 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ 1058 1048 tags-am uninstall uninstall-am 1059 1049 1060 -.PRECIOUS: Makefile 1061 - 1062 1050 version.testcase 1063 1051 1064 1052 # Tell versions [3.59,3.63) of GNU make to not export all variables. 1065 1053 # Otherwise a system limit (for SysV at least) may be exceeded. 1066 1054 .NOEXPORT:
Changes to test/symbolizers.sqlite.
cannot compute difference between binary files
Changes to test/test_line_symbolizer.c.
1072 1072 if (rl2_line_symbolizer_get_stroke_color (line, &red, &green, &blue) != 1073 1073 RL2_OK) 1074 1074 { 1075 1075 fprintf (stderr, "Unable to get Line Symbolizer GetStrokeColor #4\n"); 1076 1076 *retcode += 18; 1077 1077 return 0; 1078 1078 } 1079 - if (red != 0x80 || green != 0x80 || blue != 0x80) 1079 + if (red != 0x00 || green != 0x00 || blue != 0xff) 1080 1080 { 1081 1081 fprintf (stderr, 1082 1082 "Unexpected Line Symbolizer GetStrokeColor #4: %02x%02x%02x\n", 1083 1083 red, green, blue); 1084 1084 *retcode += 19; 1085 1085 return 0; 1086 1086 } ................................................................................ 1311 1311 if (rl2_line_symbolizer_get_stroke_color (line, &red, &green, &blue) != 1312 1312 RL2_OK) 1313 1313 { 1314 1314 fprintf (stderr, "Unable to get Line Symbolizer GetStrokeColor #9\n"); 1315 1315 *retcode += 48; 1316 1316 return 0; 1317 1317 } 1318 - if (red != 0x80 || green != 0x80 || blue != 0x80) 1318 + if (red != 0x00 || green != 0x00 || blue != 0xff) 1319 1319 { 1320 1320 fprintf (stderr, 1321 1321 "Unexpected Line Symbolizer GetStrokeColor #9: %02x%02x%02x\n", 1322 1322 red, green, blue); 1323 1323 *retcode += 49; 1324 1324 return 0; 1325 1325 } ................................................................................ 1359 1359 RL2_OK) 1360 1360 { 1361 1361 fprintf (stderr, 1362 1362 "Unable to get Line Symbolizer GetStrokeColor #10\n"); 1363 1363 *retcode += 54; 1364 1364 return 0; 1365 1365 } 1366 - if (red != 0x80 || green != 0x80 || blue != 0x80) 1366 + if (red != 0x00 || green != 0x00 || blue != 0xff) 1367 1367 { 1368 1368 fprintf (stderr, 1369 1369 "Unexpected Line Symbolizer GetStrokeColor #10: %02x%02x%02x\n", 1370 1370 red, green, blue); 1371 1371 *retcode += 55; 1372 1372 return 0; 1373 1373 } ................................................................................ 1407 1407 RL2_OK) 1408 1408 { 1409 1409 fprintf (stderr, 1410 1410 "Unable to get Line Symbolizer GetStrokeColor #11\n"); 1411 1411 *retcode += 60; 1412 1412 return 0; 1413 1413 } 1414 - if (red != 0x80 || green != 0x80 || blue != 0x80) 1414 + if (red != 0x00 || green != 0x00 || blue != 0xff) 1415 1415 { 1416 1416 fprintf (stderr, 1417 1417 "Unexpected Line Symbolizer GetStrokeColor #11: %02x%02x%02x\n", 1418 1418 red, green, blue); 1419 1419 *retcode += 61; 1420 1420 return 0; 1421 1421 }
Changes to test/test_point_symbolizer.c.
786 786 if (strcmp (style_name, "point_3") == 0) 787 787 { 788 788 if (dblval == 3.0 && dblval2 == 2.0) 789 789 intval = 1; 790 790 } 791 791 else 792 792 { 793 - if (dblval == 0.5 && dblval2 == 0.5) 793 + if (dblval == 0.0 && dblval2 == 0.0) 794 794 intval = 1; 795 795 } 796 796 if (intval != 1) 797 797 { 798 798 fprintf (stderr, 799 799 "%s: Unexpected Point Symbolizer GetAnchorPoint #1: %1.4f %1.4f\n", 800 800 style_name, dblval, dblval2);
Changes to test/test_polygon_symbolizer.c.
1506 1506 if (symbolizer == NULL) 1507 1507 { 1508 1508 fprintf (stderr, "Unexpected NULL VectorSymbolizer (%s) #6\n", 1509 1509 style_name); 1510 1510 *retcode += 22; 1511 1511 return 0; 1512 1512 } 1513 - polyg = rl2_get_polygon_symbolizer (symbolizer, 1); 1513 + polyg = rl2_get_polygon_symbolizer (symbolizer, 0); 1514 1514 if (polyg == NULL) 1515 1515 { 1516 1516 fprintf (stderr, "Unable to get Polygon Symbolizer #5\n"); 1517 1517 *retcode += 23; 1518 1518 return 0; 1519 1519 } 1520 1520 if (rl2_polygon_symbolizer_get_fill_color (polyg, &red, &green, &blue) != ................................................................................ 1521 1521 RL2_OK) 1522 1522 { 1523 1523 fprintf (stderr, 1524 1524 "Unable to get Polygon Symbolizer GetFillColor #4\n"); 1525 1525 *retcode += 24; 1526 1526 return 0; 1527 1527 } 1528 - if (red != 0x37 || green != 0x81 || blue != 0xf2) 1528 + if (red != 0x70 || green != 0xff || blue != 0xc0) 1529 1529 { 1530 1530 fprintf (stderr, 1531 1531 "Unexpected Polygon Symbolizer GetStrokeColor #5: %02x%02x%02x\n", 1532 1532 red, green, blue); 1533 1533 *retcode += 25; 1534 1534 return 0; 1535 1535 }
Changes to tools/Makefile.in.
1 -# Makefile.in generated by automake 1.15 from Makefile.am. 1 +# Makefile.in generated by automake 1.14.1 from Makefile.am. 2 2 # @configure_input@ 3 3 4 -# Copyright (C) 1994-2014 Free Software Foundation, Inc. 4 +# Copyright (C) 1994-2013 Free Software Foundation, Inc. 5 5 6 6 # This Makefile.in is free software; the Free Software Foundation 7 7 # gives unlimited permission to copy and/or distribute it, 8 8 # with or without modifications, as long as this notice is preserved. 9 9 10 10 # This program is distributed in the hope that it will be useful, 11 11 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 12 12 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 13 13 # PARTICULAR PURPOSE. 14 14 15 15 @SET_MAKE@ 16 16 17 17 VPATH = @srcdir@ 18 -am__is_gnu_make = { \ 19 - if test -z '$(MAKELEVEL)'; then \ 20 - false; \ 21 - elif test -n '$(MAKE_HOST)'; then \ 22 - true; \ 23 - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ 24 - true; \ 25 - else \ 26 - false; \ 27 - fi; \ 28 -} 18 +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 29 19 am__make_running_with_option = \ 30 20 case $${target_option-} in \ 31 21 ?) ;; \ 32 22 *) echo "am__make_running_with_option: internal error: invalid" \ 33 23 "target option '$${target_option-}' specified" >&2; \ 34 24 exit 1;; \ 35 25 esac; \ ................................................................................ 86 76 NORMAL_UNINSTALL = : 87 77 PRE_UNINSTALL = : 88 78 POST_UNINSTALL = : 89 79 build_triplet = @build@ 90 80 host_triplet = @host@ 91 81 bin_PROGRAMS = rl2sniff$(EXEEXT) rl2tool$(EXEEXT) wmslite$(EXEEXT) 92 82 subdir = tools 83 +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ 84 + $(top_srcdir)/depcomp 93 85 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 94 86 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ 95 87 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ 96 88 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ 97 89 $(top_srcdir)/configure.ac 98 90 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 99 91 $(ACLOCAL_M4) 100 -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 101 92 mkinstalldirs = $(install_sh) -d 102 93 CONFIG_HEADER = $(top_builddir)/config.h 103 94 CONFIG_CLEAN_FILES = 104 95 CONFIG_CLEAN_VPATH_FILES = 105 96 am__installdirs = "$(DESTDIR)$(bindir)" 106 97 PROGRAMS = $(bin_PROGRAMS) 107 98 am_rl2sniff_OBJECTS = rl2sniff.$(OBJEXT) ................................................................................ 174 165 am__define_uniq_tagged_files = \ 175 166 list='$(am__tagged_files)'; \ 176 167 unique=`for i in $$list; do \ 177 168 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 178 169 done | $(am__uniquify_input)` 179 170 ETAGS = etags 180 171 CTAGS = ctags 181 -am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp 182 172 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 183 173 ACLOCAL = @ACLOCAL@ 184 174 AMTAR = @AMTAR@ 185 175 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 186 176 AR = @AR@ 187 177 AS = @AS@ 188 178 AUTOCONF = @AUTOCONF@ ................................................................................ 363 353 && { if test -f $@; then exit 0; else break; fi; }; \ 364 354 exit 1;; \ 365 355 esac; \ 366 356 done; \ 367 357 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tools/Makefile'; \ 368 358 $(am__cd) $(top_srcdir) && \ 369 359 $(AUTOMAKE) --gnu tools/Makefile 360 +.PRECIOUS: Makefile 370 361 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 371 362 @case '$?' in \ 372 363 *config.status*) \ 373 364 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ 374 365 *) \ 375 366 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ 376 367 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ ................................................................................ 684 675 install-info install-info-am install-man install-pdf \ 685 676 install-pdf-am install-ps install-ps-am install-strip \ 686 677 installcheck installcheck-am installdirs maintainer-clean \ 687 678 maintainer-clean-generic mostlyclean mostlyclean-compile \ 688 679 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ 689 680 tags tags-am uninstall uninstall-am uninstall-binPROGRAMS 690 681 691 -.PRECIOUS: Makefile 692 - 693 682 694 683 # Tell versions [3.59,3.63) of GNU make to not export all variables. 695 684 # Otherwise a system limit (for SysV at least) may be exceeded. 696 685 .NOEXPORT:
Changes to tools/wmslite.c.
3399 3399 wms_get_capabilities (req->socket, req->cached_capabilities, 3400 3400 req->cached_capabilities_len, req->log); 3401 3401 } 3402 3402 if (args->request_type == WMS_GET_MAP) 3403 3403 { 3404 3404 /* preparing the WMS GetMap payload */ 3405 3405 args->db_handle = req->conn->handle; 3406 - args->stmt_get_map_raster = req->conn->stmt_get_map_raster; 3407 - args->stmt_get_map_vector = req->conn->stmt_get_map_vector; 3406 + args->stmt_get_map = req->conn->stmt_get_map; 3408 3407 log_get_map_1 (req->log, timestamp, http_status, method, url, args); 3409 3408 wms_get_map (args, req->socket, req->log); 3410 3409 } 3411 3410 goto end_request; 3412 3411 3413 3412 /* preparing an HTTP error code */ 3414 3413 http_error: ................................................................................ 4441 4440 static void 4442 4441 get_raster_styles (sqlite3 * handle, struct wms_list *list) 4443 4442 { 4444 4443 /* retrieving all declared Raster Styles */ 4445 4444 int ret; 4446 4445 sqlite3_stmt *stmt; 4447 4446 const char *sql = "SELECT coverage_name, name, title, abstract " 4448 - "FROM SE_raster_styled_layers_view ORDER BY coverage_name, name"; 4447 + "FROM SE_raster_styled_layers_view ORDER BY coverage_name, style_id"; 4449 4448 ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); 4450 4449 if (ret != SQLITE_OK) 4451 4450 return; 4452 4451 while (1) 4453 4452 { 4454 4453 /* scrolling the result set rows */ 4455 4454 ret = sqlite3_step (stmt); ................................................................................ 4476 4475 static void 4477 4476 get_vector_styles (sqlite3 * handle, struct wms_list *list) 4478 4477 { 4479 4478 /* retrieving all declared Vector Styles */ 4480 4479 int ret; 4481 4480 sqlite3_stmt *stmt; 4482 4481 const char *sql = "SELECT coverage_name, name, title, abstract " 4483 - "FROM SE_vector_styled_layers_view ORDER BY coverage_name, name"; 4482 + "FROM SE_vector_styled_layers_view ORDER BY coverage_name, style_id"; 4484 4483 ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); 4485 4484 if (ret != SQLITE_OK) 4486 4485 return; 4487 4486 while (1) 4488 4487 { 4489 4488 /* scrolling the result set rows */ 4490 4489 ret = sqlite3_step (stmt);